yum源配置(本地镜像)

yum info xxx,
yum list,yum list xxx、yum list updates
yum search xxx, yum search all xxx,yum search all

yum install
yum remove

yum clean all
yum makecache
yum repolist all

yum 的软件群组功能 yum grouplist|groupinstall|groupremove

常用命令
[[email protected] ~]# yum search tree
[[email protected] ~]# yum list tree
[[email protected] ~]# yum info tree

[[email protected] ~]# yum install tree
[[email protected] ~]# yum remove tree

[[email protected] ~]# yum clean all
[[email protected] ~]# yum makecache
[[email protected] yum.repos.d]# yum repolist all

#国内镜像源
http://mirrors.163.com/
http://mirrors.163.com/centos/
http://mirrors.163.com/centos/5/os/x86_64/CentOS/
http://mirrors.163.com/centos/6/
http://mirrors.163.com/centos/6/os/x86_64/Packages/
http://mirrors.sohu.com/
http://ftp.twaren.net/Linux/CentOS/

http://ftp.sjtu.edu.cn/
http://ftp.sjtu.edu.cn/centos/6/
http://ftp.sjtu.edu.cn/centos/6/os/x86_64/Packages/
http://ftp.sjtu.edu.cn/centos/6/updates/x86_64/Packages/
http://ftp.sjtu.edu.cn/centos/6/extras/x86_64/Packages/
http://ftp.sjtu.edu.cn/centos/6/centosplus/x86_64/Packages/
http://ftp.riken.jp/Linux/dag/redhat/el5/en/

3、VMware虚拟机CentOS的yum在线安装配置文件
[[email protected] yum.repos.d]# cat karter_centos5.4_x64.repo
[Karter_CentOS_5.4_64bit_yum_conf]
name=Karter CentOS 5.4_64bit Soft Install By yum with Local&Internet Repository
baseurl=http://mirrors.163.com/centos/5/os/x86_64
#baseurl=http://mirrors.sohu.com/centos/5/os/x86_64/
#baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/x86_64/
gpgcheck=0
enabled=1

*特别注意***:[name]字段中不能有空格,此见鬼问题让人折腾半天。

4、VMware虚拟机CentOS的本机ISO镜像yum安装配置文件
[[email protected] yum.repos.d]# cat karter_centos5.4_x64_local.repo
[Karter_CentOS_5.4_64bit_yum_conf]
name=Karter CentOS 5.4_64bit Soft Install By yum with Local Repository
baseurl=file:///media/CentOS_5.4_Final/
gpgcheck=0
enabled=1

