第四章 Ubuntu 22.04.1 LTS版配置局域网内部网络源

本文档详细介绍了如何在Ubuntu 22.04.1 LTS环境中配置局域网内部网络源,包括安装Apache2服务器,创建GPG签名,设置本地软件仓库元数据,导出并分发公钥,以及在内网主机上配置使用此源。通过这些步骤,即使在不允许连网的内网环境下,也能便捷地管理和更新软件包。
摘要由CSDN通过智能技术生成

1 简介

      由于很多企业内网环境都是不允许连网,无法使用网上的各种源,在安装软件包时来回拷贝软件包安装也比较麻烦,而且还得解决依赖问题。所以就需要搭建个本地/局域网源,配置需要用一台主机当服务器存放deb软件包,局域网内的其他主机可以通过这台主机下载安装包。

       在Ubuntu22版本搭建本局域网源时,APT要求所有软件源都要经过数字签名,以确保软件包的完整性和安全性,为此要为本地源创建GPG签名。

2 系统环境

系统版本

 IP

用途

Ubuntu 22.04.1 LTS

192.168.20.125

客户端(ub-client

Ubuntu 22.04.1 LTS

192.168.20.128

软件包源服务器(ub-server

6.2 服务器端修改主机名并安装web服务

(1)修改主机名称

root@ubuntn:~# hostnamectl --static set-hostname ub-server

(2)安装提供http服务的软件包

如果软件仓库要为内网其他ubuntu服务器提供服务,就需要安装能提供网络服务的软件包,这样的软件有很多种,如ftp,nginx、apache等,这里使用apache2软件包来提供网络应用服务,下面进行apache2软件的安装。

root@ub-server:~# apt install -y apache2

ubuntu 22.04中安装apaches2后,服务将自动启动,查看如下:

6.3 生成GPG密钥

在Ubuntu22版本中搭建网络源时,APT要求所有软件源都要经过数字签名,以确保软件包的完整性和安全性,现在来先安装gnupg软件包,为本地源创建GPG签名。

root@ub-server:~# apt-get install gnupg rng-tools -y

安装gnupg是用来生成GPG密钥,安装rng-tools加快gpg密钥的生成速度。

生成GPG密钥

生成密钥需要输入名称,邮箱,以及密码,下面生成密钥,按照提示输入相关信息。

root@ub-server:~# gpg --full-generate-key

gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

gpg: directory '/root/.gnupg' created

gpg: keybox '/root/.gnupg/pubring.kbx' created

Please select what kind of key you want:

   (1) RSA and RSA (default)

   (2) DSA and Elgamal

   (3) DSA (sign only)

   (4) RSA (sign only)

  (14) Existing key from card

Your selection? 4

RSA keys may be between 1024 and 4096 bits long.

What keysize do you want? (3072) 2048

Requested keysize is 2048 bits

Please specify how long the key should be valid.

         0 = key does not expire

      <n>  = key expires in n days

      <n>w = key expires in n weeks

      <n>m = key expires in n months

      <n>y = key expires in n years

Key is valid for? (0)

Key does not expire at all

Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: repokey

Email address: 601111801@qq.com

Comment:

You selected this USER-ID:

    "repokey <601111801@qq.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

                                         +------------------------------------------------------+

                                         | Please enter the passphrase to                       |

                                         | protect your new key                                 |

                                         |                                                      |

                                         | Passphrase: *_______________________________________ |

                                         |                                                      |

                                         |       <OK>                              <Cancel>     |

                                         +------------------------------------------------------+

                                  +--------------------------------------------------------------------+

                                  | Warning: You have entered an insecure passphrase.                  |

                                  |                                                                    |

                                  | A passphrase should be at least 8 characters long.                 |

                                  |                                                                    |

                                  | <Take this one anyway>                      <Enter new passphrase> |

                                  +--------------------------------------------------------------------+

                                         +------------------------------------------------------+

                                         | Please re-enter this passphrase                      |

                                         |                                                      |

                                         | Passphrase: *_______________________________________ |

                                         |                                                      |

                                         |       <OK>                              <Cancel>     |

                                         +------------------------------------------------------+

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yjun89

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值