解决Ubuntu 9.10安装PostgreSQL 8.4不能启动问题

今天想在Ubuntu 9.10安装PostgreSQL 8.4学习下,执行完下面命令后

linuxidc@pentest:~$ sudo apt-get install postgresql-8.4 postgresql-client-8.4 postgresql-contrib-8.4

返回如下:

update-alternatives: 使用 /usr/share/postgresql/8.4/man/man1/postmaster.1.gz 来提供 /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz),于 自动模式 中。
* Starting PostgreSQL 8.4 database server                                                 * The PostgreSQL server failed to start. Please check the log output:
2010-01-25 00:03:24 CST FATAL:  could not create shared memory segment: ?????
2010-01-25 00:03:24 CST DETAIL:  Failed system call was shmget(key=5433001, size=36880384, 03600).
2010-01-25 00:03:24 CST HINT:  This error usually means that PostgreSQL’s request for a shared memory segment exceeded your kernel’s SHMMAX parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMMAX.  To reduce the request size (currently 36880384 bytes), reduce PostgreSQL’s shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 103).
If the request size is already small, it’s possible that it is less than your kernel’s SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
[fail]
invoke-rc.d: initscript postgresql-8.4, action “start” failed.
dpkg:处理 postgresql-8.4 (–configure)时出错:
子进程 已安装的 post-installation 脚本 返回了错误号 1
dpkg:依赖关系问题使得 postgresql-contrib-8.4 的配置工作不能继续:
postgresql-contrib-8.4 依赖于 postgresql-8.4;然而:
软件包 postgresql-8.4 还没有被配置。
dpkg:处理 postgresql-contrib-8.4 (–configure)时出错:
依赖关系问题 – 仍未被配置
没有写入 apport 报告,因为错误信息指示它是从上一个失败导致的。
在处理时有错误发生:
postgresql-8.4
postgresql-contrib-8.4
E: Sub-process /usr/bin/dpkg returned an error code (1)

解决方法很简单:

linuxidc@pentest:~$ sudo sysctl -w kernel.shmmax=2147483648
kernel.shmmax = 2147483648
linuxidc@pentest:~$ sysctl -a |grep shmmax
error: permission denied on key ‘kernel.cad_pid’
kernel.shmmax = 2147483648
error: permission denied on key ‘fs.binfmt_misc.register’
error: permission denied on key ‘net.ipv4.route.flush’
error: permission denied on key ‘net.ipv6.route.flush’
linuxidc@pentest:~$ sudo /etc/init.d/postgresql-8.4 start
* Starting PostgreSQL 8.4 database server                                         [ OK ]

相关推荐