Centos 7 安装 PostgreSQL
生活随笔
收集整理的這篇文章主要介紹了
Centos 7 安装 PostgreSQL
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
本文只講PostgreSQL在CentOS 7.x 下的安裝,其他系統(tǒng)請(qǐng)查看:https://www.postgresql.org/download
PostgreSQL 所用版本為:PostgreSQL 10
1.安裝存儲(chǔ)庫(kù)
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm2.安裝客戶端
yum install postgresql103.安裝服務(wù)端
yum install postgresql10-server4.驗(yàn)證是否安裝成功
rpm -aq| grep postgres輸出如下:
4.初始化數(shù)據(jù)庫(kù)
/usr/pgsql-10/bin/postgresql-10-setup initdb5.啟用開機(jī)自啟動(dòng)
systemctl enable postgresql-10 systemctl start postgresql-106.配置防火墻
firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload7.修改用戶密碼
su - postgres? 切換用戶,執(zhí)行后提示符會(huì)變?yōu)?'-bash-4.2$'psql -U postgres 登錄數(shù)據(jù)庫(kù),執(zhí)行后提示符變?yōu)?'postgres=#'ALTER USER postgres WITH PASSWORD 'postgres'? 設(shè)置postgres用戶密碼為postgres\q? 退出數(shù)據(jù)庫(kù)8.開啟遠(yuǎn)程訪問
vim /var/lib/pgsql/10/data/postgresql.conf修改#listen_addresses = 'localhost' 為 listen_addresses='*'當(dāng)然,此處‘*’也可以改為任何你想開放的服務(wù)器IP9.信任遠(yuǎn)程連接
vi m/var/lib/pgsql/10/data/pg_hba.conf修改如下內(nèi)容,信任指定服務(wù)器連接# IPv4 local connections:host? ? all? ? ? ? ? ? all? ? ? 127.0.0.1/32? ? ? trusthost? ? all? ? ? ? ? ? all? ? ? 192.168.157.1/32(需要連接的服務(wù)器IP)? trust10.重啟服務(wù)
systemctl restart postgresql-1011.使用DBMS軟件連接
這里使用的是Navicat
連接成功:
轉(zhuǎn)載于:https://www.cnblogs.com/stulzq/p/7766409.html
總結(jié)
以上是生活随笔為你收集整理的Centos 7 安装 PostgreSQL的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python sqlalchemy or
- 下一篇: 在Centos 6.5 X64下切割m3