您的位置:首页 > 其它

yum安装与配置

2016-01-20 20:23 253 查看

1. Yum的安装和配置

1.安装

应用程序的分类和组成

使用yum安装软件比rpm软件安装更能解决包之间的依赖问题

什么是yum?



由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源.

本文包括配置本地源及第三方源。第三方源包括:网易,epel,repoforge ,rpmfusion 以下为详细过程:

1.删除redhat原有的yum

rpm -aq|grep yum|xargs rpm -e --nodeps

2.下载yum安装文件

注意,如果下载时找不到文件,就登录到:http://mirrors.163.com/centos/6/os/x86_64/ 上查找相应的文件。然后再下载。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
3.进行安装yum

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-69.el6.centos.noarch.rpm

yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm

注意最后两个包必需同时安装,否则会相互依赖

----------配置网易源

4.更新repo文件

mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.repo.bak

vi /etc/yum.repos.d/rhel-debuginfo.repo

http://mirrors.163.com的 centos帮助文档 中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中

cd /etc/yum.repo.d

Centos 5 wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

Centos 6 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

其中有两个变量

$releasever $basearch

$releasever=6Server 这个在163是取不到的,(坑爹啊!)修改为6。

$basearch=x86_64 不用修改

CentOS6-Base-163.repo

Java代码

1. # CentOS-Base.repo
2. #
3. # The mirror system uses the connecting IP address of the client and the
4. # update status of each mirror to pick mirrors that are updated to and
5. # geographically close to the client. You should use this for CentOS updates
6. # unless you are manually picking other mirrors.
7. #
8. # If the mirrorlist= does not work for you, as a fall back you can try the
9. # remarked out baseurl= line instead.
10. #
11. #
12.
13. [base]
14. name=CentOS-6 - Base - 163.com
15. baseurl=http://mirrors.163.com/centos/6/os/$basearch/
16. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
17. gpgcheck=1
18. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
19.
20. #released updates
21. [updates]
22. name=CentOS-6 - Updates - 163.com
23. baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
24. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
25. gpgcheck=1
26. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
27.
28. #additional packages that may be useful
29. [extras]
30. name=CentOS-6 - Extras - 163.com
31. baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
32. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
33. gpgcheck=1
34. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
35.
36. #additional packages that extend functionality of existing packages
37. [centosplus]
38. name=CentOS-6 - Plus - 163.com
39. baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
40. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
41. gpgcheck=1
42. enabled=0
43. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
44.
45. #contrib - packages by Centos Users
46. [contrib]
47. name=CentOS-6 - Contrib - 163.com
48. baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
49. #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
50. gpgcheck=1
51. enabled=0
52. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

yum clean all 清除原有缓存

yum list 获取yum列表

安装示例

yum install xorg-x11-xauth

---------------------------------------------

可以配置yum本地源

1,挂载光盘

mount /dev/cdrom /mnt/media

2,新建本地yun源的配置文件

vi /etc/yum.repos.d/local.repo

加入以下信息:

[Local]

name=Local

baseurl=file:///mnt/media

enable=1

gpgcheck=0

Yum的默认配置文件和配置信息,一般不需要改变,保持默认配置
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: