当前位置:网站首页>Centos7 source code compile and install postgresql 11.7
Centos7 source code compile and install postgresql 11.7
2022-08-05 22:02:00 【Better to play code KK】
Centos7源码编译安装postgresql 11.7
1.安装依赖
yum install gcc bison gcc-c++ readline readline-devel zlib zlib-devel perl perl-devel python-devel openssl-devel gmake
2.添加用户及组
groupadd postgres
useradd -g postgres postgres
echo "postgres" |passwd --stdin postgres
3.创建PG目录
mkdir -p /usr/local/postgersql_11.0 && chown -R postgres:postgres /usr/local/postgersql_11.0
mkdir -p /data/pg11/{
pg_root,pgxlog,archive,scripts,soft} && chown -R postgres:postgres /data/pg11/
说明:All the steps below are usedpostgres用户操作
4.下载及安装
[[email protected]hadoop102:/home/postgres]$ wget https://mirrors.tuna.tsinghua.edu.cn/postgresql/source/v11.7/postgresql-11.7.tar.gz --no-check-certificate
[[email protected]:/home/postgres]$ tar -zxf postgresql-11.7.tar.gz
[[email protected]:/home/postgres]$ cd postgresql-11.7
[[email protected]:/home/postgres]$ ./configure --prefix=/usr/local/postgersql_11.0
#gmake wordwill compile allextension扩展插件
[[email protected]:/home/postgres]$ gmake world && gmake install-world
5.初始化
[[email protected]:/home/postgres]$ /usr/local/postgersql_11.0/bin/initdb -D /data/pg11/pg_root
/usr/local/postgersql_11.0/bin/initdb -D /data/pg11/pg_root -E UTF8 --lc-collate=C --lc-ctype=en_US.utf8 -U postgres -X /data/pg11/pgxlog
6.Start and shut down instances
[[email protected]:/home/postgres]$nohup /usr/local/postgersql_11.0/bin/pg_ctl start -D /data/pg11/pg_root -l /data/pg11/pg_root/pgsql.log & #启动实例
/usr/local/postgersql_11.0/bin/pg_ctl status -D /data/pg11/pg_root #检查状态
/usr/local/postgersql_11.0/bin/pg_ctl stop -D /data/pg11/pg_root -m fast -W #关闭实例
#smart : Wait for the active transaction to commit to the end,And wait for the client to actively disconnect all connections before closing
#fast: 回滚所有活动的事务,And close after forcibly disconnecting the client connection
#immediate : Terminate all server processes,The recovery state is entered first the next time the database is started
7.设置密码
/usr/local/postgersql_11.0/bin/psql -p 5432
sql> \password
8.配置外部访问
systemctl stop firewalld #关闭操作系统防火墙
vim /data/pg11/pg_root/pg_hba.conf #修改 pg_hba.conf
0.0.0.0.0/24

9.环境变量设置
vi ~/.bash_profile
export LANG=en_US.UTF8
export PS1="[`whoami`@`hostname`:"'$PWD]$'
export PGHOME=/usr/local/postgersql_11.0
export PGDATA=/data/pg11/pg_root
export PATH=$PATH:$PGHOME/bin
边栏推荐
猜你喜欢
随机推荐
【数据集转换】VOC数据集转COCO数据集·代码实现+操作步骤
《机器学习实战》第3章—隐形眼镜类型(Jupyter版决策树)
ZeroMQ替代ros
【实战系列】16位唯一id设计方案
龙蜥社区首推“分层分类”顶设 发展以云为终态的开源产业创新生态
案例分析|爆款品牌完美日记的KOL投放策略
Euler's Theorem and Fermat's Little Theorem
Shell编程之循环语句与函数
龙蜥社区第十次运营委员会议顺利召开!
glog使用
SciencePlot-Science Plot
对话框管理器第五章:将非模态对话框转为模态
docker安装postgresql数据库
什么是 MySQL?SQL 数据库初学者教程和使用指南
ROS2机器人笔记220805-重要备忘录-
我们公司是初次使用OKR,在落地时要特别注意哪些事情?
ESP8266-Arduino编程实例-金属触摸传感器驱动
[LeetCode] 39, combined sum
docker install postgresql database
mysql- 忘记root密码怎么办?mysql密码破解









