Redhat6.5-- not solve yum power source normal use and configuration YUM

Virtual Machine Resources

Under generally read online, with more vm, system version chosen is Redhat6.5. Specific installation process is not to say, more online.
Share resources (redhat6.5 + vmware):
link: http://pan.baidu.com/s/1c1Vl6ms Password: gu1b

Yum function can not be used to solve

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 
  •  

If you use the yum command to install the software, the emergence of this tip, you probably need this solution.

1. Replace Package Download yum

The required documents are:

python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
  •  

Software needed by http://mirrors.163.com/centos download.
This is what I have been under good resource:
Links: http://pan.baidu.com/s/1c2HoEC4 Password: tyug

2. Uninstall native yum

#rpm -qa | grep yum | xargs rpm -e --nodeps
  •  

3. Re-install the yum

The first step is to upload the package to download xxx directory, then cd to the directory xxx directory.
Enter the following command to install one:

#rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
#rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
#rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
  •  

4. Download CentOS6-Base-163.repo file

The command wget:

#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  • mv  CentOS6-Base-163.repo  /etc/yum.repo.d
  • cd /etc/yum.repo.d
  • sed -i "s;\$releasever;6;g" CentOS6-Base-163.repo
  • mv rhel--source.repo rhel--source.repo.bak

5. Change the configuration

The CentOS6-Base-163.repo file, $ releasever replace all version of Centos. For example, my version is Redhat6.5, it will replace all of $ releasever 6.
Can be replaced with the following command:

:%s/$releasever/6/g
  •  

6. clear cache, get a list of yum

Clear the original cache:

yum clean all 
  •  

Get yum list:

yum repolist  或者  yum makecache  

YUM YUM principle before 7. Configure Sources -

What is the repo file?
in yum repo file is Fedora source (depot) configuration file, usually a repo file defines the details of the contents of one or more depots, for example, where we will need to download or install the upgrade package, set the repo files content will be read and applied yum!
YUM works is not complicated, each RPM software head (header) which will record the dependencies of the software, so if you can head down to the contents of the record and analyze the need for additional software can know each before installing What basic software installation. In other words, the first tool to analyze all the RPM files in the server above analysis, then analyze the record down, first check the record of the file as long as during the installation or upgrade, you can know all associated software. Therefore YUM basic workflow is as follows:
the server side: a server to store all of the above RPM package, and then to analyze correlation functions for each RPM file dependencies, these data records to be stored in a specific file server within the directory.
Client: If you need to install a software, first download the server above dependencies documented (by way of WWW or FTP), were analyzed by record data downloaded to the server, then get all the relevant software, all at once downloaded for installation.

YUM There are two places to store configuration files : yum.conf files under 1) / etc directory

                                                  2) xxx.repo /etc/yum.repo.d files in the directory (with repo file name suffix)

  vim /etc/yum.conf (save the file configuration information of YUM)

vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
#cachedir:yum缓存的目录,yum在此存储下载的rpm包和数据库,一般是/var/cache/yum。
debuglevel=2
#debuglevel:除错级别,0──10,默认是2 貌似只记录安装和删除记录
logfile=/var/log/yum.log
pkgpolicy=newest
#pkgpolicy: 包的策略。一共有两个选项,newest和last,这个作用是如果你设置了多个repository,而同一软件在不同的repository中同时存 在,yum应该安装哪一个,如果是newest,则yum会安装最新的那个版本。如果是last,则yum会将服务器id以字母表排序,并选择最后的那个 服务器上的软件安装。一般都是选newest。
distroverpkg=redhat-release
#指定一个软件包,yum会根据这个包判断你的发行版本,默认是redhat-release,也可以是安装的任何针对自己发行版的rpm包。
tolerant=1
#tolerent,也有1和0两个选项,表示yum是否容忍命令行发生与软件包有关的错误,比如你要安装1,2,3三个包,而其中3此前已经安装了,如果你设为1,则yum不会出现错误信息。默认是0。
exactarch=1
#exactarch,有两个选项1和0,代表是否只升级和你安装软件包cpu体系一致的包,如果设为1,则如你安装了一个i386的rpm,则yum不会用1686的包来升级。
retries=20
#retries,网络连接发生错误后的重试次数,如果设为0,则会无限重试。
obsoletes=1
gpgcheck=1
#gpgchkeck= 有1和0两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认是检查的。
reposdir=/etc/yum.repos.d #默认是 /etc/yum.repos.d/ 低下的 xx.repo后缀文件
#默认都会被include 进来 也就是说 /etc/yum.repos.d/xx.repo 无论配置文件有多少个 每个里面有多少个[name] 最后其实都被整合到 一个里面看就是了 重复的[name]后面的覆盖前面的
exclude=xxx
#exclude 排除某些软件在升级名单之外,可以用通配符,列表中各个项目要用空格隔开,这个对于安装了诸如美化包,中文补丁的朋友特别有用。
keepcache=[1 or 0]
#  设置 keepcache=1,yum 在成功安装软件包之后保留缓存的头文件 (headers) 和软件包。默认值为 keepcache=0 不保存

reposdir=[包含 .repo 文件的目录的绝对路径]
#  该选项用户指定 .repo 文件的绝对路径。.repo 文件包含软件仓库的信息 (作用与 /etc/yum.conf 文件中的 [repository] 片段相同)。

vi /etc/yum.repo.d/xx.repo (the file records where to download the package)

[serverid]
#其中serverid是用于区别各个不同的repository,必须有一个独一无二的名称。 重复了后面会覆盖前面
name=Some name for this server
#name,是对repository的描述,支持像$releasever $basearch这样的变量; name=Fedora Core $releasever - $basearch - Released Updates
baseurl=url://path/to/repository/
#baseurl是服务器设置中最重要的部分,只有设置正确,才能从上面获取软件。它的格式是:
#baseurl=url://server1/path/to/repository/
#url://server2/path/to/repository/
#url://server3/path/to/repository/
#其中url支持的协议有 http:// ftp:// file://三种。baseurl后可以跟多个url,你可以自己改为速度比较快的镜像站,但baseurl只能有一个,也就是说不能像如下格式:
#baseurl=url://server1/path/to/repository/
#baseurl=url://server2/path/to/repository/
#baseurl=url://server3/path/to/repository/
#其中url指向的目录必须是这个repository header目录的上一级,它也支持$releasever $basearch这样的变量。

#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
#上面的这一行是指定一个镜像服务器的地址列表,通常是开启的,本例中加了注释符号禁用了,我们可以试试,将$releasever和$basearch替换成自己对应的版本和架构,例如10和i386,在浏览器中打开,我们就能看到一长串镜可用的镜像服务器地址列表。

#url之后可以加上多个选项,如gpgcheck、exclude、failovermethod等,比如:
#
#gpgcheck=1
#exclude=gaim
#其中gpgcheck,exclude的含义和[main]部分相同,但只对此服务器起作用,
#failovermethod=priority
#failovermethode 有两个选项roundrobin和priority,意思分别是有多个url可供选择时,yum选择的次序,roundrobin是随机选择,如果连接失 败则使用下一个,依次循环,priority则根据url的次序从第一个开始。如果不指明,默认是roundrobin。

enabled=[1 or 0]
#当某个软件仓库被配置成 enabled=0 时,yum 在安装或升级软件包时不会将该仓库做为软件包提供源。使用这个选项,可以启用或禁用软件仓库。
#通过 yum 的 --enablerepo=[repo_name] 和 --disablerepo=[repo_name] 选项,或者通过 PackageKit 的"添加/删除软件"工具,也能够方便地启用和禁用指定的软件仓库

#几个变量
#$releasever,发行版的版本,从[main]部分的distroverpkg获取,如果没有,则根据redhat-release包进行判断。
#$arch,cpu体系,如i686,athlon等
#$basearch,cpu的基本体系组,如i686和athlon同属i386,alpha和alphaev6同属alpha。
#对yum.conf设定完成,我们就可以好好体验yum带来的方便了。

For example: Set  http://mirrors.163.com/centos/7/os/x86_64/ to source YUM
 

[163]
name=163
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1

8. The local source configuration

8.1 ISO will mount the CD-ROM

8.2 Create a folder to mount ISO
 

 mkdir /mnt/cdrom 
 # 执行挂载  
 mount -o loop /dev/cdrom /mnt/cdrom

8.3 Create a new local source file and edit 

cd /etc/yum.repos.d8.3 
vi local.repo 
# 添加如下代码: 
[local]
name=local
baseurl=file:///mnt/cdrom #(这里既是3个/,没写错) 
gpgcheck=0
enabled=1

9. source arranged 163yum

[163]
name=163
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1

 

Published 35 original articles · won praise 61 · views 160 000 +

Guess you like

Origin blog.csdn.net/woailyoo0000/article/details/80011251