groups remove softwaregroupname 卸载组
2.配置本地yum源
搞一个和系统匹配的镜像文件到系统中
mkdir /iso
mv /home/kiosk/Desktop/*.iso /iso 防止放在桌面上被删除
mkdir /rhel7.0 /rhel7.2
挂载镜像:
mount /iso/rhel-server-7.0-x86_64-dvd.iso /rhel7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.2
配置yum文件
cd /etc/yum.repos.d/
mkdir /repobackup
mv * /repobackup
vim yum.repo
[source7.2]
name=rhel7.2
baseurl=file:///rhel7.2 挂载路径
gpgcheck=0 0(可以下载第三方软件)1(不可以安装第三方软件)
yum clean all 清空yum缓存并重新启动
3.共享yum源
1.在本地yum源配置完成之后安装apache
yum install httpd
systemctl start httpd
systemctl enable httpd
systemctl stop firewalld
systemctl disable firewalld
mkdir /var/www/html/rhel7.0 /var/www/html/rhel7.2
2.挂载镜像:
mount /iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2
3.测试访问:
在浏览器中输入地址
http://ip/rhel7.0
http://172.25.254.7/rhel7.0
两个镜像挂载并共享成功
4.配置虚拟机yum
rm -fr /etc/yum.repos.d/*
vim /etc/yum.repos.d/yum.repo
[rhel7.0]
name=rhel7.0
baseurl=http://172.25.254.10/rhel7.0
gpgcheck=0
yum命令可以在虚拟机中运行,则共享成功。
umount /var/www/html/rhel7.0 卸载挂载后的镜像
以上所有挂载为临时挂载reboot后会消失
为了方便,不至于每次开机挂在镜像,所以进行开机自动挂载:
vim /etc/rc.d/rc.local
mount /iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2
mount /iso/rhel-server-7.0-x86_64-dvd.iso /rhel7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.2
chmod +x /etc/rc.d/rc.local 给此文件一个执行权限,以便于开机可以对其进行执行操作。