Ubuntu20.04和22.04离线安装PostgreSQL14
今天安装 Postgresql14 遇到一个问题, 目标服务器只有内网, 内网提供标准的apt仓库, 但是因为不能连接外网, 所以没法添加第三方仓库, 这样安装pg14就成了问题.
从pg的官网看, https://www.postgresql.org/download/, 对于Linux, pg只提供仓库和源码两种方式, 因此不能访问外网时, 貌似只有源码编译这条路. 因为源码编译费时费力并且安装阶段需要自行配置, 容易出错. 对于机器上只需要安装一个实例的场景, 能用仓库还是用仓库.
如果还有一台安装了同样发行版, 并且可以上网的机器, 可以通过这台机器将离线安装包下载下来, 再传到目标机器上安装. 下载离线安装包和中转机器是否已经安装此软件无关, 即使已经安装, 也可以下载
步骤一: 按正常安装方式添加第三方仓库
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
这时候通过下面的命令可以看到postgresql的安装候选
$ apt-cache show postgresql
Package: postgresql
Source: postgresql-common (243.pgdg20.04+1)
Version: 14+243.pgdg20.04+1
Architecture: all
Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
Installed-Size: 70
Depends: postgresql-14
Suggests: postgresql-doc
Priority: optional
Section: database
Filename: pool/main/p/postgresql-common/postgresql_14+243.pgdg20.04+1_all.deb
Size: 67068
...
Package: postgresql
Architecture: all
Version: 12+214ubuntu0.1
Priority: optional
Section: database
Source: postgresql-common (214ubuntu0.1)
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 66
Depends: postgresql-12
Suggests: postgresql-doc
Filename: pool/main/p/postgresql-common/postgresql_12+214ubuntu0.1_all.deb
Size: 3924
...
Package: postgresql
Architecture: all
Version: 12+214
Priority: optional
Section: database
Source: postgresql-common (214)
...
可以看到, 有三个候选, 其中版本14排在最前面, 如果apt install, 会安装最前面这个
步骤二: 查看依赖
前一步确定了默认安装的版本是需要的版本14后, 就可以通过apt-rdepends命令查看安装包的软件依赖关系, 这是一个很长的列表, 下面省略了大部分的内容, 仅列出一些和pg安装相关的包
$ apt-rdepends postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql
Depends: postgresql-14
postgresql-14
Depends: debconf (>= 0.5)
...
Depends: locales-all
Depends: postgresql-client-14
Depends: postgresql-common (>= 229~)
Depends: ssl-cert
Depends: tzdata
Depends: zlib1g (>= 1:1.1.4)
debconf
PreDepends: perl-base (>= 5.20.1-3~)
perl-base
libpq5
postgresql-client-14
Depends: postgresql-client-common (>= 182~)
postgresql-client-common
Depends: pgdg-keyring
postgresql-common
Depends: postgresql-client-common (= 243.pgdg20.04+1)
...
libattr1
Depends: libc6 (>= 2.4)
步骤三: 下载deb安装包
通过这个依赖关系, 能大概确定第一步需要下载的安装包, 然后通过apt download命令下载
apt download postgresql-14 postgresql-client-14 postgresql-common postgresql-client-common
下载之后的文件
$ ll
total 17316
-rw-r--r-- 1 milton milton 15785632 Aug 11 09:35 postgresql-14_14.5-1.pgdg20.04+1_amd64.deb
-rw-r--r-- 1 milton milton 1617564 Aug 11 09:35 postgresql-client-14_14.5-1.pgdg20.04+1_amd64.deb
-rw-r--r-- 1 milton milton 91896 Sep 8 14:07 postgresql-client-common_243.pgdg20.04+1_all.deb
-rw-r--r-- 1 milton milton 231472 Sep 8 14:07 postgresql-common_243.pgdg20.04+1_all.deb
步骤四: 安装并补充下载
这些文件传到目标机器上后, 按依赖关系逆序安装,
sudo dpkg -i pgdg-keyring_2018.2_all.deb
sudo dpkg -i postgresql-client-common_243.pgdg20.04+1_all.deb
sudo dpkg -i postgresql-common_243.pgdg20.04+1_all.deb
sudo apt -f install
sudo dpkg -i postgresql-client-14_14.5-1.pgdg20.04+1_amd64.deb
sudo dpkg -i libpq5_14.5-1.pgdg20.04+1_amd64.deb
sudo dpkg -i postgresql-client-14_14.5-1.pgdg20.04+1_amd64.deb
sudo dpkg -i postgresql-14_14.5-1.pgdg20.04+1_amd64.deb
sudo apt -f install
安装的过程中, 会提示依赖缺失, 这会有两种情况, 一种是在标准仓库中存在的, 可以直接通过下面的命令自动安装
sudo apt -f install
另一种是在标准仓库中不存在的, 需要在中转机器上通过apt download下载之后再传到目标机器安装. 对应pg14, 最后完整的下载文件列表为
$ ll
total 17500
-rw-r--r-- 1 milton milton 172828 Aug 11 09:34 libpq5_14.5-1.pgdg20.04+1_amd64.deb
-rw-r--r-- 1 milton milton 10666 Nov 15 2018 pgdg-keyring_2018.2_all.deb
-rw-r--r-- 1 milton milton 15785632 Aug 11 09:35 postgresql-14_14.5-1.pgdg20.04+1_amd64.deb
-rw-r--r-- 1 milton milton 1617564 Aug 11 09:35 postgresql-client-14_14.5-1.pgdg20.04+1_amd64.deb
-rw-r--r-- 1 milton milton 91896 Sep 8 14:07 postgresql-client-common_243.pgdg20.04+1_all.deb
-rw-r--r-- 1 milton milton 231472 Sep 8 14:07 postgresql-common_243.pgdg20.04+1_all.deb
Ubuntu20.04和22.04离线安装PostgreSQL14的更多相关文章
- 从零到一,利用kubeadm在ubuntu server 16.04 64位系统离线安装kubernetes v1.10.0
说明 初步接触kubernets,记录学习过程 本教程目的利用kubeadm在ubuntu server 16.04 64位系统离线安装kubernets v1.10.0 环境信息 节点IP地址 角色 ...
- Ubuntu14.04用apt在线/离线安装CDH5.1.2[Apache Hadoop 2.3.0]
目录 [TOC] 1.CDH介绍 1.1.什么是CDH和CM? CDH一个对Apache Hadoop的集成环境的封装,可以使用Cloudera Manager进行自动化安装. Cloudera-Ma ...
- ubuntu16.04(liunx) 离线安装 xgboost (anaconda3,anaconda2共存)
服务器ubuntu 系统同时安装了 anaconda3,anaconda2 ,但服务器没有连接外网,所以 想在python3 环境下安装离线安装xgboost. 主要分2步: 0:进入py3环境 ( ...
- Ubuntu14.04下Mongodb(离线安装方式|非apt-get)安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 说在前面的话 首先,查看下你的操作系统的版本. root@zhouls-virtual-machine:~# cat /etc/issue Ubuntu LTS \n \l r ...
- Ubuntu16.04下Mongodb(离线安装方式|非apt-get)安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 说在前面的话 首先,查看下你的操作系统的版本. root@zhouls-virtual-machine:~# cat /etc/issue Ubuntu LTS \n \l r ...
- Ubuntu14.04用apt在线/离线安装CDH5.1.2[Apache Hadoop 2.3.0]-old
用markdown重写,请稳步这里http://www.cnblogs.com/lion.net/p/5477899.html
- 解决ubuntu 20.04、22.04 即新版本 fcitx 无法使用的问题
前提 已在系统设置中将fcitx设置为默认 fcitx开机自启 配置的过程不在本文讨论范围之内 开机自启可通过安装gnome-tweaks配置实现 问题分析流程 手动启动fcitx时提示设置XMODI ...
- Ubuntu14.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu14.04下Mongodb(离线安 ...
- Ubuntu16.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu16.04下Mongodb(离线安 ...
- CentOS7.6离线安装docker
2019/10/24,docker 摘要:CentOS 7.6中离线安装docker 18.06.3以及docker-compose 1.24.1 在线安装可参照 文档 所需环境 1.CentOS 7 ...
随机推荐
- ASIC 功能验证SVTB
System Verilog进行验证是可以不综合的 发现DUT中的功能问题 预备知识:Linux/verilog/gvim System Verilog学习目录 System Verilog Test ...
- [转帖]JVM参数配置及调优
https://cloud.tencent.com/developer/article/2235751 JVM参数分类 jvm 参数可分为三类: 标准参数:以 "-" 开头的参数 ...
- [转帖]tidb 如何对 TiDB 进行 TPC-C 测试
https://docs.pingcap.com/zh/tidb/stable/benchmark-tidb-using-tpcc TPC-C 是一个对 OLTP(联机交易处理)系统进行测试的规范,使 ...
- [转帖]不同CPU性能大PK
https://plantegg.github.io/2022/01/13/%E4%B8%8D%E5%90%8CCPU%E6%80%A7%E8%83%BD%E5%A4%A7PK/ 前言 比较Hygon ...
- [转帖]jmap执行失败了,怎么获取heapdump?
https://www.jianshu.com/p/f4bfd169b4ca 在之前的OOM问题复盘中,我们添加了jmap脚本来自动dump内存现场,方便排查OOM问题. 但当我反复模拟OOM场景 ...
- [转帖]军备芯片14nm对比5nm,在战场上差距在哪里?
https://www.eet-china.com/mp/a207185.html 现在全球已经打响科技之战,每个国家都在力求让自己做到足够拔尖.美国商务部长就曾自曝家底说,美国制定两套战略应对在芯片 ...
- [转帖]CentOS7完美升级gcc版本方法
https://blog.whsir.com/post-4975.html 在某些应用场景中,需要特定的gcc版本支持,但是轻易不要去编译gcc.不要去编译gcc.不要去编译gcc,我这里推荐使用红帽 ...
- [转帖]发布即巅峰!万字长文:Java性能调优六大工具:MAT内存分析工具
jianshu.com/p/4ed3dd8b7b83 MAT是MemoryAnalyzerTool的简称,它是一款功能强大的Java堆内存分析器,可以用于查找内存泄漏以及查看内存消耗情况.MAT是 基 ...
- [转帖]Springboot配置https访问
https://www.cnblogs.com/feifuzeng/p/14709372.html 介绍 该篇博文主要介绍如何配置Springboot使其打包部署的服务必须通过HTTPS协议才可访问, ...
- Mysql localhost 无法登录 root用户的处理过程
问题说明: 前段时间同事修改密码, 但是发现修改了密码之后,外面可以连接root用户, 但是本地无法连接了. 怀疑是密码修改存在问题,需要重新进行处理 这里进行简单的描述. 问题现象 使用 mysql ...