阿里云ECS - Ubuntu 安装Postgresql

本文详述了在Ubuntu系统中安装Postgresql的过程,包括使用Apt-get安装失败后,从Postgresql官网下载安装,修改postgres用户密码,创建新用户及数据库,解决登录问题,以及安装Python的psycopg2库作为Postgresql的接口。在安装过程中遇到了启动服务的故障,最终通过调整配置文件和启用服务解决了问题。
摘要由CSDN通过智能技术生成

1. Apt-get 安装postgresql postgresql-contrib

        1.1 apt-get install postgresql postgresql-contrib, 安装出奇的顺利,并没有出现不能安装的情况。看了执行过程,发现并没有安装postsql,又单独安装了一次postgresql,发现人家只是装了postgresql-doc,果然没那么简单。

        apt-get install postgresql postgresql-contrib,执行结果如下:

root@iZwz984fp76m132ex9esc8Z:/# sudo apt-get install postgresql postgresql-contrib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
postgresql is already the newest version (12+214ubuntu0.1).
The following NEW packages will be installed:
  postgresql-contrib
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 3,932 B of archives.
After this operation, 67.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates/main amd64 postgresql-contrib all 12+214ubuntu0.1 [3,932 B]
Fetched 3,932 B in 0s (41.1 kB/s)       
Selecting previously unselected package postgresql-contrib.
(Reading database ... 116914 files and directories currently installed.)
Preparing to unpack .../postgresql-contrib_12+214ubuntu0.1_all.deb ...
Unpacking postgresql-contrib (12+214ubuntu0.1) ...
Setting up postgresql-contrib (12+214ubuntu0.1) ...

          再次执行apt-get install postgresql 指令,执行结果:

xxxxxxxx:/data/env/venv-site# apt-get install postgresql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  postgresql-doc
The following NEW packages will be installed:
  postgresql
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 0 B/3,924 B of archives.
After this operation, 67.6 kB of additional disk space will be used.
Selecting previously unselected package postgresql.
(Reading database ... 116911 files and directories currently installed.)
Preparing to unpack .../postgresql_12+214ubuntu0.1_all.deb ...
Unpacking postgresql (12+214ubuntu0.1) ...
Setting up postgresql (12+214ubuntu0.1) ...
xxxxxxxxxx:/data/env/venv-site# 

 用apt-get remove postgresql

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值