由于单位的服务器均使用的是内网,而安装一些软件如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 16
-rw-r--r--. 1 root root 1926 Feb 25  2013 CentOS-Base.repo
-rw-r--r--. 1 root root  638 Feb 25  2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  630 Feb 25  2013 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Feb 25  2013 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-6.  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.1-3.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-libs.x86_64                   0.4.1-3.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
MAKEDEV.x86_64                           3.24-6.el6                           @anaconda-CentOS-201303020151.x86_64/6.4
MySQL-python.x86_64                      1.2.3-0.3.c1.1.el6                   @anaconda-CentOS-201303020151.x86_64/6.4
PyGreSQL.x86_64                          3.8.1-2.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
SDL.x86_64                               1.2.14-3.el6                         @anaconda-CentOS-201303020151.x86_64/6.4
TurboGears2.noarch                       2.0.3-4.el6                          @anaconda-CentOS-201303020151.x86_64/6.4
abrt.x86_64                              2.0.8-15.el6.centos                  @anaconda-CentOS-201303020151.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.9-17.el6.noarch.rpm
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:python-deltarpm is needed by createrepo-0.9.9-17.el6.noarch

以上提示安装失败,需要安装依赖包:python-deltarpm

[root@sl localserver]# rpm -ivh createrepo-0.9.9-17.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.9-17.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]1:deltarpm               ########################################### [ 33%]2:python-deltarpm        ########################################### [ 67%]3:createrepo             ########################################### [100%]

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-6.  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=1             #检查GPG-KEY,0为不检查,1为检查
enabled=1             #是否用该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     00:00 ...
local/filelists_db                                                                              | 3.9 MB     00:00 ...
local/other_db                                                                                  | 1.7 MB     00:00 ...
Metadata Cache Created

转载于:https://www.cnblogs.com/shenliang123/p/3829044.html

Centos6.4 本地yum源配置相关推荐

  1. CentOS 6.5 本地yum源配置

    CentOS 6.5 本地yum源配置 由于多数服务器均使用内网,而安装一些软件如Git,需要很多的依赖包,使用yum安装相对简单,由于不能联网故配置本地yum源. 1.将rpm库添加到系统中 虚拟机 ...

  2. red6.4 mysql_rhel6.4 yum本地yum源配置

    rhel6.4 yum本地yum源配置        在安装rpm包时,总是会碰到关联的包,在安装过程中带来很多麻烦,配置yum源,自关联包安装,简单省事.配置步骤:1:mount -o loop 挂 ...

  3. Linux(redhat7.2)本地yum源配置

    本地yum源配置 由于特殊原因,有的时候我们的Linux系统无法连接网络,这种时候软件的安装更新等就成了一个问题,但其实安装Linux系统的光盘映像中有许多我们需要用到的软件,利用本地的光盘映像作为y ...

  4. Centos 本地yum源配置以及扩展源

    Centos 本地yum源配置以及扩展源 提示:有任何问题可以私信我,下班看到第一时间回复 yum本地源 Centos 本地yum源配置以及扩展源 一.将光盘挂载到/mnt下面 二.删除系统本身自带的 ...

  5. linux搭建本地YUM源配置详细步骤

    1.1. 为什么要制作本地YUM源 YUM在Linux上使用源码的方式安装软件非常麻烦,使用yum可以简化安装的过程. 1.2. YUM源的原理 YUM源其实就是一个保存了多个RPM包的服务器,可以通 ...

  6. Linux本地yum源配置以及使用yum源安装gcc编译环境

    本文档是图文安装本地yum源的教程,以安装gcc编译环境为例. 适用范围:所有的cetos,红帽,fedroa版本 适用人群:有一点linux基础的小白 范例系统版本:CentOS Linux rel ...

  7. Linux本地yum源配置以及使用yum源安装各种应用程序

    将软件包传送到Linux中后,挂载,然后配置yum软件仓库,最后就可以使用yum来安装相应的应用程序了.假设挂载目录为/tmp/ruanjianbao,则下面说明配置本地yum仓库的过程: (1)cd ...

  8. RHEL7 本地yum源配置

    配置yum 源 1.挂载DVD光盘到/mnt   因为配置时候路径名里面不能有空格,否则不能识别  [root@ mnt]# mount /dev/cdrom /mnt 2.在目录/etc/yum.r ...

  9. centos7本地yum源配置

    第一步,登录root账户,在centos7虚拟机上挂载本地光盘-先创建挂载点目录, 第二步,我的本地光盘在/dev/sr0中,现在挂载本地光盘 第三步,查看这个磁盘的挂载情况确认一下本地光盘是否已经成 ...

最新文章

  1. Linux C编程之二:Linux基础
  2. 15行代码AC——1019 数字黑洞 (20分) 甲级1069. The Black Hole of Numbers (20)(解题报告)
  3. Pycharm使用matplotlib绘图时无法显示中文问题
  4. Zookeeper3.6.1常用的Shell命令
  5. 【python】面向对象的封装、继承、多态的练习题
  6. android 测量字体宽高,Android中测量Text的宽度和高度
  7. etcd v3 php,Etcd clientV3 使用TLS证书存取KV
  8. Team Viewer 远程链接一直显示-正在初始化显示参数
  9. linux psftp,使用PSFTP实现Windows、Linux之间的文件传输
  10. 计算机成绩数字代表什么意思,注册电气工程师成绩的数字具体代表着什么意思...
  11. iPhone5捣鼓mobile terminal
  12. CTR预估:计算广告的应用(1)——理论
  13. 京东客服岗位人才考试
  14. 今日头条阅读量怎么刷_今日头条推广 今日头条阅读量怎么刷
  15. 用html写树干的形状,HTML5使用纯CSS3构建的树枝和树叶
  16. eclipse的32位和64位版本(亲测有效)
  17. Java:冒泡排序法
  18. C语言中void具体有什么作用
  19. 百度地图的植入流程介绍
  20. STM32F103RCT6 实验代码之舵机+超声波避障小车(一)杂谈+电机+L298N

热门文章

  1. sql 插入text字段包含特殊字符_Kettle(PDI)转换中输出之插入/更新详解
  2. VS2010报错 error:LINK1123:转换到COF期间失败,文件无限或损坏
  3. error: ‘CV_BGR2RGB’ was not declared in this scope
  4. 图形学 射线相交算法_计算机图形学中的阴极射线管
  5. dbms数据库管理系统_基本数据库管理系统(DBMS)能力问题和解答
  6. 江西理工大学期末试卷c语言,2016年江西理工大学信息工程学院计算机应用技术(加试)之C语言程序设计复试笔试最后押题五套卷...
  7. 串口接收中断配置过程---STM32F4--HAL
  8. mixin network_【译文】Mixin——以最高的安全性满足所有区块链资产的交易需求
  9. C/C++构造及析构顺序及变量的生命周期
  10. 链表题目---6 复制带随机指针的链表