centos7 安裝PostgreSQL

PostgreSQL

Red Hat系列產品包括Red Hat Enterprise Linux,CentOS,Fedora,Scientific Linux,Oracle Linux等。默認情況下,PostgreSQL在這些平臺上可用。然而,平臺的每個版本通常都是“快照”特定版本的PostgreSQL,然後在該平臺的整個生命週期中得到支持。由於這通常意味着不同於首選的版本,因此PostgreSQL項目提供了最常見分佈的所有受支持版本的軟件包倉庫。

PostgreSQL Yum

使用yum存儲庫,請按照下列步驟操作:

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm

安裝客戶端軟件包:

yum install postgresql10

可選安裝服務器軟件包:

yum install postgresql10-server

可選地初始化數據庫並啓用自動啓動:

/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

配置用戶名密碼
1、PostgreSQL登錄

# sudo -u postgres psql 
postgres=# ALTER USER postgres WITH PASSWORD 'postgres';
postgres=#\q
# sudo passwd -d postgres

配置遠程訪問

# vim /var/lib/pgsql/10/data/pg_hba.conf
host    all     all             0.0.0.0/0               trust
# vim /var/lib/pgsql/10/data/postgresql.conf
listen_addresses = '*'
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章