alpine
1 2 3 4 5 6 7 8 9 10 11
| set -eux \ && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \ && apk update
set -eux \ && apk add --no-cache tzdata \ && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone \ && apk del tzdata
|
ubuntu
1 2 3 4 5 6 7 8
|
sed -i "s@http://\(archive\|security\).ubuntu.com@https://mirrors.<xxx>@g" /etc/apt/sources.list\ && apt-get clean \ && apt-get update -y
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
centos7
1 2 3 4 5 6 7 8
| yum -y install wget \ && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak \ && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \ && yum clean all \ && yum makecache
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
mirrorlist.centos.org 这个源已停用,所以当执行yum指令安装软件时可能会报错,还需要修改另外一个repo文件CentOS-SCLo-scl.repo
然后执行yum clean all && yum makecache
1 2 3 4 5 6 7 8
|
[centos-sclo-rh] name=CentOS-7 - SCLo rh baseurl=http://vault.centos.org/centos/7/sclo/$basearch/rh/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
|
centos8(目前官方源下载错误, 先下载wget行不通, 最好是将镜像源文件先下载下来,再copy到指定地方)
1 2 3 4 5
| cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak \ && wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo \ && mv CentOS-Linux-AppStream.repo CentOS-Linux-AppStream.repo.bak \ && mv CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo.bak \ && yum clean all && yum makecache
|
debian
1 2 3 4 5 6 7 8 9 10 11
| $ sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.<xxx>@g" /etc/apt/sources.list\ && apt update -y \ && apt upgrade -y
sudo apt install apt-transport-https ca-certificates
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|