postgres 重装
1.删除本地的postgres https://www.cnblogs.com/52note/p/15277150.html
sudo apt-get --purge remove postgresql\*
2.重新安装:https://www.postgresql.org/download/linux/ubuntu/
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql查看版本:
postgres --version
which postgres
3.删除桌面版postgres,重新安装
sudo apt -y remove pgadmin4
sudo apt -y autoremove pgadmin4*
出现了报错:‘PgAdmin: Package 'pgAdmin4' has no installation candidate’
https://stackoverflow.com/questions/58239607/pgadmin-package-pgadmin4-has-no-installation-candidate
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key addsudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'sudo apt install pgadmin4sudo /usr/pgadmin4/bin/setup-web.sh然后打开桌面的postgres,输入密码,连接远程的某个数据库,可以使用,结束。