yum源更换为本地光盘
下面来示范一下如何使用光盘文件配置yum库。注意:一定要把/etc/yum.repos.d里的其他文件移到其他地方,否则会报错
进入到/etc/yum.repos.d目录中后创建Yum配置文件:
[root@linuxprobe ~]# cd /etc/yum.repos.d/
[root@linuxprobe yum.repos.d]# vim rhel7.repo
[rhel7]
name=rhel7
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
[root@linuxprobe yum.repos.d]# mkdir -p /media/cdrom
[root@linuxprobe yum.repos.d]# mount /dev/cdrom /media/cdrom //挂载
mount: /dev/sr0 is write-protected, mounting read-only
[root@linuxprobe yum.repos.d]# vim /etc/fstab //开机自动挂载
/dev/cdrom /media/cdrom iso9660 defaults 0 0
配置好之后,可以使用yum list查看是否配置成功,如果配置成功会显示一堆可用的安装包。如果有报错的话,可以试着把除了这个配置文件外的其他配置文件全部删除(因为其他文件可能都是需要联网的,一旦连不了网,yum list 好像就会异常中断了)
下面这些是关于yum配置文件的介绍,有兴趣可以看一下
yum主配置文件
[root@bogon ~]# cat /etc/yum.conf
[main] //所有仓库公共的配置
cachedir=/var/cache/yum/$basearch/$releasever //缓存目录
keepcache=0 //程序包在安装完成后不再保存至缓存中
debuglevel=2 // 程序安装时的输出信息,数字越大输出信息越多。生产环境中关闭最好,但是开启可以让我们快速定位安装中出现问题的所在
logfile=/var/log/yum.log //日志路径
exactarch=1 //安装程序的版本和当前平台保持一致
obsoletes=1 //检查包已被废弃
gpgcheck=1 //检查源合法性和包的完整性
plugins=1 //支持插件
installonly_limit=5 //每次安装包的数量限制为5个
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum //bug追踪的路径
distroverpkg=centos-release //判断当前系统信息
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root@bogon ~]#
各配置文件
[root@bogon ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@bogon ~]# cat /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0 //此仓库不被使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@bogon ~]#
[root@bogon ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@bogon ~]#
yum -y install httpd 自动确认安装httpd
yum list //列出全部程序包
yum源更换为本地光盘的更多相关文章
- 超简单将Centos的yum源更换为国内的阿里云源
自己的yum源不知道什么时候给改毁了……搜到了个超简单的方法将yum源更换为阿里的源 完全参考 http://mirrors.aliyun.com/help/centos?spm=5176.bbsr1 ...
- CentOS7 中把默认yum源更换成163源
163源是目前国内最好用的源,速度是相当快的,现在我们把CentOS7中的源改为163源 1.进入yum源配置文件 cd /etc/yum.repos.d 2.备份一下当前的源,以防出错后可以还原回来 ...
- 【转载】将Centos的yum源更换为国内的阿里云源
自己的yum源不知道什么时候给改毁了--搜到了个超简单的方法将yum源更换为阿里的源 完全参考 http://mirrors.aliyun.com/help/centos?spm=5176.bbsr1 ...
- centos下将系统预置yum源更换为阿里云源
参考:http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD 步骤1:备份/etc/yum.repos.d/下的Cen ...
- linux替换yum源及配置本地源
linux系统安装后自带的bash源由于在国外,安装软件包的时候会非常慢,最好替换一下yum源. 关于yum源的简单介绍 yum的主要功能是更方便地添加,删除和更新rpmba ...
- VMware Linux虚拟机yum源更换成国内阿里源
[虚拟机系统] Centos 6.8 阿里源:https://opsx.alibaba.com/mirror 网易源:http://mirrors.163.com/ 更换yum源时请保证虚拟机和外网是 ...
- centos7 阿里云yum源更换
个人比较喜欢阿里云yum源,同时使用centos7 首先 cd /etc/yum.repos.d/ wget -O /etc/yum.repos.d/CentOS-Base.repo http://m ...
- 将Centos的yum源更换为国内的阿里云源
阿里云是最近新出的一个镜像源.得益于阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源.阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ CentOS系统更换软 ...
- 将Centos的yum源更换为阿里云源
阿里云Linux安装软件镜像源 阿里云是最近新出的一个镜像源.得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源.阿里云Linux安装镜像源地址:http://mirrors.aliyun. ...
随机推荐
- 类型重命名 typedef
所谓数据重命名就是给数据类型起一个新的名字,比如int 这个数据类型,可以给他起一个新的名字叫 my int.他俩的用法.特点.属性等是一模一样,仅仅名字不同而已. 作用:1,增加代码的可读性.2,让 ...
- 如何在ubuntu上搭建hustoj?
1.安装MySQL apt-get install mysql-server mysql-client 安装的过程会弹出一个框,输入sql密码,按TAB切换到ok 2.安装apache2 apt-ge ...
- shiro简单学习的简单总结
权限和我有很大渊源. 培训时候的最后一个项目是OA,权限那块却不知如何入手,最后以不是我写的那个模块应付面试. 最开始的是使用session装载用户登录信息,使用简单权限拦截器做到权限控制,利用资源文 ...
- vs2017 乱码
vs2017默认编码方式并不是UTF-8,似乎是UTF-16,当我们使用中文时,经常会发生乱码. 解决方法:工具->扩展和更新->联机,然后搜索ForceUTF8 我这里已经安装了,没安装 ...
- shell脚本实例-判断主机存活 以及企业备份方案
1.上次写了一个脚本我那次考虑不是很周全,这次我将脚本改动了一下,这次是判断三次, 希望关注我的人可以经常交流哈.下面我写上代码. #!/usr/bin/bash while read ip do f ...
- Java学习笔记8(面向对象3:接口)
接口的概念: 接口是功能的集合,同样可以看最做事一种数据类型,是比抽象类更为抽象的"类”. 接口之描述所应该具备的方法,并没有具体实现,具体的实现有接口的实现类(相当于接口的子类)来完成.这 ...
- 绕过Snoopy的记录功能
不讲原理,感兴趣请看http://blog.rchapman.org/posts/Bypassing_snoopy_logging/,这个只适合老版本内核的Linux 查看是否有snoopy加载了 l ...
- 使用scrapy爬取dota2贴吧数据并进行分析
一直好奇贴吧里的小伙伴们在过去的时间里说的最多的词是什么,那我们就来抓取分析一下贴吧发文的标题内容,并提取分析一下,看看吧友们在说些什么. 首先我们使用scrapy对所有贴吧文章的标题进行抓取 scr ...
- HTTPS双向认证+USB硬件加密锁(加密狗)配置
环境: Ubuntu14.04,apache2.4.7, openssl1.0.1f 安装apache2 apt-get install apache2 -y 一般openssl默认已经安装 开启a ...
- posix信号量与互斥锁
1.简介 POSIX信号量是一个sem_t 类型的变量,但POSIX 有两种信号量的实现机制:无名信号量和命名信号量.无名信号量可以用在共享内存的情况下, 比如实现进程中各个线程之间的互斥和同步.命名 ...