久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

怎么在CentOS 7.4環境下源碼編譯安裝postgreSQL 11.4

156次閱讀
沒有評論

共計 3651 個字符,預計需要花費 10 分鐘才能閱讀完成。

本篇內容介紹了“怎么在 CentOS 7.4 環境下源碼編譯安裝 postgreSQL 11.4”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓丸趣 TV 小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

1. 安裝依賴包  

yum install -y readline readline-devel openssl openssl-devel zlib zlib-devel

2. 下載軟件

wget https://ftp.postgresql.org/pub/source/v11.4/postgresql-11.4.tar.gz

3. 解壓并安裝

tar -zvvf postgresql-11.4.tar.gz
#進入解壓后的文件夾 cd postgresql-11.4
./configure --prefix=/usr/local/pgsql # 指定默認安裝路徑
make # 編譯
make install # 安裝 

4. 添加用戶并更改權限

useradd postgres # 添加用戶
passwd postgres # 設置密碼
mkdir -p /data/pgsql/data
mkdir -p /data/pgsql/log
cd /data/pgsql/log
touch pgsql.log
chown -R postgres:postgres /data/pgsql

5. 添加環境變量

vim /etc/profile

內容如下:

#postgresql
export PGHOME=/data/pgsql
export PGBASE=/usr/local/pgsql
export PATH=$PATH:$PGBASE/bin

使之生效

source /etc/profile

6. 初始化數據

切換到 postgres 用戶下 su – postgres

[postgres@localhost ~]$ cd /usr/local/pgsql/bin/
[postgres@localhost bin]$ ls
clusterdb ecpg pg_config pg_isready pg_rewind pg_waldump vacuumdb
createdb initdb pg_controldata pg_receivewal pg_test_fsync postgres
createuser pg_archivecleanup pg_ctl pg_recvlogical pg_test_timing postmaster
dropdb pg_basebackup pg_dump pg_resetwal pg_upgrade psql
dropuser pgbench pg_dumpall pg_restore pg_verify_checksums reindexdb
[postgres@localhost bin]$ ./initdb -D /data/pgsql/data
The files belonging to this database system will be owned by user  postgres .
This user must also own the server process.
The database cluster will be initialized with locale  en_US.UTF-8 .
The default database encoding has accordingly been set to  UTF8 .
The default text search configuration will be set to  english .
Data page checksums are disabled.
fixing permissions on existing directory /data/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... PRC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling  trust  authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
 ./pg_ctl -D /data/pgsql/data -l logfile start

7. 檢查數據目錄:

[root@localhost data]# ls
base pg_hba.conf pg_notify pg_stat pg_twophase postgresql.auto.conf
global pg_ident.conf pg_replslot pg_stat_tmp PG_VERSION postgresql.conf
pg_commit_ts pg_logical pg_serial pg_subtrans pg_wal
pg_dynshmem pg_multixact pg_snapshots pg_tblspc pg_xact

其中

base 目錄是表空間目錄;

global 目錄是相關全局變量目錄;

pg_hba.conf 是訪問控制配置文件;

postgresql.conf 是 postgresql 的主配置文件。

8. 修改 pg_hba.conf 文件

將該文件中的 IPV4 的連接修改為 0.0.0.0/0,表示信任來自所有 id 連接的客戶端,加密方式改為 md5,如下圖所示:

9. 修改 postgresql.conf 配置文件

將 localhost 改為 *,表示監聽所有的網絡連接。其他的參數保持默認即可。

10. 關閉防火墻

systemctl stop firewalld

11. 啟動數據庫

[postgres@localhost bin]$ ./pg_ctl -D /data/pgsql/data -l /data/pgsql/log/pgsql.log start
waiting for server to start.... done
server started

12. 登錄數據庫并設置密碼

[postgres@localhost bin]$ ./psql 
psql (11.4)
Type  help  for help.
postgres=# \password
Enter new password: 
Enter it again: 
postgres=# \l
 List of databases
 Name | Owner | Encoding | Collate | Ctype | Access privileges 
-----------+----------+----------+-------------+-------------+-----------------------
 postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
 | | | | | postgres=CTc/postgres
 template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
 | | | | | postgres=CTc/postgres
(3 rows)

13. navicat 登錄

“怎么在 CentOS 7.4 環境下源碼編譯安裝 postgreSQL 11.4”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注丸趣 TV 網站,丸趣 TV 小編將為大家輸出更多高質量的實用文章!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-28發表,共計3651字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 宜川县| 莲花县| 灯塔市| 墨竹工卡县| 西和县| 礼泉县| 蓝山县| 甘孜| 调兵山市| 青冈县| 化德县| 行唐县| 和田市| 永顺县| 涞水县| 门头沟区| 奉节县| 连云港市| 青神县| 新乐市| 乌兰县| 辽源市| 北京市| 广饶县| 平陆县| 康定县| 潼南县| 百色市| 武义县| 岳池县| 古丈县| 鄄城县| 县级市| 公安县| 东兴市| 大田县| 海阳市| 富蕴县| 桃园县| 道孚县| 莲花县|