当前位置:   article > 正文

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

uos更换apt源

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

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

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

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

# mount /dev/cdrom /media/cdrom
  • 1

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

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

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,通过浏览器访问该链接可知其中还包含了其他仓库。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

因此,我们需要使用“–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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

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

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

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参数拒绝从未认证的仓库安装软件包。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

执行“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) ...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

6.检查结果:

# arping -V
arping utility, iputils-s20180629
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/255948
推荐阅读
相关标签
  

闽ICP备14008679号