PostgreSQL在CentOS下的源码安装
下面主要是PostgreSQL在CentOS下的安装步骤,和Linux步骤基本类似。 alias pg_stop='pg_ctl -D $PGDATA stop -m fast' ---rz命令上传,最好是在postgres用户下 ---解压 #tar xvf postgresql-9.1.3 ---配置编译与安装 需要的安装包参考: http://my.oschina.net/Kenyon/blog/83601,主要是 yum install -y perl-ExtUtils-Embed readline-devel zlib-develpam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake #cd postgresql-9.1.3 # ./configure --prefix=/home/postgres --with-pgport=1233 --with-perl --with-python --with-openssl --with-pam --with-ldap --with-libxml --with-libxslt --enable-thread-safety ---具体的configure 可以用configure --help来查看 ---编译 #gmake world ---建议用gmake而不是make来做,完成后,最后会显示信息: gmake -C config all gmake[1]: Entering directory `/home/postgres/postgresql-9.1.3/config' gmake[1]: Nothing to be done for `all'. gmake[1]: Leaving directory `/home/postgres/postgresql-9.1.3/config' All of PostgreSQL successfully made. Ready to install. ---安装,带world参数可以安装PG的附属信息,如文档,帮助等 #gmake install-world ---成功安装后显示: gmake[1]: Leaving directory `/home/postgres/postgresql-9.1.3/config' PostgreSQL installation complete. gmake: Leaving directory `/home/postgres/postgresql-9.1.3' 5.创建初始数据库 [root@localhost /]# su - postgres [postgres@localhost ~]$ initdb -D /database/pgdata -E UTF8 --locale=C -U postgres -W 完成后可以看到提示: Success. You can now start the database server using: postgres -D /database/pgdata or pg_ctl -D /database/pgdata -l logfile start 6.启动与关闭数据库 启动,指定日志: pg_ctl -D $PGDATA -l /home/postgres/pgsql.log start 关闭: pg_ctl -D $PGDATA stop 7.登陆数据库 [postgres@localhost ~]$ psql psql (8.4.9,server 9.1.3) WARNING: psql version 8.4,server version 9.1. Some psql features might not work. Type "help" for help. postgres=# select version(); version -------------------------------------------------------------------------------------------------------------- PostgreSQL 9.1.3 on x86_64-unknown-linux-gnu,compiled by gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3),64-bit (1 row) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |