准备工具:
xshell6,xftp6,到官网(https://www.netsarang.com/zh/downloading/)进行下载,教育版的,个人使用
虚拟机安装教程百度即可,安装时有两个重点:
1、安装操作系统时选择稍后安装操作系统
2、安装时默认最小化安装即可,无需调整
获取ip:
1、执行ip addr 命令,查看网卡名称(ifconfig被放弃了,没有安装,ifconfig出错是正常的)
2、修改网络配置文件,获取ip地址
执行 vi /etc/sysconfig/network-scripts/ifcfg-ens33 命令,将ONBOOT的值改为yes
保存退出后,执行systemctl restart network 重启网络
执行ip addr 命令,查看ip地址
使用xshell连接虚拟机,登录时请使用普通账号,登录完成后切换到root账号
更换yum源
1、删除订阅和注册信息:yum remove subscription-manager
2、删除rhn相关组件:yum remove rhn-check
3、卸载当前yun:rpm -qa|grep yum|xargs rpm -e --nodeps
4、下载centos的yum包
地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
下载文件:
yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
yum-updateonboot-1.1.31-52.el7.noarch.rpm
yum-utils-1.1.31-52.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-3.4.3-163.el7.centos.noarch.rpm
python-urlgrabber-3.10-9.el7.noarch.rpm
5、使用xshell工具上传刚才下载的文件到虚拟机
6、安装yum包,执行以下命令:
rpm -Uvh yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm --nodeps
rpm -Uvh yum-updateonboot-1.1.31-52.el7.noarch.rpm --nodeps
rpm -Uvh yum-utils-1.1.31-52.el7.noarch.rpm --nodeps
rpm -Uvh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm --nodeps
rpm -Uvh yum-3.4.3-163.el7.centos.noarch.rpm --nodeps
rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm --nodeps
7、更新yum源:
rm -f /etc/yum.repos.d/redhat.repo
vi /etc/yum.repos.d/CentOS-Base.repo
# 内容:
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
8、清空yum缓存和生成yum缓存:
yum clean all && yum makecache
9、验证:
执行 yun -y install tree 命令
下载正常则表示yum源更换完成
10、安装桌面
yum -y groupinstall "Server with GUI"
11、启动桌面
startx
12、卸载桌面
yum -y groupremove "Server with GUI"
本文参考一下文章:
https://www.cnblogs.com/lanyincao/p/11829486.html
https://www.cnblogs.com/gzshuke/p/8513856.html
https://www.jb51.net/os/RedHat/353857.html