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