postgresql数据库安装

postgresql二进制安装

文档参考自中文社区:http://www.postgres.cn/docs/14/index.html

二进制安装是官方推荐的安装方法,仅建议PostgreSQL的开发或扩展人员从源代码构建

安装14,后续版本方法一样

yum在线安装

https://www.postgresql.org/download/

选择对应的系统、软件版本和架构

# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
sudo yum install -y postgresql14-server

# Optionally initialize the database and enable automatic start:
# 可以在初始化时自定义相关设置
# 在初始化前更改/usr/lib/systemd/system/postgresql-14.service文件中的配置
# 例如更改数据文件目录,只修改Environment=PGDATA=/var/lib/pgsql/14/data/
# 然后在/usr/pgsql-14/bin/postgresql-14-setup initdb
# 重载systemctl daemon-reload后,重启服务
# 
# 或者已经初始化了,就创建对应目录(postgres对应权限),使用/usr/pgsql-14/bin/initdb -D /home/data/pg14/data重新初始化
# 让后在更改路径,重载systemctl daemon-reload后,重启服务
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable postgresql-14
sudo systemctl start postgresql-14

rpm包离线安装

源码安装

posted @   EverEternity  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
点击右上角即可分享
微信分享提示