正如标题所示,我想将我的Postgresql-10升级到Postgresql-11。 我正在使用ubuntu-18.04。
答案 0 :(得分:7)
将Postgres升级到最新版本(当前为13)或中间版本(例如11),应运行以下命令:
sudo apt install postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
此文档记录在https://wiki.postgresql.org/wiki/Apt
上
这将在您的计算机上运行bash脚本。如果您希望手动执行这些步骤,请参见此处。
一旦安装了Postgres,在Ubuntu上升级的最简单方法就是使用pg_upgradecluster。
sudo -u postgres pg_dumpall > all.sql
// Install latest Postgres. Use `postgresql-11` for v11 instead of `postgresql` for latest.
sudo apt-get install -y postgresql
// The install sets up a cluster, which needs then to be removed for the upgrade.
// Stop and remove the newly installed cluster. Use `11` instead of `13` for v11
sudo pg_dropcluster 13 main --stop
// Upgrade the db. Takes the OLD version and OLD schema as required arguments
sudo pg_upgradecluster 10 main
// Test. Once you are satisfied, remove OLD cluster.
sudo pg_dropcluster 10 main
答案 1 :(得分:5)
您可以关注此博客setup Postgresql-11 on Ubuntu。我发现它很简单。
在您的Ubuntu计算机上添加PostgreSQL软件包存储库
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main 11" | sudo tee /etc/apt/sources.list.d/pgsql.list
添加PostgreSQL软件包存储库的GPG密钥:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
更新APT并安装postgresql-11
sudo apt update && sudo apt install postgresql-11
答案 2 :(得分:-1)
使用此命令:
sudo apt update && sudo apt install postgresql-11