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
- lnmp環境安裝-原始碼編譯LNMP原始碼編譯
- CentOS6.9原始碼編譯安裝nginx+php7+mysql環境CentOS原始碼編譯NginxPHPMySql
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- Android 原始碼的下載和編譯環境的安裝及編譯Android原始碼編譯
- Centos7下原始碼編譯安裝apacheCentOS原始碼編譯Apache
- CentOS 6.7下MySQL 5.6原始碼編譯安裝CentOSMySql原始碼編譯
- CentOS 6.7下原始碼編譯安裝MySQL 5.7.5CentOS原始碼編譯MySql
- [環境搭建] 透過原始碼編譯安裝 Redis原始碼編譯Redis
- centos下編譯lnmp環境CentOS編譯LNMP
- CentOS5.5下快速編譯安裝最新的LAMP環境CentOS編譯LAMP
- Linux環境下原始碼編譯方式安裝MySQL5.1(3)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(2)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(1)Linux原始碼編譯MySql
- centos7環境下二進位制編譯安裝ffmpegCentOS編譯
- Linux 環境下編譯安裝 RedisLinux編譯Redis
- CentOS 7 原始碼編譯安裝 Mysql 5.7CentOS原始碼編譯MySql
- 從零搭建LNMP環境(一) - 編譯原始碼安裝PHPLNMP編譯原始碼PHP
- 編譯安裝LAMP環境編譯LAMP
- PostgreSQL原始碼學習 win10原始碼編譯安裝SQL原始碼Win10編譯
- 初始化編譯環境 下載原始碼編譯原始碼
- Linux環境下, 原始碼編譯安裝詳解 (編譯CMake 3.15 和 gcc 5.3.0 為例)Linux原始碼編譯GC
- CentOS 下編譯安裝 NginxCentOS編譯Nginx
- CentOS 下編譯安裝 apacheCentOS編譯Apache
- Centos 下編譯安裝RedisCentOS編譯Redis
- CentOS 6.5 原始碼編譯安裝 MySQL 5.5 5.6CentOS原始碼編譯MySql
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- CPP編譯器安裝(Windows環境)編譯Windows
- docker 安裝 Laravel 環境 (nginx mariadb PHP7.4)--centos7.3DockerLaravelNginxPHPCentOS
- Centos7環境下安裝curlCentOS
- Centos7安裝(四)抓包工具wireshark原始碼編譯安裝CentOS原始碼編譯
- linux或者CentOS環境下安裝.NET Core環境LinuxCentOS
- 在CentOS7.6裡編譯安裝PHP7.4,很詳細CentOS編譯PHP
- CentOS 7版本原始碼編譯方式安裝TokuDBCentOS原始碼編譯
- centos7.4原始碼安裝php,swoole,nginx,redis,mariadbCentOS原始碼PHPNginxRedis
- CentOS 下編譯安裝 PHP7.2CentOS編譯PHP
- Linux Centos下編譯安裝RedisLinuxCentOS編譯Redis
- centos7下編譯安裝lnmpCentOS編譯LNMP