-
查看Unbuntu版本和Codename:
qv123@localhost:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy # 不同的版本apt源语句中就换不同的关键字
-
备份文件:
cp /etc/apt/sources.list /opt/sources.list.bak
-
编辑
/etc/apt/sources.list
文件:(root用户才可以使用哦eof)# Unbuntu20.4版本,20.4版本在安装的时候指定好Mirrors addresses再重启网络并且执行sudo apt-get clean && sudo apt-get upgrade && sudo apt-get update命令就可以正常使用apt命令,不必再配置yum源 #添加阿里源 cat << eof > /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu focal main restricted deb http://mirrors.aliyun.com/ubuntu focal-updates main restricted deb http://mirrors.aliyun.com/ubuntu focal universe deb http://mirrors.aliyun.com/ubuntu focal-updates universe deb http://mirrors.aliyun.com/ubuntu focal multiverse deb http://mirrors.aliyun.com/ubuntu focal-updates multiverse deb http://mirrors.aliyun.com/ubuntu focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu focal-security main restricted deb http://mirrors.aliyun.com/ubuntu focal-security universe deb http://mirrors.aliyun.com/ubuntu focal-security multiverse eof
# Unbuntu22.4版,22.4版本在安装的时候指定好Mirrors addresses再重启网络并且执行sudo apt-get clean && sudo apt-get upgrade && sudo apt-get update命令就可以正常使用apt命令,不必再配置yum源 #添加阿里源 cat << eof > /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu jammy main restricted deb http://mirrors.aliyun.com/ubuntu jammy-updates main restricted deb http://mirrors.aliyun.com/ubuntu jammy universe deb http://mirrors.aliyun.com/ubuntu jammy-updates universe deb http://mirrors.aliyun.com/ubuntu jammy multiverse deb http://mirrors.aliyun.com/ubuntu jammy-updates multiverse deb http://mirrors.aliyun.com/ubuntu jammy-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu jammy-security main restricted deb http://mirrors.aliyun.com/ubuntu jammy-security universe deb http://mirrors.aliyun.com/ubuntu jammy-security multiverse eof
-
重启网络:
sudo systemctl restart systemd-networkd
-
更新软件包列表:在终端中运行以下命令以使更改生效:文章来源:https://www.toymoban.com/news/detail-724045.html
sudo apt-get clean && sudo apt-get upgrade && sudo apt-get update
-
测试:文章来源地址https://www.toymoban.com/news/detail-724045.html
sudo apt install -y nginx
到了这里,关于Ubuntu系统如何配置apt远程源的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!