阅读量:1
在Ubuntu上安装PostgreSQL,可参考以下步骤:
- 添加官方仓库:执行
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list',创建仓库配置文件。 - 导入密钥:运行
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -,导入仓库签名密钥。 - 更新包列表:使用
sudo apt update,确保系统能识别新添加的仓库。 - 安装PostgreSQL:执行
sudo apt install -y postgresql postgresql-contrib,安装最新版本的PostgreSQL及其扩展包。若需安装特定版本,可将postgresql替换为对应版本号,如postgresql-14。 - 启动服务:安装完成后,PostgreSQL服务会自动启动。若未启动,可使用
sudo systemctl start postgresql手动启动,并通过sudo systemctl enable postgresql设置开机自启。
以上就是关于“Ubuntu如何安装PostgreSQL”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm