Deepin下安装PostgreSQL

打印 上一主题 下一主题

主题 513|帖子 513|积分 1549

Deepin下安装Postgresql

我的Deepin版本为
  1. $ lsb_release -a
  2. No LSB modules are available.
  3. Distributor ID: Deepin
  4. Description:    Deepin 20.9
  5. Release:        20.9
  6. Codename:       apricot
复制代码
注意这里Codename是apricot,后面会提到。
由于Deepin的apt连接的是Deepin官方源,其中的软件版本十分老旧,直接利用
  1. $ sudo apt install postgresql
复制代码
下载的版本是 11,而这已经是PostgreSQL的不支持版本。

幸亏PostgreSQL下载文档告诉我们他们提供了官方Apt堆栈,可以通过以下方式设置:
  1. $ sudo apt install -y postgresql-common
  2. $ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
复制代码
报错
  1. $ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
  2. This script will enable the PostgreSQL APT repository on apt.postgresql.org on
  3. your system. The distribution codename used will be apricot-pgdg.
  4. Your system is using the distribution codename apricot, but apricot-pgdg
  5. does not seem to be a valid distribution on
  6. http://apt.postgresql.org/pub/repos/apt/dists/
  7. We abort the installation here. If you want to use a distribution different
  8. from your system, you can call this script with an explicit codename, e.g.
  9. "/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh precise".
  10. Specifically, if you are using a non-LTS Ubuntu release, refer to
  11. https://wiki.postgresql.org/wiki/Apt/FAQ#I_am_using_a_non-LTS_release_of_Ubuntu
  12. For more information, refer to https://wiki.postgresql.org/wiki/Apt
  13. or ask on the mailing list for assistance: pgsql-pkg-debian@postgresql.org
复制代码
看内容可以看出来,apricot不是合法的codename,因为我们毕竟不是在原生Debian上安装。
前往报错中提示的 http://apt.postgresql.org/pub/repos/apt/dists/ 查察

这实际上是Debian发行版本

而在PostgreSQL下载文档,也列出了支持的Debian版本

查询本系统基于的Debian版本:
  1. $ cat /etc/debian_version
  2. 10.10
复制代码
应该利用buster作为Codename,联合报错信息中给的例子,重新执行
  1. $ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh buster
  2. This script will enable the PostgreSQL APT repository on apt.postgresql.org on
  3. your system. The distribution codename used will be buster-pgdg.
  4. Press Enter to continue, or Ctrl-C to abort.
  5. Writing /etc/apt/sources.list.d/pgdg.list ...
  6. Importing repository signing key ...
  7. OK
  8. Running apt-get update ...
  9. 命中:1 https://pro-driver-packages.uniontech.com eagle InRelease
  10. 命中:2 https://dl.google.com/linux/chrome/deb stable InRelease                                               
  11. 命中:4 https://community-packages.deepin.com/deepin apricot InRelease                                       
  12. 命中:5 https://community-packages.deepin.com/driver driver InRelease                                         
  13. 命中:3 https://packages.microsoft.com/repos/code stable InRelease                                            
  14. 命中:6 https://community-packages.deepin.com/printer eagle InRelease                                         
  15. 获取:7 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [157 kB]                                
  16. 获取:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [349 kB]                     
  17. 获取:9 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main i386 Packages [344 kB]        
  18. 命中:10 https://app-store-files.uniontech.com/240709181548520/appstore deepin InRelease
  19. 已下载 850 kB,耗时 5秒 (188 kB/s)
  20. 正在读取软件包列表... 完成
  21. You can now start installing packages from apt.postgresql.org.
  22. Have a look at https://wiki.postgresql.org/wiki/Apt for more information;
  23. most notably the FAQ at https://wiki.postgresql.org/wiki/Apt/FAQ
复制代码
执行乐成,查察postgresql最新版本
  1. $ apt show postgresql
  2. Package: postgresql
  3. Version: 16+261.pgdg100+1
  4. Priority: optional
  5. Section: database
  6. Source: postgresql-common (261.pgdg100+1)
  7. Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
  8. Installed-Size: 74.8 kB
  9. Depends: postgresql-16
  10. Suggests: postgresql-doc
  11. Download-Size: 69.5 kB
  12. APT-Sources: http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages
  13. Description: object-relational SQL database (supported version)
  14. This metapackage always depends on the currently supported PostgreSQL
  15. database server version.
  16. .
  17. PostgreSQL is a fully featured object-relational database management
  18. system.  It supports a large part of the SQL standard and is designed
  19. to be extensible by users in many aspects.  Some of the features are:
  20. ACID transactions, foreign keys, views, sequences, subqueries,
  21. triggers, user-defined types and functions, outer joins, multiversion
  22. concurrency control.  Graphical user interfaces and bindings for many
  23. programming languages are available as well.
  24. N: 有 1 条附加记录。请加上 ‘-a’ 参数来查看它们
复制代码
更新软件包
  1. $ sudo apt upgrade
复制代码
查察当前版本
  1. $ sudo apt list postgresql
  2. 正在列表... 完成
  3. postgresql/buster-pgdg,buster-pgdg,now 16+261.pgdg100+1 all [已安装]
  4. N: 还有 1 个版本。请使用 -a 选项来查看它(他们)。
复制代码
在PostgreSQL中查察版本
  1. $ psql --version
  2. psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg100+1)
复制代码
更新乐成

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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

来自云龙湖轮廓分明的月亮

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表