分类: LINUX
2014-09-03 15:45:19
postgresql for linux安装
下载目录
#tar -zxf postgresql-9.3.5.tar.gz
#cd postgresql-9.3.5
# ./configure --prefix=path
#make && make install
#useradd postgres
#chown -R postgres:postgres(postgresql安装路径)
----------------------------------------------------
编辑此文件修改端口与监听的ip(修改着两个值)
#vi /usr/local/pgsql/data/postgresql.conf
listen_addresses
port = 5432
-----------------------------------------------------
#su - postgres
$ mkdir -p /usr/local/pgsql/data
$ initdb -E UNICODE -D /usr/local/pgsql/data
#cp postgresql-9.3.5/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
#chmod u+x /etc/rc.d/init.d/postgresql
#chkconfig --add postgresql
-----------------------------------------------------
对应的要找到
/etc/rc.d/init.d/postgresql
这里面的三个值对应的路径需要配置环境变量
PG_DATA
PGLOG
prefix
注意这三个值要对应好路径
------------------------------------------------------------
配置环境变量
#su - postgres
#vi .bash_profile
PG_DATA=/usr/local/pgsql/data
PBIN=/usr/local/pgsql
PATH=$PATH:$PBIN/bin
export PATH
---------------------------------------------
#service postgresql start