Centos7 PostgreSQL安裝

之前用ubuntu裝PostgreSQ,遇到各種錯誤,最後決定換個系統安裝,centos很吊。

來源於:lvk618shanzhizi

http://blog.csdn.net/lk10207160511/article/details/50359549

http://blog.csdn.net/shanzhizi/article/details/46484481

一、安裝PostgreSQL  CentOS 7 64bit

rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm

二、執行安裝命令

yum update

  1. yum install postgresql94-server postgresql94-contrib  

在執行下面命令時,會安裝不了相應的包,那是因爲網絡斷了,只需要重啓系統 就可以了。
sudo yum install postgresql94-server postgresql94-contrib

三、驗證是否安裝成功

sudo rpm -aq| grep postgres
初始化數據庫

sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
啓動服務並設置爲開機啓動

sudo systemctl enable postgresql-9.4
sudo systemctl start postgresql-9.4
七、開放防火牆端口

sudo firewall-cmd --permanent --add-port=5432/tcp
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --reload

八、訪問PostgreSQL

su - postgres

輸入命令psql將看到PostgrSQL的版本信息。

psql (9.4.1)

九、設置postgres用戶密碼

postgres=# \password postgres


補充:

在CentOS上編譯安裝PostgreSQL

請參考 http://my.oschina.net/tashi/blog/189351
作者:恆者 
開源中國社區
 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章