Linuxapt-get update换源
Posted alone_yue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linuxapt-get update换源相关的知识,希望对你有一定的参考价值。
1.背景
在docker进去tomcat容器中,想要安装vim,于是使用以下shell,但是报错,于是换源。
apt-get update && apt-get install vim
2.换源
#进入tomcat容器
docker exec -it mytomcat01 bash
#记录源的文件为sources.list
cd /etc/apt
#备份原来的源文件
cp /etc/apt/sources.list /etc/apt/sources.list_backup
#command gedit not found
gedit /etc/apt/sources.list
##更换阿里源
echo "" > /etc/apt/sources.list
echo -e "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse\\n
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse\\n
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse\\n
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse\\n
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse\\n
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse\\n
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse\\n
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse\\n
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" > /etc/apt/sources.list
##更换清华源
echo "" > /etc/apt/sources.list
echo -e "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse\\n
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse\\n
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse\\n
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse\\n
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse\\n
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse\\n
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" > /etc/apt/sources.list
以上是关于Linuxapt-get update换源的主要内容,如果未能解决你的问题,请参考以下文章
Cg入门20:Fragment shader - 片段级模型动态变色(实现汽车动态换漆)
片段(Java) | 机试题+算法思路+考点+代码解析 2023
svn报错cleanup failed–previous operation has not finished; run cleanup if it was interrupted的解决办法(代码片段