CentOS 7.4 環境下原始碼編譯安裝 postgreSQL 11.4
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 登入
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69915315/viewspace-2651313/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 7.4 環境下原始碼編譯(多例項)安裝 Mysql 5.7.26CentOS原始碼編譯MySql
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- CentOS6.9原始碼編譯安裝nginx+php7+mysql環境CentOS原始碼編譯NginxPHPMySql
- Centos7下原始碼編譯安裝apacheCentOS原始碼編譯Apache
- [環境搭建] 透過原始碼編譯安裝 Redis原始碼編譯Redis
- Linux 環境下編譯安裝 RedisLinux編譯Redis
- centos7環境下二進位制編譯安裝ffmpegCentOS編譯
- Linux環境下, 原始碼編譯安裝詳解 (編譯CMake 3.15 和 gcc 5.3.0 為例)Linux原始碼編譯GC
- PostgreSQL原始碼學習 win10原始碼編譯安裝SQL原始碼Win10編譯
- CentOS 下編譯安裝 NginxCentOS編譯Nginx
- CentOS 下編譯安裝 apacheCentOS編譯Apache
- Debian9(Stretch) 下編譯安裝LNMP環境編譯LNMP
- Debian9 (Stretch) 下編譯安裝 LNMP 環境編譯LNMP
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- linux或者CentOS環境下安裝.NET Core環境LinuxCentOS
- docker 安裝 Laravel 環境 (nginx mariadb PHP7.4)--centos7.3DockerLaravelNginxPHPCentOS
- CPP編譯器安裝(Windows環境)編譯Windows
- centos7.4原始碼安裝php,swoole,nginx,redis,mariadbCentOS原始碼PHPNginxRedis
- Centos7安裝(四)抓包工具wireshark原始碼編譯安裝CentOS原始碼編譯
- CentOS 7.4 下安裝Python3.6CentOSPython
- Centos7環境下安裝curlCentOS
- grpc-java原始碼環境編譯RPCJava原始碼編譯
- CentOS 下編譯安裝 PHP7.2CentOS編譯PHP
- 原始碼編譯安裝Redis原始碼編譯Redis
- 在CentOS7.6裡編譯安裝PHP7.4,很詳細CentOS編譯PHP
- Docker環境下編譯安裝PHP7.1.4 Nginx1.12.0Docker編譯PHPNginx
- Centos7.x環境下 安裝DiszzCentOS
- Ubuntu 18.04(虛擬機器)環境下編譯Android 原始碼Ubuntu虛擬機編譯Android原始碼
- qgroundcontrol開發環境搭建原始碼編譯開發環境原始碼編譯
- openEuler arm 環境原始碼編譯mysql 8.0.37原始碼編譯MySql
- Ubuntu環境編譯OpenJDK11原始碼Ubuntu編譯JDK原始碼
- Centos 7.6 下Mysql8.0.16編譯安裝CentOSMySql編譯
- CentOS下編譯安裝Python3教程CentOS編譯Python
- CentOS 7下編譯安裝Python3CentOS編譯Python
- centos PHP 編譯安裝CentOSPHP編譯
- 原始碼編譯安裝的原理原始碼編譯
- 【轉】MySQL原始碼編譯安裝MySql原始碼編譯
- CentOS7.3 編譯搭建 lamp 環境CentOS編譯LAMP