之前用ubuntu裝PostgreSQ,遇到各種錯誤,最後決定換個系統安裝,centos很吊。
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
- 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
補充: