UOS利用系统安装光盘做本地apt源安装软件包

本文介绍了如何在UOS操作系统中,通过系统安装光盘或ISO镜像创建本地apt源,并详细阐述了挂载、修改sources.list、更新索引、安装软件包的步骤,以及处理未签名仓库的安全警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UOS利用系统安装光盘做本地apt源安装软件包

普通用户可能没有权限执行mount命令,因此建议使用root用户或具有sudo权限的用户执行如下操作。

1.可以使用系统安装光盘,或者系统ISO镜像制作本地apt源。

若使用系统安装光盘。将光盘插入服务器光驱,然后执行如下命令挂载光盘到/media/cdrom目录:

# mount /dev/cdrom /media/cdrom

若使用系统ISO镜像。将系统ISO镜像上传至服务器(如/home/kingbase),然后执行如下命令挂载ISO镜像到/media/cdrom目录:

# mount -t iso9660 -o loop /home/kingbase/uniontechos-server-20-enterprise-1021-amd64.iso /media/cdrom

2.修改UOS系统/etc/apt/sources.list文件,添加本地apt源指向/media/cdrom目录:

# cat /etc/apt/sources.list
# Generated by deepin-installer
#deb https://enterprise-packages.chinauos.com/server-enterprise fou/sp2 main contrib non-free    #此行是默认启用的,无法连接互联网的环境需要注释。
#deb-src https://enterprise-packages.chinauos.com/server-enterprise fou/sp2 main contrib non-free    #此行默认是关闭的。
deb file:///media/cdrom stable main    #此行是新增的,其中“stable”将指向/media/cdrom/dists/stable/Release文件,该文件中的Components行记录了所有可用的仓库,ISO文件和安装光盘默认只包含了main。
#deb https://packages.chinauos.cn/uos eagle main non-free    #此行是UOS官方提供的在线的apt源,其仓库版本为eagle,可用的仓库为main和non-free,通过浏览器访问该链接可知其中还包含了其他仓库。

3.更新apt源索引。

由于光盘中没有提供仓库签名文件,在使用apt update命令更新索引时系统会认为该仓库不安全,默认将禁用该apt源,如下所示:

# apt-get update
Get:1 file:/media stable InRelease
Ign:1 file:/media stable InRelease
Get:2 file:/media stable Release [1,581 B]
Get:2 file:/media stable Release [1,581 B]
Get:3 file:/media stable Release.gpg
Ign:3 file:/media stable Release.gpg
Reading package lists... Done
E: The repository 'file:/media stable Release' is not signed.    #提示该apt源未正确签名
N: Updating from such a repository can't be done securely, and is therefore disabled by default.    #不能安全的更新索引,默认将禁用该apt源。
N: See apt-secure(8) manpage for repository creation and user configuration details.

因此,我们需要使用“–allow-insecure-repositories”参数来更新索引信息:

# apt update --allow-insecure-repositories
Get:1 file:/media stable InRelease
Ign:1 file:/media stable InRelease
Get:2 file:/media stable Release [1,581 B]
Get:2 file:/media stable Release [1,581 B]
Get:3 file:/media stable Release.gpg
Ign:3 file:/media stable Release.gpg
Get:4 file:/media stable/main amd64 Packages [673 kB]
Get:5 file:/media stable/main i386 Packages [183 kB]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: The repository 'file:/media stable Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

4.验证索引是否更新成功:

# which arping
# apt list iputils-arping
Listing... Done
iputils-arping/unknown 3:20180629-2+deb10u1 amd64

5.安装iputils-arping软件包:

“apt install -y”命令中-y参数默认会拒绝未认证的软件包,因此需要使用“–allow-unauthenticated”参数来安装,如下所示:

# apt install -y iputils-arping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  iputils-arping
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.2 kB of archives.
After this operation, 52.2 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  iputils-arping
E: There were unauthenticated packages and -y was used without --allow-unauthenticated    # -y参数拒绝从未认证的仓库安装软件包。

执行“apt install -y --allow-unauthenticated”命令安装iputils-arping软件包:

# apt install -y --allow-unauthenticated iputils-arping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  iputils-arping
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.2 kB of archives.
After this operation, 52.2 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  iputils-arping
Authentication warning overridden.
Get:1 file:/media/cdrom stable/main amd64 iputils-arping amd64 3:20180629-2+deb10u1 [20.2 kB]
Selecting previously unselected package iputils-arping.
(Reading database ... 70345 files and directories currently installed.)
Preparing to unpack .../iputils-arping_20180629-2+deb10u1_amd64.deb ...
Unpacking iputils-arping (3:20180629-2+deb10u1) ...
Setting up iputils-arping (3:20180629-2+deb10u1) ...
Processing triggers for man-db (2.8.5-2) ...

6.检查结果:

# arping -V
arping utility, iputils-s20180629
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值