postgresql 在linux上的源碼安裝

來源:互聯網
上載者:User

標籤:

http://my.oschina.net/hippora/blog/375292下載源碼並解壓
[root@fnddb ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2[root@fnddb ~]# tar -xjvf postgresql-9.4.0.tar.bz2 [root@fnddb ~]# cd postgresql-9.4.0
開始編譯安裝
[[email protected] postgresql-9.4.0]# ./configure ……checking for library containing shmget... none requiredchecking for library containing readline... noconfigure: error: readline library not foundIf you have readline already installed, see config.log for details on thefailure.  It is possible the compiler isn‘t looking in the proper directory.Use --without-readline to disable readline support.
按照錯誤提示依次安裝依賴包
[[email protected] postgresql-9.4.0]# yum install readline-devel[[email protected] postgresql-9.4.0]# yum install zlib-devel...
繼續
[root@fnddb postgresql-9.4.0]# ./configure[root@fnddb postgresql-9.4.0]# make……All of PostgreSQL successfully made. Ready to install.[root@fnddb postgresql-9.4.0]# make install……PostgreSQL installation complete.
添加使用者
[root@fnddb postgresql-9.4.0]# useradd postgres[root@fnddb postgresql-9.4.0]# passwd postgresChanging password for user postgres.New password: BAD PASSWORD: it is based on a dictionary wordRetype new password: passwd: all authentication tokens updated successfully.
建立好database cluster目標檔案夾
[root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
環境變數設定
[root@fnddb postgresql-9.4.0]# su - postgres[postgres@fnddb ~]$ vi .bash_profile …# postgresPGDATA=/var/lib/pgsql/dataPATH=/usr/local/pgsql/bin:$PATHexport PGDATA PATH[postgres@fnddb ~]$ . .bash_profile 
建立database cluster
[[email protected] ~]$ pg_ctl initdb......WARNING: enabling "trust" authentication for local connectionsYou 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:    /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/dataor    /usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
啟動資料庫執行個體

設定好PGDATA環境變數後,可以不帶-D選項

[[email protected] ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.logserver starting
關閉資料庫執行個體
[[email protected] ~]$ pg_ctl stopwaiting for server to shut down.... doneserver stopped
開機自動啟動設定
[[email protected] postgresql-9.4.0]# vi /etc/rc.local…su - c ‘/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log‘

postgresql 在linux上的源碼安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.