Linux下PostgerSQL11安装(CentOS7)
1.创建postgres用户,并创建安装目录
useradd postgres
mkdir -p /opt/pgsql/data
chown -R postgres:postgres /opt/pgsql
2.解压/安装依赖包/安装postgresql数据库
tar -zxvf postgresql-11.1.tar.gz
yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake gcc* readline-devel --安装依赖包
./configure --prefix=/opt/pgsql --without-readline
make
make install
3.配置环境变量
tail -1 /etc/profile
PATH=$PATH:/opt/pgsql/bin
source /etc/profile --刷新环境变量,立即生效
echo $PATH --输出环境变量,查看是否设置成功
4.初始化,启动,连接数据库
mkdir data ----/opt/pgsql下
chown postgres:p