一、yum相关介绍及命令
用来管理软件的一个命令。通过该命令完成对软件的下载、卸载等操作。
二、使用yum命令安装软件
使用本地yum源安装软件(真实主机):
1.获得一个与本机系统版本一致的系统镜像 (本机为红帽7.2版本,所以对应的镜像也是7.2)
2.挂载镜像
临时挂载: mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.0/ 第二个参数为镜像路径,第三个为挂载的目录(自己创建的)
永久挂载:(rc.local脚本在开机的时候会自动执行)
vim /etc/rc.d/rc.local
mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.0/
chmod 755 /etc/rc.d/rc.local 设置脚本权限
3.设定系统安装源指向
vim /etc/yum.repos.d/yum.repo ##名称yum.repo为自己命名,但后缀名不变
[rhel7.2]
name=rhel7.2
baseurl=file:///rhel7.2 ##file代表从本机下安装 ;http://表示从网络下安装
gpgcheck=0
yum clean all
4.检测是否可以安装 yum install httpd -y
三、共享yum源的搭建
步骤:httpd服务:用来共享特定的目录。
【1】在一台已经链接好本地yum源的主机中安装httpd服务
命令: yum install httpd
【2】在主机中配置网络yum源
systemctl start httpd
systemctl stop firewalld
systemctl enable httpd
systemctl disable firewalld
mkdir /var/www/html/rhel7.2 ##自己建的一个目录,作为镜像的挂载目录
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2/ ##临时挂载
vim /etc/rc.d/rc.local ##永久挂载
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2/
【3】测试: 在浏览器中输入
http://主机ip//rhel7.2 出现以下结果设置成功