CentOS原始碼安裝PostgreSQL資料庫

2021-10-04 20:08:39 字數 1872 閱讀 1781

yum install -y bzip2

yum install -y readline-devel

yum install -y zlib-devel

yum install -y gcc

yum install -y wget

或者

yum install -y bzip2 readline-devel zlib-devel gcc wget
yum list installed   #列出已安裝的軟體包
增加新使用者,系統提示要給定新使用者密碼

adduser postgres

#檢視linux系統的使用者

cat /etc/passwd

#修改postgres使用者的密碼

passwd postgres

wget
tar xjvf postgresql*.bz2       #解壓至乙個目錄
cd potgresql-12.2

./configure --prefix=/opt/pgsql/12.2

此處我的安裝路徑選擇的是:/opt/pgsql/12.2 ,實際安裝中可根據自己的需要選擇安裝路徑。

make world
make install-world
mkdir /opt/pgsql/12.2/data   #建立資料庫目錄

chown -r postgres:postgres /opt/pgsql/

切換到 postgres 使用者

su - postgres
初始化資料庫

/opt/pgsql/12.2/bin/initdb -d /opt/pgsql/12.2/data
啟動資料庫

/opt/pgsql/12.2/bin/pg_ctl -d /opt/pgsql/12.2/data/ -l logfile start
建立資料庫,假定資料庫名為gerericdb

/opt/pgsql/12.2/bin/createdb genericdb
進入資料庫內部

/opt/pgsql/12.2/bin/psql genericdb
為了讓我們使用postgresql資料庫更加方便,可以在postgres使用者下新增環境變數,這樣我們進入資料庫可以更方便。

將以下兩行新增至postgres 使用者的環境變數檔案 .bash_profile 並生效。

su - postgres

cdls -a #列出當前目錄下的所有檔案,包括隱藏檔案

vi .bash_profile

export ld_lbrary_path=/opt/pgsql/12.2/lib:$ld_library_path

export pgdata=/opt/pgsql/12.2/data

export path=/opt/pgsql/12.2/bin:$path

環境變數檔案生效方法:

. .bash_profile
或者

source .bash_profile
環境變數設定成功,我們在 postgres 使用者下,輸入 psql 即可直接進入資料庫。

CentOS原始碼安裝PHP

先安裝需要的庫 yum y install libxml2 yum y install libxml2 devel yum y install gd yum y install gd devel yum y install curl curl devel yum y install libjpeg ...

CentOS 原始碼安裝PHP

2 解壓縮並且進入解壓縮後的檔案目錄下 4 make make install 遇到問題 1 configure error xml2 config not found.please check your libxml2 installation 參看 安裝php時的報錯 checking libx...

Centos 原始碼安裝apache

安裝apache前準備 1 檢查該環境中是否已經存在httpd服務的配置檔案,預設儲存路徑 etc httpd httpd.conf 這是centos預裝的apache的乙個ent版本,一般我們安裝源 版的apache 如果已經存在 etc httpd httpd.conf,請先解除安裝或者關閉ce...