postgresql 在linux上的源碼安裝

來源:互聯網
上載者:User

標籤:

下載源碼並解壓
[[email protected] ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2[[email protected] ~]# tar -xjvf postgresql-9.4.0.tar.bz2 [[email protected] ~]# 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...
繼續
[[email protected] postgresql-9.4.0]# ./configure[[email protected] postgresql-9.4.0]# make……All of PostgreSQL successfully made. Ready to install.[[email protected] postgresql-9.4.0]# make install……PostgreSQL installation complete.
添加使用者
[[email protected] postgresql-9.4.0]# useradd postgres[[email protected] 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目標檔案夾
[[email protected] postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p[[email protected] postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
環境變數設定
[[email protected] ~]$ vi .bash_profile …# postgresPGDATA=/var/lib/pgsql/dataPATH=/usr/local/pgsql/bin:$PATHexport PGDATA PATH[[email protected] ~]$ . .bash_profile 
建立database cluster
loading PL/pgSQL server-side language ... okThe 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 "en_US.UTF-8".The default database encoding has accordingly been set to "UTF8".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /var/lib/pgsql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okcreating template1 database in /var/lib/pgsql/data/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views ... okloading system objects‘ descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... oksetting privileges on built-in objects ... okcreating information schema ... okloading PL/pgSQL server-side language ... okvacuuming database template1 ... okcopying template1 to template0 ... okcopying template1 to postgres ... oksyncing data to disk ... okWARNING: 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.