一、配置本地yum源
1.获得一个与本机系统版本一致的系统镜像
mount /xxx/xxxxxx.iso /xxx
2.设定永久挂载
vim /etc/rc.d/rc.local
mount /xxx/xxxxxx.iso /xxx
chmod 755 /etc/rc.d/rc.local ##在系统开机时会自动执行此脚本
3.设定系统安装源指向
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/yum.repo
vim /etc/yum.repos.d/yum.repo
[rwestos]
name=westos
baseurl=file:///westos
gpgcheck=0
yum clean all
yum repolist
三、共享型yum源的部署
1.在一台已经连接好本地yum源的主机中安装httpd
yum install httpd
2.配置网络yum源
systemctl start httpd
systemctl stop firewalld
systemctl enable httpd
systemctl disable firewalld
mkdir /var/www/html/westos
测试:
在浏览器中输入地址:
http://ip/xxx
http://192.168.122.191/westos <<<此地址就是网络yum源地址
四、yum命令
yum命令的详细用法
yum clean all ##清除原有yum缓存
repolist ##列出仓库信息
install softwar ##安装
update ##更新
list software ##查看软件
list all ##查看所有软件
list installed ##列出已安装软件
list available ##列出可安装软件
reinstall software ##重新安装
remove software ##卸载
info software ##查看软件信息
search software信息 ##根据软件信息查找软件
whatprovides file ##根据文件找出包含此文件的软件
注:yum命令的使用必须是在yum源搭建成功后才能正常运行
五、用rpm命令处理软件
rpm -i ##安装
-v ##显示过程
-h ##hash加密
-e ##卸载
-q ##查看
-a ##所有
-p ##软件包
-ql ##查看软件在系统中的安装文件路径
–scripts ##查看脚本
–nodeps ##安装软件忽略软件依赖
–force ##强行安装软件
-Kv ##检测软件包是否被篡改
六、第三方软件仓库的搭建
1.把所有的rpm包放到一个目录中
2.createrepo -v /存放软件包的目录 ##命令执行成功会生成repodate目录
3.vim /etc/yum.repos.d/yum.repo
[software]
name=software
baseurl=file:///software
gpgcheck=0
yum clean all