Ubuntu18.04安装postgresql-10

服务器

浏览数:149

2019-7-26

AD:资源代下载服务

Ubuntu18安装postgresql-10

最近切换Ubuntu作为办公系统,所有软件安装都要重来一遍。

官方文档: https://www.postgresql.org/download/linux/ubuntu/

查看系统版本

~  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

我的系统是 bionic, 其他还有xenial(16), trusty(14).

创建resource源

vim /etc/apt/sources.list.d/pgdg.list 

deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main

导入key

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

可以安装以下软件
| name | desc |
| —- | —-|
|postgresql-client-10 | client libraries and client binaries |
|postgresql-10 | core database server |
|postgresql-contrib-9.x | additional supplied modules (part of the postgresql-xx package in version 10 and later) |
|libpq-dev | libraries and headers for C language frontend development |
|postgresql-server-dev-10| libraries and headers for C language backend development |
|pgadmin4 | pgAdmin 4 graphical administration utility |

安装

sudo apt-get install postgresql-10  pgadmin4

安装之后

安装完毕已经启动,可以修改下密码:

sudo su postgres
ALTER USER postgres WITH PASSWORD '新密码'; 

安装完的目录: /var/lib/postgresql/10

然后其他配置类似centos7: https://www.cnblogs.com/woshimrf/p/centos-install-postgresql.html

启动pgadmin

Ubuntu上navicate貌似不好装,使用官方pgadmin4

sudo find / -name pgAdmin4

## 启动
pgAdmin4

作者:Ryan.Miao