安装pgAdmin:
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo 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 pgadmin4
安装postgres
1.使用apt不能安装成功:https://linlin.fun/blogs/1054
sudo apt-get -y install postgresql
apt update的时候提示:
安装postgres的时候提示:
W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/jammy/dists/pgadmin4/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
E: The repository 'https://ppa.launchpadcontent.net/dhor/myway/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://ppa.launchpadcontent.net/webupd8team/java/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
进行更新apt包:
sudo apt update
sudo apt install --reinstall apt
然后重新查看文件是否存在:
ls /etc/apt/sources.list
ls /etc/apt/sources.list.d
查看文件是否存在:
再次安装:
sudo apt update
sudo apt install postgresql
但是还是不行
2.使用asdf安装:
asdf plugin-add postgres https://github.com/smashedtoatoms/asdf-postgres.git
sudo apt install build-essential libreadline-dev zlib1g-dev
然后安装:
asdf install postgres <version>
如果不知道版本:
asdf list-all postgres
安装postgres 15.0
安装后,可以运行命令查看是否安装成功:
然后根据提示修改文件内容即可。