新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
詳解CentOS7中安裝postgreSQL11
PostgreSQL是一個(gè)功能強(qiáng)大的開源對(duì)象關(guān)系型數(shù)據(jù)庫(kù)系統(tǒng),他使用和擴(kuò)展了SQL語(yǔ)言,并結(jié)合了許多安全存儲(chǔ)和擴(kuò)展最復(fù)雜數(shù)據(jù)工作負(fù)載的功能。

莊河網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),莊河網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為莊河上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的莊河做網(wǎng)站的公司定做!
1.添加PostgreSQL Yum存儲(chǔ)庫(kù)
sudo yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
2.安裝PostgreSQL Server和客戶端軟件包
sudo yum -y install postgresql11-server postgresql11
3.初始化數(shù)據(jù)庫(kù)并啟用自動(dòng)啟動(dòng)
# 初始化
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
# 啟動(dòng)
sudo systemctl start postgresql-11
# 設(shè)置開機(jī)自啟動(dòng)
sudo systemctl enable postgresql-11
# 下面這兩個(gè)配置是關(guān)于防火墻的(我沒(méi)有用到)
sudo firewall-cmd --add-service=postgresql --permanent
sudo firewall-cmd --reload
4.啟用遠(yuǎn)程訪問(wèn)PostgreSQL(作用是可以通過(guò)公網(wǎng)連接你的數(shù)據(jù)庫(kù),前提是你有公網(wǎng)ip)
# 我的路徑是這樣的
vi /var/lib/pgsql/11/data/postgresql.conf
# 修改
listen_addresses = '*'
# 我的路徑是這樣的
sudo vim /var/lib/pgsql/11/data/pg_hba.conf
# 修改
host all all 127.0.0.1/32 md5
# 添加
host all all 0.0.0.0/0 trust
# 重啟
sudo systemctl restart postgresql-11
5.設(shè)置PostgreSQL管理員用戶的密碼(一定要按照這種格式配置用戶名和密碼)
sudo su - postgres
psql -c "alter user postgres with password '123456'"
需要注意,如果是云服務(wù)器,需要打開對(duì)應(yīng)端口。我就吃了這個(gè)虧,折騰了很長(zhǎng)時(shí)間。
本文標(biāo)題:詳解CentOS7中安裝postgreSQL11
本文地址:http://www.dlmjj.cn/article/dhjsoec.html


咨詢
建站咨詢
