Yum优点
分类
本地yum源
yum仓库在本地,系统光盘/镜像文件
网络yum源
aliyun
163源
sohu源
清华源
centos源
rehat源
epel源
特定软件
nginx
mysql
zabbix
查看现有的yum仓库镜像
[root@localhost ~]# ls -l /etc/yum.repos.d/
[root@localhost ~]# tar -zcvf /etc/repos.d/bak.tar.gz /etc/yum.repos.d/*
[root@localhost ~]# rm -rf /etc/yum.repos.d/*.repo
[root@localhost ~]# ls -l /etc/yum.repos.d/
[root@localhost ~]# yum clean
已加载插件:fastestmirror
错误:清理命令需要参数:headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
[root@localhost ~]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
repolist: 0
[root@localhost ~]# yum list|grep python
光盘
删除mnt目录下的所有文件
[root@localhost ~]# rm -rf /mnt/*
[root@localhost ~]# ls /mnt/
[root@localhost ~]# lsblk
[root@localhost ~]# mount -o ro /dev/sr0 /mnt
[root@localhost ~]# ls /mnt/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
将光盘数据挂载到/mnt目录中 ,就可以在该目录中读取光盘的内容
[root@localhost ~]# lsblk
开机自动执行挂载
[root@localhost ~]# vi /etc/rc.local
或者
[root@localhost ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local
编写本地repo文件
[root@localhost ~]# vi /etc/yum.repos.d/local.repo
[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: local
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
[root@localhost ~]# man 5 yum.conf
编辑repo文件