ubuntu14.04 LTS 源码编译安装postgreSQL
生活随笔
收集整理的這篇文章主要介紹了
ubuntu14.04 LTS 源码编译安装postgreSQL
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、環境
ubuntu14.04
postgresql-9.4.3
二、安裝
1、依賴包安裝
sudo apt-get install libperl-dev python-dev libreadline-gplv2-dev zlib1g-dev2、下載postgreSQL,編譯安裝
wger https://ftp.postgresql.org/pub/source/v9.4.3/postgresql-9.4.3.tar.bz2 tar -jxvf postgresql-9.4.3.tar.bz2 -C /usr/local/src/ ./configure --prefix=/usr/local/postgresql-9.4.3 --with-perl --with-python sudo make && sudo make install cd /usr/local/ sudo ln -fs postgresql-9.4.3/ pgsql在編譯安裝路徑是加上了版本號,加上版本號的原因是為了以后升級方便;如果postgreSQL9.4.4發布了,自需要在編譯postgreSQL9.4.4后,將現有的數據庫停掉,然后把鏈接/usr/local/pgsql指向/usr/local/postgresql-9.4.4。
3、配置環境變量
安裝完成后,配置postgresql可執行文件的路徑和共享庫的路徑,數據庫目錄
export PATH=/usr/local/pgsql/bin:$PATH export LD_LIBRARY_PATH=/usr/local/pgsql/lib如果想以上配置對所有用戶都生效,可以把上面的內容添加到/etc/profile文件中。如果想以上的配置對當前用戶生效,在linux下可以把以上內容添加到.bashrc文件中,在其他的unix下可以添加到.profile文件中。
4、創建數據庫簇
sudo mkdir -p /data/pgdatasudo mkdir -p /data/pglog/postgresql.log
export PGDATA=/data/pgdata #數據目錄環境變量
adduser postgres
sudo chown -R /data initdb -D /data/pgdata
顯示如下:
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.UT F-8" The default text search configuration will be set to "simple".Data page checksums are disabled.fixing permissions on existing directory /data/pgdata ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok creating template1 database in /data/pgdata/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok syncing data to disk ... okWARNING: 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:postgres -D /data/pgdata/ orpg_ctl -D /data/pgdata/ -l logfile start5、 安裝contrib目錄下的工具
cd postgresql-9.4.3/contrib make sudo make install6、啟動和停止數據庫
pg_ctl start -D /data/pgdata -l /data/pglog/postgresql.log pg_ctl stop -D /dtat/pgdata? 7、測試
netstat -nultp | greptcp ? ? ? ?0 ? ? ?0 192.168.45.127:5432 ? ? 0.0.0.0:* ? ? ? ? ? ? ? LISTEN ? ? ?16015/postgres
?
轉載于:https://www.cnblogs.com/chrisDuan/p/4571195.html
總結
以上是生活随笔為你收集整理的ubuntu14.04 LTS 源码编译安装postgreSQL的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 网易相册163相册照片批量下载
- 下一篇: mysql之对视图的操作