centos6.5安装Postgresql
1.下载postgresql: wget -c http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.gz2.解压缩: tar -zxvf postgresql-9.3.4.tar.gz
3.查看编译选项: ./configure --help
4.编译选项:
1.)默认参数:./configure
2.)加参数: ./configure
--prefix=/opt/postgresql934 --with-pgport=5321
--with-perl --with-tcl --whith-python --with-openssl
--with-pan --without-ldap --with-libxml --with-libxslt -enable-thread-safety
(数据包大小:)--with-wal-blocksize=16 --with-blocksize=16
(调试状态:)--enable-dtrace --enable-debug
5.出现错误:
1.)readline library not found。
检查是否安装:rpm -qa | grep readline。
搜索相关包:yum search readline
安装 readline-devel:yum -y install -y readline-devel
2.)zlib library not found。
步骤跟上面相同:yuminstall zlib-devel
6.编译所有:gmake world
7.安装所有:gmake install-world
8.添加用户:useradd postgres
9.修改用户配置文件: vi ~/.bash_profile
10.添加配置文件:
export PGPORT=5432
export PGDATA=/var/pgdata/pg_root
export LANG=en_US.utf8
export PGHOME=/opt/postgresql934
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATE=`date +"%Y%m%d%H%M"`
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGHOST=$PGDATA
alias rm='rm -i'
alias ll='ls -lh'
export PGDATABASE=digoal
11.切换用户:su -postgres
12.查看安装目录:which postgres
13.查看版本:psql -V
14.
15.mkdir -p /var/pgdata/pg_root
16.chown -R postgres:postgres /var/pgdata/pg_root
17.初始化数据库:initdb -D $PGDATA -E UTF8 --locale=C -U postgres -W
18.修改Linux内核相关参数:vi /etc/sysctl.conf
kernel.shmmax = 68719476736 (默认)
kernel.shmall = 4294967296 (默认)
kernel.shmmni = 4096
kernel.sem = 50100 64128000 50100 1280
fs.file-max = 7672460
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
19.vi /etc/security/limits.conf
* soft nofile131072
* hard nofile131072
* soft nproc 131072
* hard nproc 131072
* soft core unlimited
* hard core unlimited
* soft memlock 50000000
* hard memlock 50000000
20.防火墙
vi /etc/sysconfig/iptables
service iptables restart
iptables -L -v -n
21.su pguser
22.cd $PGDATA
23.vi pg_hda.conf
host all all 0.0.0.0/0 md5
24.vi postgresql.conf
25.启动:pg_ctl start
psql -h 127.0.0.1 -p 5432 -U postgres postgres
摘自:maltel博客http://blog.csdn.net/maltel/article/details/24204923
页:
[1]