libo1987630 发表于 2010-11-10 11:03

CentOS 5.5 下部署 PostgreSQL 9.0.1 全过程

首先,去PostgreSQL官网下载最新版本。笔者使用Linux x86_64源码编译安装包:postgresql-9.0.1.tar.bz2
   安装过程如下:
                  ----------------------------- Head -------------------------------------
mkdir -p /data/setupfiles/ && cd /data/setupfiles/
wget http://wwwmaster.postgresql.org/redir/161/f/source/v9.0.1/postgresql-9.0.1.tar.bz2
tar jxvf ./postgresql-9.0.1.tar.bz2
cd ./postgresql-9.0.1
mkdir -p /data/programfiles/postgresql-9.0.1/data
ln -s /data/programfiles/postgresql-9.0.1 /usr/local/postgresql
groupadd pgsql
useradd pgsql -g pgsql
./configure --prefix=/usr/local/postgresql --enable-profiling
make
make install
cd /usr/local/postgresql
chown -R pgsql .
chown -R pgsql data
chown -R pgsql data/.
su - pgsql
/usr/local/postgresql/bin/initdb --encoding=utf8 -D /usr/local/postgresql/data
cp /data/setupfiles/postgresql-9.0.1/contrib/start-scripts/linux /etc/init.d/postgresql
chmod +x /etc/init.d/postgresql
# 注意修改/etc/init.d/postgresql中的安装路径和用户
service postgresql start
ps aux | grep postgre
----------------------------- End -------------------------------------
pgsql    66698 4.8 0.2 114552 8508 ?      S    18:03   0:00 /usr/local/postgresql/bin/postmaster -D /usr/local/postgresql/data
pgsql    66699 0.0 0.1 114552 5436 ?      Ss   18:03   0:00 postgres: writer process                                          
pgsql    66600 0.0 0.1 114552 5396 ?      Ss   18:03   0:00 postgres: wal writer process                                    
pgsql    66601 0.0 0.1 115376 6272 ?      Ss   18:03   0:00 postgres: autovacuum launcher process                           
pgsql    66602 0.0 0.1 77464 5300 ?      Ss   18:03   0:00 postgres: stats collector process                        
---------------------------------------------------------------------      

/usr/local/postgresql/bin/createuser -d -a -P root

/usr/local/postgresql/bin/createdb test_db

/usr/local/postgresql/bin/psql -U root -W test_db

监控可使用ptop、pg_top:
                           
                           

renxiao2003 发表于 2010-11-10 12:00

写得不错啊。

wzengzhi 发表于 2010-11-17 13:50

好东西,收藏了

chinafenghao 发表于 2012-05-25 11:34

简单,直接。却是是好文章。

ulovko 发表于 2012-05-25 21:45

写的很详细 很好!:lol
页: [1]
查看完整版本: CentOS 5.5 下部署 PostgreSQL 9.0.1 全过程