yum命令
yum clean all ##清除原有yum缓存
yum repolist ##列出yun仓库信息
yum install software ##安装软件
yum update software ##更新软件
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 groups list ##列出软件组
yum groups info ##查看软件组的信息
yum groups install softwaregroup ##安装软件组
yum groups remove softwaregroup ##卸载软件组
yum源的配置
0.让镜像被系统识别
mount rhel-server-7.3-x86_64-dvd.iso /mnt
镜像文件 挂载点
1.卸载
umount /mnt
umount /dev/loop0
2.配置本地yum源
1)获得一个与本机系统版本一致的系统镜像
2)挂载镜像(让镜像被系统识别和使用)
3)设定系统安装源指定
cd /etc/yum.repos.d/
rm -rf *
vim yum.repo ##文件名称一定以.repo结尾
[rhel7.3] #仓库描述
name=rhel7.3 server #对软件源的描述
baseurl=file:///mnt #镜像的挂载地址
gpgcheck=0 #不检测gpgkey
enabled=1 #此yum源语句块立即生效
4)测试
yum clean all #清空之前的yum源信息
yum repolist #列出yum的信息
yum install gcc -y
5)开机自动挂载
vim /etc/rc.d/rc.local
最后一行
mount 镜像的绝对位置 /mnt
在系统开机的时候回自动执行此脚本
3.共享型yum源的部署
1)在一台已经建立好本地yum源的主机中安装httpd
yum install httpd -y
2)配置网络源
systemctl stop firewalld ##关闭防火墙
systemctl disable firewalld
systemctl start httpd ##开启httpd服务
3)重新挂载yum源
创建一个目录:
mkdir /var/www/html/rhel7.2 ##Apache服务和Nginx服务所在的目录
umount /mnt ##卸载之前挂载的镜像
mount rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2 ##重新挂载镜像到该目录下
vim /etc/yum.repos.d/rhel7.2.repo ##更改yum源,更改路径为所挂载的目录
[rhel7.2]
name=rhel7.2
baseurl=file:///var/www/html/rhel7.2
gpgcheck=0
enabled=1
yum clean all
yum repolist 查看是否挂载成功
4)在客户端
cd /etc/yum.repos.d
vim yum.repo
[rhel7.2]
name=rhel7.2 server
baseurl=http://服务端ip/rhel7.2 #地址与浏览器访问相同
gpgcheck=0
enabled=1
挂载成功
##注意:要关闭防火墙
systemctl stop firewalld