Ubuntu16安裝pgsql9、11及解除安裝

2020-10-19 15:00:42

Ubuntu16部署postgresql9、11及解除安裝

1、postgresql9.6

新增官方源:
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" 
匯入倉庫:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
更新安裝包列表:
sudo apt-get update 
安裝:
sudo apt-get install postgresql-9.6 

2、postgresql11

新增官方源:
sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list main" 
匯入倉庫:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
更新安裝包列表:
sudo apt-get update 
安裝:
apt-get install postgresql-11

解除安裝pg:

apt-get --purge remove postgresql\*
rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/