您好,登錄后才能下訂單哦!
這篇文章主要講解了“源碼編譯怎么安裝PostgresSQL”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“源碼編譯怎么安裝PostgresSQL”吧!
yum -y install gcc*
yum -y install python python-devel
yum -y install perl-ExtUtils-Embed
yum -y install zlib-devel
yum -y install readline*
groupadd -g 1001 postgres #新增用戶組
useradd -g 1001 -u 1001 postgres #新增用戶
[root@pg11 ~]# id postgres
uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)
passwd postgres #為用戶設置密碼
mkdir -p /usr/local/pgsql11.5
chown -R postgres:postgres /usr/local/pgsql11.5/
mkdir -p /home/osdata/pgdata
chown -R postgres:postgres /home/osdata/
chmod 0700 /home/osdata/pgdata
export PATH=/usr/local/pgsql11.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql11.5/lib
export PGDATA=/home/osdata/pgdata
[root@pg11 pgsql11.5]# ll
total 19312
-rw-r–r--. 1 root root 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2
[root@pg11 pgsql11.5]#chown -R postgres:postgres /usr/local/pgsql11.5/
[root@pg11 pgsql11.5]# ll
total 19312
-rw-r–r--. 1 postgres postgres 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2
tar -xvf postgresql-11.5.tar.bz2
ln -sf /usr/local/pgsql11.5 /usr/local/pgsql
cd postgresql-11.5/
./configure --prefix=/usr/local/pgsql11.5 --with-perl --with-python
一次性把文檔及附加模塊全部進行編譯和安裝
gmake world
出現“PostgreSQL, contrib, and documentation successfully made. Ready to install.”說明編譯成功
gmake install-world
出現“PostgreSQL, contrib, and documentation installation complete.”說明安裝成功
查看版本
[postgres@pg11 postgresql-11.5]$ postgres --version
postgres (PostgreSQL) 11.5
initdb -D /home/osdata/pgdata/ -W
pg_ctl -D $PGDATA -l logfile start
[postgres@pg ~]$ ps -ef|grep postgres
postgres 56625 1 0 Mar04 ? 00:00:03 /usr/local/pgsql11.5/bin/postgres -D /home/osdata/pgdata
postgres 56627 56625 0 Mar04 ? 00:00:00 postgres: checkpointer
postgres 56628 56625 0 Mar04 ? 00:00:01 postgres: background writer
postgres 56629 56625 0 Mar04 ? 00:00:01 postgres: walwriter
postgres 56630 56625 0 Mar04 ? 00:00:05 postgres: autovacuum launcher
postgres 56631 56625 0 Mar04 ? 00:00:10 postgres: stats collector
postgres 56632 56625 0 Mar04 ? 00:00:00 postgres: logical replication launcher
root 76758 76699 0 11:01 pts/0 00:00:00 su - postgres
postgres 76759 76758 0 11:01 pts/0 00:00:00 -bash
postgres 76797 76759 0 11:01 pts/0 00:00:00 psql
postgres 76801 56625 0 11:01 ? 00:00:00 postgres: postgres test [local] idle
root 77192 77145 0 11:21 pts/1 00:00:00 su - postgres
postgres 77193 77192 0 11:21 pts/1 00:00:00 -bash
postgres 79582 77193 0 13:45 pts/1 00:00:00 ps -ef
postgres 79583 77193 0 13:45 pts/1 00:00:00 grep --color=auto postgres
查看數據庫狀態
[postgres@pg11 ~]$ pg_ctl -D /home/osdata/pgdata/ status
pg_ctl: server is running (PID: 23588)
/usr/local/pgsql11.5/bin/postgres “-D” “/home/osdata/pgdata”
1、配置腳本服務
在源碼包的contrib目錄中有linux、freebsd、macos適用的服務腳本
[root@pg11 ~]# cd /usr/local/pgsql/postgresql-11.5/contrib/start-scripts
[root@pg11 start-scripts]# ll
total 8
-rw-r–r--. 1 postgres postgres 1467 Aug 6 2019 freebsd
-rw-r–r--. 1 postgres postgres 3552 Aug 6 2019 linux
drwxrwxr-x. 2 postgres postgres 84 Aug 6 2019 macos
把名為linux的腳本拷貝到/etc/init.d目錄,并且重命名為postgresql11
[root@pg11 ~]# cp /usr/local/pgsql/postgresql-11.5/contrib/start-scripts/linux /etc/init.d/postgresql11
[root@pg11 init.d]# chmod +x postgresql-11
[root@pg11 init.d]# chkconfig postgresql-11 on
[root@pg11 init.d]# chkconfig --list |grep postgresql-11
postgresql-11 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[postgres@pg ~]$ psql
psql (11.5)
Type “help” for help.
postgres=#
感謝各位的閱讀,以上就是“源碼編譯怎么安裝PostgresSQL”的內容了,經過本文的學習后,相信大家對源碼編譯怎么安裝PostgresSQL這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。