源碼編譯怎么安裝PostgresSQL-創(chuàng)新互聯(lián)

這篇文章主要講解了“源碼編譯怎么安裝PostgresSQL”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“源碼編譯怎么安裝PostgresSQL”吧!

成都創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都做網(wǎng)站、成都網(wǎng)站制作、京口網(wǎng)絡(luò)推廣、微信小程序定制開發(fā)、京口網(wǎng)絡(luò)營銷、京口企業(yè)策劃、京口品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供京口建站搭建服務(wù),24小時(shí)服務(wù)熱線:18980820575,官方網(wǎng)址:muchs.cn

一、環(huán)境準(zhǔn)備

1、安裝依賴包

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*

2、創(chuàng)建用戶組、目錄

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 #為用戶設(shè)置密碼

3、創(chuàng)建目錄

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

4、修改環(huán)境變量(postgres用戶)

export PATH=/usr/local/pgsql11.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql11.5/lib
export PGDATA=/home/osdata/pgdata

5、上傳軟件包,并且解壓縮(root)

[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

6、生成鏈接

ln -sf /usr/local/pgsql11.5 /usr/local/pgsql

二、安裝postgresql

1、編譯

cd postgresql-11.5/
./configure --prefix=/usr/local/pgsql11.5 --with-perl --with-python

2、安裝

一次性把文檔及附加模塊全部進(jìn)行編譯和安裝
gmake world
出現(xiàn)“PostgreSQL, contrib, and documentation successfully made. Ready to install.”說明編譯成功

gmake install-world
出現(xiàn)“PostgreSQL, contrib, and documentation installation complete.”說明安裝成功

查看版本
[postgres@pg11 postgresql-11.5]$ postgres --version
postgres (PostgreSQL) 11.5

3、初始化數(shù)據(jù)庫

initdb -D /home/osdata/pgdata/ -W

4、啟動(dòng)數(shù)據(jù)庫

pg_ctl -D $PGDATA -l logfile start

5、查看實(shí)例進(jìn)程

[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

查看數(shù)據(jù)庫狀態(tài)
[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”

6、設(shè)置開機(jī)自啟動(dòng)

1、配置腳本服務(wù)
在源碼包的contrib目錄中有l(wèi)inux、freebsd、macos適用的服務(wù)腳本
[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

7、登錄數(shù)據(jù)庫

[postgres@pg ~]$ psql
psql (11.5)
Type “help” for help.

postgres=#

感謝各位的閱讀,以上就是“源碼編譯怎么安裝PostgresSQL”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)源碼編譯怎么安裝PostgresSQL這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

本文題目:源碼編譯怎么安裝PostgresSQL-創(chuàng)新互聯(lián)
URL地址:http://muchs.cn/article8/degjip.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、App開發(fā)、域名注冊(cè)、網(wǎng)站維護(hù)網(wǎng)站營銷、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)