配置本地yum源、网络yum源

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文件

  • 15
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值