1下载安装包postgresql 9612软件下载3解压1 安装依赖包2 增加用户设置密码4配置编译选项5编译6初始化数据库7配置环境变量8启动测试9配置系统服务参考笔记
1、下载安装包postgresql 9.6.1
地址:http://ftp.stu.edu.tw/pub/postgresql/latest/
rpm下载地址:
https://yum.postgresql.org/9.6/redhat/rhel-6.4-x86_64/
2、软件下载
在root 用户下 cd /opt/soft/ wget https://ftp.postgresql.org/pub/source/v9.6.1/postgresql-9.6.1.tar.gz
3、解压
[root@pg96 soft]# tar -zxvf postgresql-9.6.1.tar.gz3.1 安装依赖包
[root@pg96 soft]# yum intall -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake[root@pg96 soft]# yum install gcc* readline-devel3.2 增加用户设置密码:
[root@pg96 ~]# adduser postgresadduser:用户“postgres”已存在 [root@pg96 ~]# passwd postgres 更改用户 postgres 的密码 。 新的 密码: 无效的密码: 它基于字典单词 重新输入新的 密码: passwd: 所有的身份验证令牌已经成功更新。
[root@pg96 ~]# id postgresuid=26(postgres) gid=26(postgres) 组=26(postgres)[root@pg96 ~]#4、配置编译选项
[root@pg96 postgresql-9.6.1]# ./configure --PRefix=/opt/pgsql/ --with-perl --with-libxml --with-libxslt5、编译
[root@pg96 postgresql-9.6.1]# gmake[root@pg96 postgresql-9.6.1]# gmake install修改root用户的环境变量:
[root@pg96 pgsql]# vim ~/.bash_profile
6、初始化数据库
[root@pg96 opt]# chown postgres:postgres /opt/pgdata/[root@pg96 opt]# su - postgres[postgres@pg96 ~]$[postgres@pg96 ~]$/opt/pgsql/bin/initdb -D /opt/pgdata/7、配置环境变量
[postgres@pg96 bin]$vim ~/.bash_profile
8、启动测试:
[postgres@pg96 bin]$pg_ctl startserver starting[postgres@pg96 bin]$LOG: database system was shut down at 2017-02-07 09:04:50 GMTLOG: MultiXact member wraparound protections are now enabledLOG: database system is ready to accept connectionsLOG: autovacuum launcher started[postgres@pg96 bin]$[postgres@pg96 bin]$psqlpsql (9.6.1)Type "help" for help.postgres=# /l List of databases Name | Owner | Encoding | Collate | Ctype | access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres(3 rows)postgres=# /q[postgres@pg96 bin]$pg_ctl stopLOG: received fast shutdown requestLOG: aborting any active transactionsLOG: autovacuum launcher shutting downLOG: shutting downwaiting for server to shut down....LOG: database system is shut down doneserver stopped[postgres@pg96 bin]$9、配置系统服务
[root@pg96 local]# cp /opt/soft/postgresql-9.6.1/contrib/start-scripts/linux /etc/init.d/postgresql-9.6[root@pg96 local]# vim /etc/init.d/postgresql-9.6[root@pg96 init.d]# chmod +x /etc/init.d/postgresql-9.6[root@pg96 init.d]# service postgresql-9.6 startStarting PostgreSQL: ok[root@pg96 init.d]#参考笔记
http://www.itwendao.com/article/detail/88726.html
升级python2.6到python2.7 http://ruter.sundaystart.net/2015/12/03/Update-python/
https://segmentfault.com/a/1190000000654227