1. 程式人生 > >在unbuntu下安裝postgresql 10.4

在unbuntu下安裝postgresql 10.4

./configure --prefix=/home/postgres/pgsql  --enable-debug

開啟方式不對應該是缺少libreadline,重新找一下libreadline的dev包

安裝

報錯缺少zlib library

使用apt安裝apt-get install zlib1g-dev

./configure --prefix=/home/postgres/pgsql  --enable-debug

configure成功

make world

make install-world

初始化資料目錄

su postgres -c "/home/postgres/pgsql/bin/initdb -E UTF8 --locale=C  /mnt/pgdata/"

修改相關配置檔案,然後啟動資料庫。

postgresql.conf

listen_addresses = '*'

log_destination = 'csvlog' 

log_directory = '/var/log/pg_log' 

log_filename = 'postgresql-%Y-%m-%d_%H%M%S.csv'

啟動資料庫服務

su postgres -c "/home/postgres/pgsql/bin/postmaster -D /mnt/pgdata/" &

此時資料庫只允許本地連線,並沒有設定密碼。

使用psql連線資料後修改密碼,然後修改pg_hba檔案,重啟資料庫服務。