文章目录
以下所有操作均在root用户下完成
1、查看内核版本
cat /etc/redhat-release
2、使CentOS能够上网
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
把ONBOOT改成yes
重启网关服务
service network restart
3、如果不想升级内核及系统版本进行这步,否则跳过
vi /etc/yum.conf
在 [main] 最后添加以下配置
exclude=kernel*
exclude=centos-release*
4、将CentOS7 原生 yum 源修改为阿里 yum 源
将原来的源备份
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
下载阿里云的 yum 源文件并替换本地 yum 源文件
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
这里也可以用 wget,推荐使用 curl 是因为有些最小化安装的 centos 默认不带 wget,上下两条命令选择一条即可。如果公司设置了权限只能走https,将路径中的http改成https,下文中所有路径同理
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果公司设置了权限只能走https,就把CentOS-Base.repo中带有http的路径换成https,否则可以跳过
vi /etc/yum.repos.d/CentOS-Base.repo
清理缓存
sudo yum clean all
生成新的缓存
sudo yum makecache
5、添加 epel 源(如果已有就替换,操作同上)
查看一下系统是否已有 epel
sudo rpm -qa |grep epel
如果有的话先用下面的命令卸载以前的 epel 以免受影响
sudo rpm -e epel-release
下载阿里的 epel 源
sudo wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
如果公司设置了权限只能走https,把epel-7.repo中的http换成https,否则可以跳过
vi /etc/yum.repos.d/epel-7.repo
清理缓存
sudo yum clean all
生成新的缓存
sudo yum makecache
6、更新软件和包
yum update
7、安装vitualbox增强工具
点击虚拟机菜单栏设备->安装增强功能
安装好后在命令行输入
yum install kernel-devel
yum install gcc
如果没进行update还需要安装make和kernel-headers
yum install make
yum install kernel-headers
进入增强工具光盘文件夹,此处jjy是用户文件夹
cd /run/media/jjy/VBox_GAs_6.1.16/
运行安装文件
sh ./VBoxLinuxAdditions.run
重启
reboot
配置完成