来自云龙湖轮廓分明的月亮 发表于 2024-7-11 21:39:51

Deepin下安装PostgreSQL

Deepin下安装Postgresql

我的Deepin版本为
$ lsb_release -a
No LSB modules are available.
Distributor ID: Deepin
Description:    Deepin 20.9
Release:      20.9
Codename:       apricot注意这里Codename是apricot,后面会提到。
由于Deepin的apt连接的是Deepin官方源,其中的软件版本十分老旧,直接利用
$ sudo apt install postgresql下载的版本是 11,而这已经是PostgreSQL的不支持版本。
https://img2024.cnblogs.com/blog/3419635/202407/3419635-20240711152154597-916687521.png
幸亏PostgreSQL下载文档告诉我们他们提供了官方Apt堆栈,可以通过以下方式设置:
$ sudo apt install -y postgresql-common
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh报错
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be apricot-pgdg.

Your system is using the distribution codename apricot, but apricot-pgdg
does not seem to be a valid distribution on
http://apt.postgresql.org/pub/repos/apt/dists/

We abort the installation here. If you want to use a distribution different
from your system, you can call this script with an explicit codename, e.g.
"/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh precise".

Specifically, if you are using a non-LTS Ubuntu release, refer to
https://wiki.postgresql.org/wiki/Apt/FAQ#I_am_using_a_non-LTS_release_of_Ubuntu

For more information, refer to https://wiki.postgresql.org/wiki/Apt
or ask on the mailing list for assistance: pgsql-pkg-debian@postgresql.org看内容可以看出来,apricot不是合法的codename,因为我们毕竟不是在原生Debian上安装。
前往报错中提示的 http://apt.postgresql.org/pub/repos/apt/dists/ 查察
https://img2024.cnblogs.com/blog/3419635/202407/3419635-20240711150808329-1856638059.png
这实际上是Debian发行版本
https://img2024.cnblogs.com/blog/3419635/202407/3419635-20240711150949614-1839671902.png
而在PostgreSQL下载文档,也列出了支持的Debian版本
https://img2024.cnblogs.com/blog/3419635/202407/3419635-20240711151028750-1827015354.png
查询本系统基于的Debian版本:
$ cat /etc/debian_version
10.10应该利用buster作为Codename,联合报错信息中给的例子,重新执行
$ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh buster
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be buster-pgdg.

Press Enter to continue, or Ctrl-C to abort.
Writing /etc/apt/sources.list.d/pgdg.list ...
Importing repository signing key ...
OK
Running apt-get update ...
命中:1 https://pro-driver-packages.uniontech.com eagle InRelease
命中:2 https://dl.google.com/linux/chrome/deb stable InRelease                                             
命中:4 https://community-packages.deepin.com/deepin apricot InRelease                                       
命中:5 https://community-packages.deepin.com/driver driver InRelease                                       
命中:3 https://packages.microsoft.com/repos/code stable InRelease                                          
命中:6 https://community-packages.deepin.com/printer eagle InRelease                                       
获取:7 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease                               
获取:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages                      
获取:9 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main i386 Packages       
命中:10 https://app-store-files.uniontech.com/240709181548520/appstore deepin InRelease
已下载 850 kB,耗时 5秒 (188 kB/s)
正在读取软件包列表... 完成

You can now start installing packages from apt.postgresql.org.

Have a look at https://wiki.postgresql.org/wiki/Apt for more information;
most notably the FAQ at https://wiki.postgresql.org/wiki/Apt/FAQ执行乐成,查察postgresql最新版本
$ apt show postgresql
Package: postgresql
Version: 16+261.pgdg100+1
Priority: optional
Section: database
Source: postgresql-common (261.pgdg100+1)
Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
Installed-Size: 74.8 kB
Depends: postgresql-16
Suggests: postgresql-doc
Download-Size: 69.5 kB
APT-Sources: http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages
Description: object-relational SQL database (supported version)
This metapackage always depends on the currently supported PostgreSQL
database server version.
.
PostgreSQL is a fully featured object-relational database management
system.It supports a large part of the SQL standard and is designed
to be extensible by users in many aspects.Some of the features are:
ACID transactions, foreign keys, views, sequences, subqueries,
triggers, user-defined types and functions, outer joins, multiversion
concurrency control.Graphical user interfaces and bindings for many
programming languages are available as well.

N: 有 1 条附加记录。请加上 ‘-a’ 参数来查看它们更新软件包
$ sudo apt upgrade查察当前版本
$ sudo apt list postgresql
正在列表... 完成
postgresql/buster-pgdg,buster-pgdg,now 16+261.pgdg100+1 all [已安装]
N: 还有 1 个版本。请使用 -a 选项来查看它(他们)。在PostgreSQL中查察版本
$ psql --version
psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg100+1)更新乐成

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Deepin下安装PostgreSQL