Linux7.8環境下的原始碼安裝部署PG14.8
1.建立目錄
# mkdir -p /data/pgsql
# mkdir -p /
data/pgsql/data
2.安裝依賴包
# yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python36-devel gcc-c++ openssl-devel cmake make
3.下載安裝介質
postgresql.org/ftp/source/v14.8/
上傳到 /data
5. 建立postgresql使用者
# useradd postgres
6.設定資料目錄
# chown postgres:postgres -R
/data/pgsql
7
.設定postgres使用者環境變數
# su - postgres
$ vi .bash_profile
export PATH
export PGHOME=/data/pgsql
export PGDATA=/data/pgsql/data
xport GG_HOME=/data/ogg
export PATH=$PGHOME/bin:$PATH:$GG_HOME/bin
8.解壓 安裝源包
$ cd
/data
$ tar -xvf postgresql-14.8.tar.gz
9
.安裝配置
$ cd /data/postgresql-14.8
./configure --prefix=/
data/pgsql --with-wal-blocksize=8 --with-segsize=1 --with-blocksize=8
10.編譯
安裝
$ make
$ make install
11
.安裝擴充套件
$ export PATH=
/data/pgsql/bin:$PATH
$ cd /data/postgresql-14.8/contrib
$ make all
$ make install
12. 初始化資料庫
postgres@pgdb 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 "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".
Data page checksums are disabled.
fixing permissions on existing directory /data/pgsql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... PRC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: 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
13. 修改引數
pg_hba.conf
host all all 0.0.0.0/0 trust
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp' # comma-separated list of directories
unix_socket_directories = '/data/pgsql/run'
# (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
附:
自動啟動指令碼
1.
[root@pgdb system]# cat /etc/systemd/system/postgresql.service
[Unit]
Description=PostgreSQL Database Server
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
Environment=PGPORT=5432
Environment=PGDATA=/data/pgsql/data
1OOMScoreAdjust=-1000
# 啟動命令
ExecStart=/data/pgsql/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
# 重新載入
ExecReload=/data/pgsql/bin/pg_ctl reload -D ${PGDATA} -s
# 停止程式
ExecStop=/data/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2.過載systemctl服務
@pgdb ~]$systemctl daemon-reload
3. 啟動postgresql服務
@pgdb ~]$ sudo systemctl start postgresql.service
4.判斷服務是否啟動,這裡提示成功啟動
@pgdb ~]$ systemctl is-active postgresql.service
active
5. 也可以透過此命令判斷服務狀態
@pgdb ~]$ systemctl status postgresql.service
6. 停止postgresql服務
pgdbt ~]$ systemctl stop postgresql.service
7. 如果啟動配置失敗,也可以透過journalctl命令檢視日誌查詢原因
pgdb ~]$ journalctl -u postgresql.service
設定開機自啟動
來自 “ ITPUB部落格 ” ,連結:https://blog.itpub.net/10201716/viewspace-3002437/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- yapi 在linux環境下的安裝部署APILinux
- lnmp環境安裝-原始碼編譯LNMP原始碼編譯
- Linux 環境下如何安裝部署 RocketMQ 教程LinuxMQ
- CentOS 7.4 環境下原始碼編譯安裝 postgreSQL 11.4CentOS原始碼編譯SQL
- linux下LAMP原始碼安裝部署LinuxLAMP原始碼
- Linux環境下MySQL安裝部署操作步驟LinuxMySql
- RAC環境下安裝部署OWB問題總結
- Windows 環境下 Python 環境安裝WindowsPython
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- Android 原始碼的下載和編譯環境的安裝及編譯Android原始碼編譯
- 在原始碼安裝的LAMP環境中搭建Nagios原始碼LAMPiOS
- CentOS 7.4 環境下原始碼編譯(多例項)安裝 Mysql 5.7.26CentOS原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(3)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(2)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(1)Linux原始碼編譯MySql
- Windows 環境下安裝 LaravelWindowsLaravel
- Mac環境下安裝PodMac
- Windows 環境下安裝 RedisWindowsRedis
- Windows環境下安裝RabbitMQWindowsMQ
- kali環境下安裝dvwa
- ubuntu下安裝boost環境Ubuntu
- Unbuntu下安裝Go環境Go
- RHEL 6下原始碼包安裝部署Ansible原始碼
- Linux下安裝Go環境LinuxGo
- docker環境下安裝tensorflowDocker
- Windows環境下安裝LinuxWindowsLinux
- Docker 下安裝配置 lnmp 環境DockerLNMP
- linux環境下redis安裝LinuxRedis
- Linux環境下安裝NginxLinuxNginx
- Windows環境下安裝NexusWindows
- Mac環境下安裝配置RedisMacRedis
- windows下配置安裝YAF環境Windows
- windows環境下安裝seleniumWindows
- LINUX環境下安裝TIPTOPLinux
- ubuntu環境下安裝perf工具Ubuntu
- Linux下Java環境安裝LinuxJava
- linux或者CentOS環境下安裝.NET Core環境LinuxCentOS
- 彙編環境下的原始碼除錯原始碼除錯