Centos6.4 本地yum源配置
由于单位的服务器均使用的是内网,而安装一些软件如Git,需要很多的依赖包,使用yum安装相对简单,由于不能联网故配置本地yum源配置。
1.首先将需要rpm库添加到系统中:
1).虚拟机中安装的linux操作系统:则只需将安装包ISO文件挂载到media下面(如无法挂载请参考http://www.cnblogs.com/shenliang123/p/3203278.html)
2).单独的服务器系统,则先在/media下新建centos(名字可以自定义,但与下面4中添加的目录相关),然后将ISO包里面的内容全部复制到该文件夹中
2.进入到 /etc/yum.repos.d/ ,该目录下包含了四个文件:
[root@sl media]# ls -l /etc/yum.repos.d/
total
-rw-r--r--. root root Feb CentOS-Base.repo
-rw-r--r--. root root Feb CentOS-Debuginfo.repo
-rw-r--r--. root root Feb CentOS-Media.repo
-rw-r--r--. root root Feb CentOS-Vault.repo
3.将 CentOS-Base.repo和CentOS-Debuginfo.repo两个文件改名,绕过网络安装:
[root@sl yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repose_bak
[root@sl yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo_bak
4.编辑文件CentOS-Media.repo:(也可以自己新增一个repo文件,more用于查看,使用vi进行编辑)
[root@sl yum.repos.d]# more CentOS-Media.repo #repo后缀
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-. 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=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command] [c6-media] #库名称
name=CentOS-$releasever - Media #名称描述
baseurl=file:///media/centos/ #yum源目录,源地址
gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查
enabled=1 #是否用该yum源,0为禁用,1为使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #gpgcheck=0时无需配置
5.测试yum是否配置成功:
[root@sl yum.repos.d]# yum list
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Installed Packages
ConsoleKit.x86_64 0.4.-.el6 @anaconda-CentOS-.x86_64/6.4
ConsoleKit-libs.x86_64 0.4.-.el6 @anaconda-CentOS-.x86_64/6.4
MAKEDEV.x86_64 3.24-.el6 @anaconda-CentOS-.x86_64/6.4
MySQL-python.x86_64 1.2.-0.3.c1..el6 @anaconda-CentOS-.x86_64/6.4
PyGreSQL.x86_64 3.8.-.el6 @anaconda-CentOS-.x86_64/6.4
SDL.x86_64 1.2.-.el6 @anaconda-CentOS-.x86_64/6.4
TurboGears2.noarch 2.0.-.el6 @anaconda-CentOS-.x86_64/6.4
abrt.x86_64 2.0.-.el6.centos @anaconda-CentOS-.x86_
more.........
6.清除yum缓存:
[root@sl yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos:
Cleaning up Everything
Cleaning up list of fastest mirrors
可能由于没有使用光驱的缘故,以上设置后安装一直报nothing to do,所以选了另外一种方法重新安装:
1.将yum源放到/opt目录下,并复制系统安装包下的packages文件夹中所有的repo文件
[root@sl opt]# mkdir yumserver
[root@sl opt]# cp -rv /media/centos/Packages/* /opt/yumserver/
2.安装createrepo命令
[root@sl opt]# cd localserver/
[root@sl localserver]# rpm -ivh createrepo-0.9.-.el6.noarch.rpm
warning: createrepo-0.9.-.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
python-deltarpm is needed by createrepo-0.9.-.el6.noarch
以上提示安装失败,需要安装依赖包:python-deltarpm
[root@sl localserver]# rpm -ivh createrepo-0.9.-.el6.noarch.rpm python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: createrepo-0.9.-.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [%]
:deltarpm ########################################### [ %]
:python-deltarpm ########################################### [ %]
:createrepo ########################################### [%]
createrepo安装成功
3.利用createrepo创建yum仓库,创建索引信息(需要等待一段时间)
[root@sl localserver]# createrepo -v ./
4.配置文件,将/etc/yum.repos.d/下现存文件都删除或重命名.bak,然后新建一个local.repo文件,并添加相应内容:
[root@sl yum.repos.d]# touch local.repo
[root@sl yum.repos.d]# vi local.repo #repo后缀
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-. 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=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command] [local] #库名称
name=CentOS-local #名称描述
baseurl=file:///opt/localserver/ #yum源目录,源地址
gpgcheck= #检查GPG-KEY,0为不检查,1为检查
enabled= #是否用该yum源,0为禁用,1为使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #gpgcheck=0时无需配置
5.安装成功后,测试:
[root@sl yum.repos.d]# yum clean all #清除缓存
Loaded plugins: fastestmirror, security
Cleaning repos:
Cleaning up Everything
Cleaning up list of fastest mirrors [root@sl yum.repos.d]# yum makecache #重新建立缓存
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
local | 2.9 kB : ...
local/filelists_db | 3.9 MB : ...
local/other_db | 1.7 MB : ...
Metadata Cache Created
Centos6.4 本地yum源配置的更多相关文章
- CentOS6.5本地yum源配置
1. 建立本地源目录及挂载临时目录 2. 挂载光盘 3. 进入/etc/yum.repos.d/目录,将 CentOS-Base.repo CentOS-Debuginfo.repo CentOS-V ...
- centos6.7 本地yum源配置
[BEGIN] 2016/11/9 21:47:31[root@11g ~]# mount /dev/cdrom /mediamount: block device /dev/sr0 is write ...
- RedHat和CentOS使用本地yum源配置
2013-04-01 11:38:30 标签:本地yum源 版权声明:原创作品,谢绝转载!否则将追究法律责任. 使用yum命令安装所需的软件,如果设备网络状况很好,当然也没必要去配置本地yum源,直接 ...
- CentOS7利用本地yum源配置NBD
一:CentOS7.0创建本地YUM源 (物理机:直接将刻录的CentOS7光盘利用光驱插入物理机上) (虚拟机: CD/DVD>>连接本地ISO) 针对物理机192.168.9.112进 ...
- CENTOS 6-7的本地YUM源配置
本文档适合CENTOS 6-7的本地YUM源配置 cd /media cd CentOS_6.8_Final/ cd Packages 创建目录拷贝文件 mkdir /yum cp * /yum 配置 ...
- CentOS本地yum源配置
现有一台处在局域网的linux服务器,无法ping通外网,本文是关于本地yum源的配置 环境 : CentOS 6.5 一 .挂载CentOS镜像文件 (1) 创建挂载文件夹,若此文件夹已存在可忽略 ...
- 企业级本地yum源配置方案详解
因目前企业生产网络禁止联网,对于使用Linux的我们来说,非常不方便,想要使用yum源都很困难,挂dvd又不能完全满足要求,所以自建一个企业级的yum源,定时从公网同步到本地,然后生产网络直接配置在本 ...
- CentOS 6.x 本地yum源配置与使用
系统默认已经安装了可使用yum的软件包,所以可以直接配置: # mount /dev/cdrom /mnt 挂载镜像,可以写到配置文件 ...
- Linux本地yum源配置以及使用yum源安装gcc编译环境
本文档是图文安装本地yum源的教程,以安装gcc编译环境为例. 适用范围:所有的cetos,红帽,fedroa版本 适用人群:有一点linux基础的小白 范例系统版本:CentOS Linux rel ...
随机推荐
- js事件浅析
js中关于DOM的操作很多,因此js事件机制也就尤为重要. 事件绑定形式: 一. 内联形式 耦合度高,不利于维护 <button onclick="alert('你点击了这个按钮'); ...
- SharePoint 2013 自定义扩展菜单(二)
接博文<SharePoint 2013 自定义扩展菜单>,多加了几个例子,方便大家理解. 例七 列表设置菜单扩展(listedit.aspx) 扩展效果 XML描述 <CustomA ...
- SharePoint 2013 用IE11在线打开Word文档报错
问题: 测试结果: ie11会报错,ie10和以下版本不会报错,chrom不会报错. jindahao
- Alvin
Alvin Zhao 東京都 港区虎ノ門2-10-4 ホテルオークラ東京 M 663 電話番号: 0335820111
- Android-配置文件中设置“android:clickable="false"无效的原因及解决办法
开发中遇到的问题:要实现一个button初始为不可点击,于是在配置文件中设置了android:clickable="false"运行后发现还是可以点击,于是写在了Activity中 ...
- iOS之UIScrollView循环滚动
#import "ViewController.h" #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width #d ...
- [转]Design Pattern Interview Questions - Part 2
Interpeter , Iterator , Mediator , Memento and Observer design patterns. (I) what is Interpreter pat ...
- ERROR ITMS-90682: Invalid Bundle - The asset catalog at 'Payload/XXXXX/Assets.car' can't contain 16-bit or P3 assets if the app supports iOS 9.3 or earlier.
刚升级Xcode 8, 幺蛾子又出现了.提交的时候出了这个问题. BTW,感谢google.以下为解决方案:‘ 在 Xcode 8 中,当你资源文件中[含有16位图]或者[图片显示模式γ值为'P3'] ...
- log4j配置
log4j.rootCategory=DEBUG , R, D,stdout # Console log4j.appender.stdout=org.apache.log4j.ConsoleAppen ...
- OC NSFileHandle(文件内容操作)
OC NSFileHandle(文件内容操作) 初始化 [NSFileHandle fileHandleForUpdatingAtPath:@"data.txt"]; //file ...