首页 > 数据库技术 > 详细

postgresql 11.6 源码安装

时间:2020-01-13 16:11:41      阅读:224      评论:0      收藏:0      [点我收藏+]

1.下载源码介质
下载地址:
源码下载地址: https://www.postgresql.org/ftp/source/
二进制下载地址:https://www.enterprisedb.com/download-postgresql-binaries

2.安装依赖包
yum install readline
yum install gcc
yum -y install -y readline-devel
yum install zlib-devel


3.二进制安装
[root@localhost soft]#mkdir -p /opt/postgresql-11.6
[root@localhost soft]#./configure --prefix=/opt/postgresql-11.6
[root@localhost soft]#make
[root@localhost soft]#make install

4.创建相应的用户
[root@localhost opt]# groupadd postgres
[root@localhost opt]# useradd -g postgres postgres


5.创建数据及日志目录,并做相应授权
[root@localhost soft]#mkdir -p /opt/postgresql-11.6/{data,log}
[root@localhost soft]#chown -R postgres:postgres /opt/postgresql-11.6


6.初始化数据库
#su - postgres
[postgres@localhost bin]$ cd /opt/postgresql-11.6/bin
[postgres@localhost bin]$ ./initdb -D /opt/postgresql-11.6/data/

7.启动数据库
[postgres@localhost bin]$ cd /opt/postgresql-11.6/bin
[postgres@localhost bin]$./pg_ctl -D /opt/postgresql-11.6/data/ -l logfile start

8.登陆使用
[postgres@localhost bin]$cd /opt/postgresql-11.6/bin
[postgres@localhost bin]$ ./psql
psql (11.6)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 
9.设置环境变量
[postgres@localhost ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/opt/postgresql-11.6/bin

export PATH

postgresql 11.6 源码安装

原文:https://www.cnblogs.com/hxlasky/p/12187660.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!