ubuntu制作本地镜像(类似yum本地)

 

1.原文件备份
root@11g:/mnt# cd /etc/apt/
root@11g:/etc/apt# cp sources.list bak_sources.list

 

2.挂载安装盘镜像
mkdir -p /media/cdrom/
root@11g:/soft/ios# cd /soft/ios
root@11g:/soft/ios# mount ubuntu-18.04.6-desktop-amd64.iso -o loop /media/cdrom
mount: /media/cdrom: WARNING: device write-protected, mounted read-only.

 

 

3.向source.list中添加一个新的光盘源文件
root@11g:/etc/apt# apt-cdrom -m -d /media/cdrom add


4.更改sources.list
root@11g:/soft/ios# cd /etc/apt/
root@11g:/etc/apt# more sources.list
#deb cdrom:[Ubuntu 18.04.6 LTS _Bionic Beaver_ - Release amd64 (20210915)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb cdrom:[Ubuntu 18.04.6 LTS _Bionic Beaver_ - Release amd64 (20210915)]/ bionic main restricted

除deb cdrom内容,其它内容都注释掉

 

5.更新软件源
root@11g:/etc/apt# apt-get update

 

6.尝试安装
root@11g:/etc/apt#apt-get install gcc -y
root@11g:/etc/apt# which gcc
/usr/bin/gcc

 

posted @ 2024-07-01 17:25  slnngk  阅读(196)  评论(0编辑  收藏  举报