Alpine
1 2 3 4 5 6 7 8 9 10
| 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
|
CentOS 7
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。
修改 CentOS-SCLo-scl.repo 文件:
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
|
CentOS 8
注意:目前官方源下载错误,先下载 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 12 13 14 15 16
|
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
|