这里是VM安装centos系统,安装过程比较简单,就不描写了。主要是安装之后需要做的事情>>>
- 更换yum源
- 更新系统以及软件
1、 更换yum源(以下命令都是在root权限下执行)
备份yum源:
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
检查是否安装wget:
wget --version
显示:
则说明已安装。
若显示没有命令,安装:
yum install -y wget
完成即可~
打开阿里镜像:https://developer.aliyun.com/mirror/
可以查看可用的yum源:
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
centos 6:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
centos 7:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或者:
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
centos 8:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
或者:
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
这里可能会出现报错:
可以这样解决:
首先ifconfig
查看是否联网
若联网还是报错:
执行:
vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 223.5.5.5
nameserver 223.6.6.6
这里不需要全部粘进去,可以选择前两个或者另外两个~
修改完还是报错
这里可以重启网络:
service network restart
若不行的话,修改:
应该就能解决了~
(若还不行,啊这,我也不知道了)
成功后是这样子:
清理缓存:
yum clean all
(注意:是clean
不是clear
)
生成新的缓存:
yum makechach
等跑完就OK了~
2、更新软件及系统
更新软件:
yum upgrade
更新系统及内核:
yum -y update
未完待续~~
<小白初试>