網頁

2012年4月22日 星期日

安裝postgresql on centos

最近需要使用免費資料庫:psotgres,做點個筆記,免得忘了


Download site: http://yum.postgresql.org/repopackages.php
wget http://yum.postgresql.org/9.1/redhat/rhel-4-i386/pgdg-centos91-9.1-4.noarch.rpm
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm

yum install postgresql91 postgresql91-devel postgresql91-server postgresql91-libs postgresql91-jdbc postgresql91-contrib

若沒有新增postgres這個user,自行加入
useradd postgres
passwd postgres

vim /etc/passwd
找到postgres,將其家目錄改成/var/lib/pgsql/9.1
/* 要保持postgres可以登入,但不能登入至其他的目錄,原因是stop時,會用到postgres這使用者 */

service postgresql-9.1 initdb
service postgresql-9.1 start

su postgres
psql
CREATE USER postgres WITH PASSWORD '密碼';
或alter user postgres with password '密碼' ; (一定要加上; 不然無法執行)
\q 離開psql command畫面

exit 換回root


參考網站
http://davidghedini.blogspot.com/2010/10/install-postgresql-9-on-centos.html

沒有留言:

張貼留言