ubuntu12.04下源碼安裝PostgreSQL9.2.3

來源:互聯網
上載者:User

1.下載源碼包: http://ftp.postgresql.org/pub/source/v9.2.3/postgresql-9.2.3.tar.bz2

2.安裝依賴:apt-get install build-essensial gcc make libreadline6 libreadline6-dev (提醒缺少什麼就安裝什麼)

3.開始編譯:

    (1)解壓源碼包到 /home/linux/postgresql-9.2.3 

    (2)./configure --prefix=/要安裝postgresql到哪個目錄

    (3)make(成功提示:All of PostgreSQL successfully made. Ready to install.)

    (4)su(切換到root使用者)

    (5)make install(成功提示:PostgreSQL installation complete.)

    (6)adduser postgres

    (7)建立資料目錄:mkdir /你安裝postgresql的目錄/data

    (8)修改擁有者:chown postgres /你安裝postgresql的目錄/data

    (9)切換到postgres使用者:su - postgres

    (10)初始化資料目錄:/你安裝postgresql的目錄/bin/initdb -D /你安裝postgresql的目錄/data(成功提示:Success. You can now start the database server using:

 /opt/postgresql-9.2/bin/postgres -D /opt/postgresql-9.2/data
or
    /opt/postgresql-9.2/bin/pg_ctl -D /opt/postgresql-9.2/data -l logfile start)

    (11)啟動postgresql服務:/你安裝postgresql的目錄/bin/postgres -D /你安裝postgresql的目錄/data >logfile 2>&1 &

    (12)建立資料庫:/你安裝postgresql的目錄/bin/createdb test

    (13)串連到資料庫:/你安裝postgresql的目錄/bin/psql test

                如果成功,你將會看到:(

             psql (9.2.3)
            Type "help" for help.)

聯繫我們

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