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

相关推荐
庄风子14 分钟前
In VI, when an arrow key is pressed, a character (e.g. “A“) is sent.
linux·vi
Suger9991 小时前
centos网络打流测试
linux·网络·centos
1024find1 小时前
Docker安装(Centos/Ubuntu/UOS)
ubuntu·docker·centos·debian
小何好运暴富开心幸福2 小时前
操作系统之初识Linux
linux·运维·服务器·bash
こ进制掌控者3 小时前
Ubuntu server 24.04.3 设置静态IP
linux·tcp/ip·ubuntu
泡沫冰@3 小时前
shell编程:sed - 流编辑器(5)
linux
xiaguangbo4 小时前
rust slint android 安卓
android·linux·rust
晓梦初醒p4 小时前
finalshell 连接服务器报错channel is not opened
linux·运维·服务器
conkl5 小时前
在ARM64 Ubuntu 20.04上部署Mailu邮件系统:深度排查Docker Bridge网络通信失败问题
linux·ubuntu·docker
Code Warrior5 小时前
【Linux】基础IO(2)
linux