PostgreSQL 9.1.2源碼編譯

來源:互聯網
上載者:User

剛要入門php,然後開始編譯環境,先從PostgreSQL開始...

-----------------------------------------------------------

| System | CentOS 5.7

----------------------------------------------------------- 

遇到的編譯postgresql的依賴問題,請轉文後補充.

yum -y install readline-devel

參考:

PostgreSQL 下載頁面 http://www.postgresql.org/ftp/source/

#mkdir /usr/local/src/postgresql && cd /usr/local/src/postgresql 

#wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.gz

解壓縮

#tar -zxvf postgresql-9.1.2.tar.gz

#su - -c "useradd -M postgres"

#chown -R postgres:postgres postgresql-9.1.2


配置編譯
#./configure --help

#./configure --prefix=/opt/pgsql--sysconfdir=/opt/pgsql/etc

#mkdir/opt/pgsql/data

#chown postgres:postgres /opt/pgsql/data

初始化

# su postgres

bash-3.2$ /opt/pgsql/bin/initdb -D /opt/pgsql/data

[plain]
  1. The files belonging to this database system will be owned by user "postgres".  
  2. This user must also own the server process.  
  3.   
  4. The database cluster will be initialized with locale en_US.UTF-8.  
  5. The default database encoding has accordingly been set to UTF8.  
  6. The default text search configuration will be set to "english".  
  7.   
  8. fixing permissions on existing directory /opt/pgsql/data ... ok  
  9. creating subdirectories ... ok  
  10. selecting default max_connections ... 100  
  11. selecting default shared_buffers ... 32MB  
  12. creating configuration files ... ok  
  13. creating template1 database in /opt/pgsql/data/base/1 ... ok  
  14. initializing pg_authid ... ok  
  15. initializing dependencies ... ok  
  16. creating system views ... ok  
  17. loading system objects' descriptions ... ok  
  18. creating collations ... ok  
  19. creating conversions ... ok  
  20. creating dictionaries ... ok  
  21. setting privileges on built-in objects ... ok  
  22. creating information schema ... ok  
  23. loading PL/pgSQL server-side language ... ok  
  24. vacuuming database template1 ... ok  
  25. copying template1 to template0 ... ok  
  26. copying template1 to postgres ... ok  
  27.   
  28. WARNING: enabling "trust" authentication for local connections  
  29. You can change this by editing pg_hba.conf or using the -A option the  
  30. next time you run initdb.  
  31.   
  32. Success. You can now start the database server using:  
  33.   
  34. /opt/pgsql/bin/postgres -D /opt/pgsql/data  
  35. or  
  36. /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start  

添加環境變數

#vi /etc/profile

PATH=/opt/pgsql/bin:$PATH

export PATH

#source /etc/profile

啟動:

#mkdir /opt/pgsql/logs/

#chown postgres:postgres /opt/pgsql/logs/

#su postgres

bash-3.2$ /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l /opt/pgsql/logs/pgsql.log start

設定啟動指令碼:

#su -c "cp /usr/local/src/postgresql/postgresql-9.1.2/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql-9.1.2"

#su -c "chmod a+x /etc/rc.d/init.d/postgresql-9.1.2"

#vi /etc/rc.d/init.d/postgresql-9.1.2

  • 1
  • 2
  • 3
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.