Ubuntu挂载本地镜像源(像CentOS 一样挂载本地镜像源)

1.挂载 ISO 镜像

sudo mount -o loop /ubuntu-22.04.5-desktop-amd64.iso /mnt/iso

2.备份现有的软件源配置文件

复制代码
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

3.编辑软件源配置文件 编辑 /etc/apt/sources.list

sudo nano /etc/apt/sources.list

复制代码
在文件中添加或修改以下内容:
deb file:///mnt/iso/ main restricted
deb file:///mnt/iso/ universe multiverse
deb file:///mnt/iso/ updates main restricted
deb file:///mnt/iso/ updates universe multiverse
deb file:///mnt/iso/ security main restricted
deb file:///mnt/iso/ security universe multiverse

注意:如果初次使用nano编辑器,使用下面的命令

  • Ctrl + O:保存文件。
  • Ctrl + X:退出编辑器,如果文件已修改会提示保存。
  • Ctrl + K:剪切当前行或选中的文本。
  • Ctrl + U:粘贴剪切或复制的文本。

4.更新软件包列表

复制代码
sudo apt update

5.安装软件包 :sudo apt install nginx

软件包安装成功ok

相关推荐
orion5721 小时前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫3 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux