Note/环境/CentOS 国内镜像源 x86_64.md

92 lines
2.3 KiB
Markdown
Raw Normal View History

2024-06-26 15:27:17 +08:00
## 图形化安装设置
2024-01-12 10:13:34 +08:00
2024-06-26 15:27:17 +08:00
我们将安装源(软件源)配置为阿里的:
协议选择为`http://`
路径是`mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/`
URL类型是`软件库URL`
注意上面的阿里路径最后要记得加上一个斜杠`/`
https://mirrors.aliyun.com/centos/7/os/x86_64/
## CentOS 7 x86_64
2024-01-12 10:13:34 +08:00
```shell
2024-06-26 15:27:17 +08:00
CentOS 7 x86_64
2024-01-12 10:13:34 +08:00
//进入root切换至yum.repos.d目录
cd /etc/yum.repos.d/
//创建新文件夹并将源文件备份为repo.bak
mkdir backup && mv *repo backup/
//下载国内yum源文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
//163
##wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
//生成缓存
yum clean all && yum makecache
```
2024-06-26 15:27:17 +08:00
## CentOS Stream 8 x86_64
2024-01-12 10:13:34 +08:00
````shell
2024-06-26 15:27:17 +08:00
CentOS Stream 8 x86_64
2024-01-12 10:13:34 +08:00
//进入root切换至yum.repos.d目录
cd /etc/yum.repos.d/
//创建新文件夹并将源文件备份为repo.bak
mkdir backup && mv *repo backup/
//下载国内yum源文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
//更新下载yum源地址
sed -i -e"s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
//生成缓存
yum clean all && yum makecache
````
2024-06-26 15:27:17 +08:00
## CentOS Stream 9 x86_64
2024-01-12 10:13:34 +08:00
```shell
2024-06-26 15:27:17 +08:00
CentOS Stream 9 x86_64
2024-01-12 10:13:34 +08:00
//进入root切换至yum.repos.d目录
cd /etc/yum.repos.d/
//创建新文件夹并将源文件备份为repo.bak
mkdir backup && mv *repo backup/
//下载国内yum源文件
sed -i 's|metalink|#metalink|g' /etc/yum.repos.d/*.repo
sed -i '/name=CentOS Stream $releasever - BaseOS/a baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/' /etc/yum.repos.d/*.repo
sed -i '/name=CentOS Stream $releasever - AppStream/a baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/' /etc/yum.repos.d/*.repo
sed -i '/name=CentOS Stream $releasever - Extras packages/a baseurl=https://mirrors.aliyun.com/centos-stream/SIGs/$stream/extras/$basearch/extras-common/' /etc/yum.repos.d/*.repo
//生成缓存
yum clean all && yum makecache
```
2024-06-26 15:27:17 +08:00
## 时间设置
```shell
# 在设置中国时区使用亚洲/上海(+8
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 查看时间和日期
date
```