下载一个镜像,建立一个目录,然后挂载镜像到该目录下。 输入mount命令可进行查看。 编写系统中的资源指向文件,文件必须在 /etc/yum.repos.d/ 中,且编写的文件必须以 xx.repo 结尾。
yum命令的使用必须是在yum源搭建成功后才能正常运行。
yum clean all ##清除原有的yum缓存 yum repolist ##列出仓库信息 yum install software ##安装软件 yum update ##更新 yum list software ##查看软件的详细信息 yum list all ##列出所有软件 yum list installed ##列出已经安装的软件 yum list available ##列出可以安装的软件 yum reinstall software ##重新安装 当软件中某一文件坏损可使用重新安装 yum remove software ##删除软件 yum info software ##查看指定软件的信息 yum search software ##根据软件信息查找软件 yum whatprovides file ##根据文件找出包含次文件的软件 yum history ##查看系统中软件的管理信息( 删除 重装 更新 安装) yum history info 数字 ##当该数字对应某软件管理信息的ip 则此条命令显示对该软件管理的详细信息 yum gruops list ##列出软件组 yum groups info ##查看软件组的信息 yum groups install sfgroup ##安装软件组 后跟软件组名 yum groups remove sfgroup ##卸载软件组
共享型yum源的部署
1 在一台已经配置好本地yum源的主机中安装httpd.x86_64 yum install httpd 2 配置网络yum源 systemctl install httpd ##安装 systemctl stop firewalld ##关火墙 systemctl enable httpd ##开启 systemctl disable firewalld ##火墙永久关闭 mkdir /var/www/html/westos ##建立一个挂载点 mount /xxxx/xxxxx.iso /var/html/westos ##挂载 测试: vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=none IPADDR=172.25.254.109 NETMASK=255.255.255.0 vim /etc/yum.repos.d/westos.repo [rhel7.3] name=rhel7.3 baseurl=http://172.25.254.109/rhel7.3 gpgcheck=0 yum install dhcp -y 注:以上是临时挂载。 永久挂载: vim /etc/yum.repos.d/westos.repo [westos] name=westos baseurl=file:///var/www/html/rhel7.3 gpgcheck=0 vim /etc/rc.d/rc.local ##开机自运行脚本 mount /iso/rhel-server-7.3-x86_64-dvd.iso /var/www/html/rhel7.3/ chmod +x /etc/rc.d/rc.local