[email protected] ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/i386/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[[email protected] ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

挂载本地光盘镜像为yum源
mount /dev/hdc /mnt 重新绑定光盘到/mnt目录上。
进入cd /etc/yum.repos.d/目录,复制rhel-debuginfo.repo文件如为rhel5.repo后编辑
vi rhel5.repo
[server]标题也是随意起
name=随意起
baseurl=file:///mnt/server
enable=1
gpgcheck=0

或者
baseurl=file:///rhel6.5
更改为baseurl=file:///rhel6.5/Packages不行
更改为baseurl=file:///rhel6.5/Server可以
看来只要只想有repodata的上层目录即可

[[email protected] yum.repos.d]# mv packagekit-media.repo packagekit-media.repo.old
[[email protected] yum.repos.d]# cp public-yum-ol6.repo.old karter.repo
[[email protected] yum.repos.d]# ll
-rw-r--r-- 1 root root 1953 Oct 2 00:34 karter.repo
-rw-r--r-- 1 root root 196 Feb 26 2013 packagekit-media.repo.old
-rw-r--r--. 1 root root 1953 Feb 24 2013 public-yum-ol6.repo.old
[[email protected] yum.repos.d]# vi karter.repo
[[email protected] yum.repos.d]# cat karter.repo
[ol6_latest]
name=Karter Oracle Linux Soft Install Local($basearch)
baseurl=file:///media/OL6.4\ x86_64\ Disc\ 1\ 20130225/Server/
gpgcheck=0
enabled=1
[[email protected] yum.repos.d]# pwd
/etc/yum.repos.d

注意:路径名中间有空格时用\转移才行

-----------------rhel5.5使用centos的yum源----------------
[[email protected] ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-debuginfo-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://ftp.twaren.net/Linux/CentOS/5/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://ftp.twaren.net/Linux/CentOS/5/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://ftp.twaren.net/Linux/CentOS/5/addons/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[[email protected] sysconfig]# yum --help
Loaded plugins: fastestmirror, refresh-packagekit, security
Usage: yum [options] COMMAND

List of Commands:

check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package‘s dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
groupinfo Display details about a package group
groupinstall Install the packages in a group on your system
grouplist List available package groups
groupremove Remove the packages in a group from your system
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repolist Display the configured software repositories
resolvedep Determine which package provides the given dependency
search Search package details for the given string
shell Run an interactive yum shell
update Update a package or packages on your system
update-minimal Works like update, but goes to the ‘newest‘ package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.

[email protected] yum.repos.d]# pwd
/etc/yum.repos.d
[[email protected] yum.repos.d]# ll
total 28
-rw-r--r--. 1 root root 2006 Jan 1 2018 CentOS6-Base-163.repo
-rw-r--r--. 1 root root 1991 Oct 23 2014 CentOS-Base.repo.old
-rw-r--r--. 1 root root 647 Oct 23 2014 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 Oct 23 2014 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Oct 23 2014 CentOS-Media.repo
-rw-r--r--. 1 root root 5394 Oct 23 2014 CentOS-Vault.repo

[[email protected] yum.repos.d]# cat CentOS6-Base-163.repo
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[[email protected] yum.repos.d]#

[[email protected] ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[base]:代表容器的名字!中刮号一定要存在,里面的名称则可以随意取。但是不能有两个相同的容器名称, 否则 yum 会不晓得该到哪里去找容器相关软件清单文件。
name:只是说明一下这个容器的意义而已,重要性不高!
mirrorlist=:列出这个容器可以使用的映射站台,如果不想使用,可注解到这行;
baseurl=:这个最重要,因为后面接的就是容器的实际网址! mirrorlist 是由 yum 程序自行去捉映射站台, baseurl 则是指定固定的一个容器网址!我们刚刚找到的网址放到这里来啦!
enable=1:就是让这个容器被启动。如果不想启动可以使用 enable=0 喔!
gpgcheck=1:还记得 RPM 的数码签章吗?这就是指定是否需要查阅 RPM 文件内的数码签章!
gpgkey=:就是数码签章的公钥档所在位置!使用默认值即可。

RHEL5.5下配置Centos的yum源
了解决红帽没有注册导致yum不能更新的问题

1.确保RHEL5中已经安装了yum
[[email protected] ~]# rpm -qa |grep yum
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-3.2.22-26.el5
yum-security-1.1.16-13.el5
yum-rhn-plugin-0.5.4-15.el5

[[email protected] ~]# rpm -qa|grep yum
yum-3.2.22-26.el5
yum-rhn-plugin-0.5.4-15.el5
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-downloadonly-1.1.16-13.el5
yum-security-1.1.16-13.el5

2.修改源配置文件 #vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-debuginfo-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://ftp.twaren.net/Linux/CentOS/5/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://ftp.twaren.net/Linux/CentOS/5/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://ftp.twaren.net/Linux/CentOS/5/addons/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5

然后
#yum update
#yum clean all

[[email protected] yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 - Base - 163.com enabled: 6,713
centosplus CentOS-6 - Plus - 163.com disabled
contrib CentOS-6 - Contrib - 163.com disabled
extras CentOS-6 - Extras - 163.com disabled
updates CentOS-6 - Updates - 163.com disabled
repolist: 6,713

[[email protected] yum.repos.d]# pwd
/etc/yum.repos.d
[[email protected] yum.repos.d]# ll
total 8
-rw-r--r-- 1 root root 2037 Dec 14 05:01 CentOS6-Base-163.repo
drwxr-xr-x 2 root root 4096 Dec 14 05:05 old
[[email protected] yum.repos.d]# cat CentOS6-Base-163.repo

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#enabled=0

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=0

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=0

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[[email protected] yum.repos.d]#

原文地址:http://blog.51cto.com/karter/2330260

时间: 2024-12-09 14:42:17

yum源配置(本地镜像)的相关文章

CentOS 6.5本地yum源配置(断网情况下轻松安装各种依赖包)

yum能够自动查找并解决rpm包之间的依赖关系,要成功的使用yum工具更新系统和软件,需要有一个包含各种rpm软件包的repository(软件仓库),提供软件仓库的服务器习惯上成为“源”服务器.网络上有大量的源服务器,但是,由于受到网络连接速度.带宽的限制,导致软件安装耗时过长甚至失败.特别是当有大量服务器大量软件包需要升级时,更新的缓慢程序令人难以忍受. 相比较而言,本地YUM源服务器最大优点在局域网的快速网络连接和稳定性.有了局域网中的yum源服务器,即便在网络连接中断的情况下,也不会影响

在Centos6.5中配置国内网络yum源以及本地yum源

一.本地yum     1.       创建目录.挂载光盘以及安装createrepo [[email protected] ~]# mkdir/mnt/cdrom                  ←用于挂载光盘 [[email protected] ~]# mkdir-vp /yum/localrepo    ←用于存放光盘中的rpm包 mkdir: 已创建目录 "/yum" mkdir: 已创建目录 "/yum/localrepo" [[email prot

RHEL6.5服务器本地yum源配置

RHEL6.5服务器本地yum源配置 1.确保安装所需软件包 yum-3.2.29-40.el6.noarch createrepo-0.9.9-17.el6.noarch yum配置文件为/etc/yum.conf 2.挂载本地磁盘到/mnt/cdrom目录下 [[email protected] ~]#mount /dev/cdrom /mnt/cdrom 3.配置本地yum. 源配置文件以独立file.repo格式存放于/etc/yum.repos.d/目录中,如下配置本地yum源 [[e

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

redhat下本地yum源配置

LINUX一些软件安装都有依赖包,有时用rpm包要去解决依赖包问题.我们用yum来解决一些依赖包. 把光盘挂载 [[email protected] ~]# mount /dev/cdrom /mnt 安装createrepo [[email protected] ~]# cd /mnt/Server/ [[email protected] Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm 创建一个目录放yum源 [[email prote

本地yum源配置

Yum库配置:     创建本地仓库 配置环境:CentOS 5.10 作用:自动解决rpm软件包的依赖关系,并且为客户机提供软件下载源. 实现思路:创建本地软件仓库 修改配置文件 清空缓存 重新加载 实现: [[email protected] ~]#mkdir /var/centosdvd      //创建本地仓库目录 [[email protected] ~]# cd/misc/cd               //切换到挂载点 [[email protected] ~]# cp-rf

RHEL7全攻略之本地yum源配置

yum源概述 在Linux中安装软件的方式大体上包含三种:rpm安装方式.yum的安装方式.源码编译安装,其中rpm安装软件包时,对于软件包有依赖关系时不能解决以来问题,安装时候不便捷,而yum相当于是rpm的封装之后的一种安装方式,能够解决rpm包之间的依赖关系问题,能实现类似与windows中一键安装的问题:此外对于源码的安装方式来说,能够实现功能的定制,相对来说编译较难切比较难以配置,相关对比如下: 安装方式 优点 缺点 参考命令 rpm 安装单个包非常简单,不需要配置,便捷,查询功能强大

Linux 平台下 YUM 源配置 手册

Redhat/Centos 系的Linux 平台,推荐使用YUM 来安装相关依赖包. 安装方式有两种,一种是使用本地的YUM,一种使用在线的YUM. 1         在线YUM 源 如果操作系统能上网,可以直接使用yum 源. USTC,163的yum源速度都不错. 创建文件:/etc/yum.repos.d/cndba.repo 添加如下内容 #USTC 的YUM 源: [cndba.cn] name=CentOS-$releasever - Base - mirrors.ustc.edu

Centos 6.5 yum源配置总结

炎热的夏天结束了,迎来一个收获的季节! 我也该总结下自己学习成果-- 8月5日开始加入"马帮",跟马哥学习linux运维知识:我报的网络班,只能是工作之余通过视频课件来学习,不学不知道一学吓一跳,linux真的不是那么容易,哪些脚本不用说,就正则表达式就够头大的--(此处省略N个字)!言归正传,最近听完yum的配置,自己总结记录下来方便以后查看. 一.什么是yum yum是rpm的前端工具,主要为解决rpm的依赖关系而被广泛使用. 二.什么是yum源 yum源就是一部分rpm放在一起组