91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么用源碼安裝PostgreSQL

發布時間:2021-08-20 03:14:45 來源:億速云 閱讀:142 作者:chen 欄目:數據庫

本篇內容介紹了“怎么用源碼安裝PostgreSQL”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

數據庫版本:

PostgreSQL 9.6.3

系統版本:

CentOS release 6.6 (Final)

下載軟件(Download software):

[root@Darren2 tools]# wget https://ftp.postgresql.org/pub/source/v9.6.3/postgresql-9.6.3.tar.gz

查看是否已經安裝(Check is not instatll):

[root@Darren2 tools]# ps -ef |grep pgsql

root      28590  18695  0 20:24 pts/0    00:00:00 grep pgsql

[postgres@sht-sgmhadoopdn-02 ~]$ rpm -qa |grep postgres

postgresql-libs-8.4.18-1.el6_4.x86_64

解壓(Extract software):

[root@Darren2 tools]# tar xf postgresql-9.6.3.tar.gz

編譯和安裝(Complie):

[root@Darren2 tools]# cd postgresql-9.6.3

[root@Darren2 postgresql-9.6.3]# ./configure --prefix=/usr/local/pgsql

編譯所有能編譯的東西,包括文檔(HTML和手冊頁)以及附加模塊(contrib):

[root@Darren2 postgresql-9.6.3]# make world && make install-world

......

make[2]: Leaving directory `/home/tools/postgresql-9.6.3/contrib/vacuumlo'

make[1]: Leaving directory `/home/tools/postgresql-9.6.3/contrib'

PostgreSQL, contrib, and documentation installation complete.

創建用組和用戶(Create group and user)

[root@Darren2 ~]# groupadd -g 101 dba

[root@Darren2 ~]# cat /etc/group|grep dba

dba:x:101:

[root@Darren2 ~]# useradd -u 516 -g dba -G root -d /usr/local/pgsql  postgres

[root@Darren2 ~]# id postgres

uid=516(postgres) gid=101(dba) groups=101(dba),0(root)

-u UID

-g 初始用戶組

-G次要用戶組

-m 創建用戶家目錄(系統用戶默認不創建家目錄)

-M 不創建用戶家目錄(普通用戶默認創建家目錄)

-s shell 默認是/bin/bash

-d指定家目錄

[root@Darren2 home]# groups postgres

postgres : dba root

配置postgres密碼

[root@Darren2 home]# passwd postgres

[root@Darren2 skel]# ls -al /etc/skel/

total 20

drwxr-xr-x.  2 root root 4096 Dec 20  2016 .

drwxr-xr-x. 84 root root 4096 Jul 11 22:27 ..

-rw-r--r--.  1 root root   18 Jul 18  2013 .bash_logout

-rw-r--r--.  1 root root  176 Jul 18  2013 .bash_profile

-rw-r--r--.  1 root root  124 Jul 18  2013 .bashrc

[root@Darren2 skel]# cp /etc/skel/.* /usr/local/pgsql/

創建數據目錄(Create data folder)

[root@Darren2 ~]# mkdir -p /usr/local/pgsql/data

配置.bash_profile(Configure .bash_profile)

[root@Darren2 pgsql]# cat /usr/local/pgsql/.bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

    . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PGHOME=/usr/local/pgsql

export PGDATA=/usr/local/pgsql/data

export PATH=$PATH:/usr/local/pgsql/bin

set umask to 022

umask 022

PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1

修改文件權限和所有者(Chmod and chown)

[root@Darren2 pgsql]# chmod -R 755 /usr/local/pgsql

[root@Darren2 pgsql]# chown -R postgres:dba /usr/local/pgsql

[root@Darren2 pgsql]# chmod -R 700 /usr/local/pgsql/data

配置postgresql服務啟動和設置自啟動(Configure postgresql service and boot auto start) --這步可不做

[root@Darren2 start-scripts]# cp /home/tools/postgresql-9.6.3/contrib/start-scripts/linux /etc/init.d/postgresql

[root@Darren2 start-scripts]# chmod +x /etc/init.d/postgresql

[root@Darren2 start-scripts]# chkconfig --list |grep postgresql

[root@Darren2 start-scripts]# chkconfig --add postgresql

[root@Darren2 start-scripts]# chkconfig --list |grep postgresql

postgresql         0:off    1:off    2:on    3:on    4:on    5:on    6:off

初始化數據和啟動(Initialize database and start database)

[root@Darren2 start-scripts]# su - postgres

[postgres@Darren2 start-scripts]$ cd

[postgres@Darren2 ~]$ pwd

/usr/local/pgsql

[postgres@Darren2 ~]$ . .bash_profile

#初始化生成數據文件

Darren2:postgres:/usr/local/pgsql:>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

#啟動數據庫

Darren2:postgres:/usr/local/pgsql:>pg_ctl start

server starting

Darren2:postgres:/usr/local/pgsql:>LOG:  database system was shut down at 2017-07-12 00:49:17 CST

LOG:  MultiXact member wraparound protections are now enabled

LOG:  database system is ready to accept connections

LOG:  autovacuum launcher started

創建用戶和數據庫(Create user and database)

psql

psql (9.6.3)

Type "help" for help.

postgres=# create user admin password'admin' login;

CREATE ROLE

postgres=# create database testdb with owner=admin;

CREATE DATABASE

Darren2:postgres:/usr/local/pgsql:>pg_ctl status

pg_ctl: server is running (PID: 51498)

/usr/local/pgsql/bin/postgres

安裝過程中常見報錯

編譯時候報錯:

[root@Darren2 postgresql-9.6.3]# ./configure --prefix=/usr/local/pgsql --without-zlib

......

configure: error: readline library not found  --提示找不到readline

If you have readline already installed, see config.log for details on the

failure.  It is possible the compiler isn't looking in the proper directory.

Use --without-readline to disable readline support.

查看系統已經安裝readline:

[root@Darren2 postgresql-9.6.3]# rpm -qa |grep readline

compat-readline5-5.2-17.1.el6.x86_64

readline-6.0-4.el6.x86_64

通過yum search可以發現沒有安裝readline-devel:

[root@Darren2 postgresql-9.6.3]# yum search readline

......

readline-devel.i686 : Files needed to develop programs which use the readline library

readline-devel.x86_64 : Files needed to develop programs which use the readline library

......

通過yum安裝之后,在編譯即可通過:

[root@Darren2 postgresql-9.6.3]# yum install -y readline-devel

    

“怎么用源碼安裝PostgreSQL”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

凤山县| 金堂县| 汾阳市| 密云县| 苗栗县| 新昌县| 昌都县| 普兰县| 峡江县| 凤凰县| 类乌齐县| 湟源县| 井陉县| 彭州市| 文化| 呼伦贝尔市| 治多县| 西城区| 剑河县| 英吉沙县| 青田县| 香格里拉县| 故城县| 大新县| 丹阳市| 搜索| 玉山县| 乌兰县| 阳城县| 民县| 合川市| 尚义县| 灵宝市| 陆良县| 上犹县| 雷州市| 噶尔县| 长治县| 阳泉市| 闽侯县| 武川县|