CentOS yum配置
一、yum 安装
CentOS 默认已经安装了yum,不需要另外安装,这里为了实验目的,先将yum 卸载再重新安装。
1、查看系统默认安装的yum
# rpm -qa|grep yum

2、卸载yum
# rpm -e yum-fastestmirror-1.1.16-14.el5.centos.1 yum-metadata-parser-1.1.2-3.el5.centos yum-3.2.22-33.el5.centos
3、重新安装yum
这里可以通过wget 从网上下载相关包安装,也可以挂载系统安装光盘进行安装,这里选择挂载系统安装光盘进行安装。
# mount /dev/cdrom /mnt/cdrom/
# rpm -ivh yum-3.2.22-33.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
# yum -v
yum 的基础安装包包括:
- yum //RPM installer/updater
- yum-fastestmirror //Yum plugin which chooses fastest repository from a mirrorlist
- yum-metadata-parser //A fast metadata parser for yum
其他安装包根据自己需要安装。
二、yum 配置
yum 的配置文件分为两部分:main 和repository
- main 部分定义了全局配置选项,整个yum 配置文件应该只有一个main。常位于/etc/yum.conf 中。
- repository 部分定义了每个源/服务器的具体配置,可以有一到多个。常位于/etc/yum.repo.d 目录下的各文件中。
yum.conf 文件一般位于/etc目录下,一般其中只包含main部分的配置选项。
# cat /etc/yum.conf
配置国内yum源
系统默认的yum 源速度往往不尽人意,为了达到快速安装的目的,在这里修改yum源为国内源。
上海交通大学yum源: http://ftp.sjtu.edu.cn/centos
可以点击这个网址,然后找到你要安装的包:
这里寻找你要的包,
1,选centos
2,选择系统版本7.3.1611/
3,选择包类型(系统) os/
4,系统位数 x86_64/
5,包 Packages/
6,ctrl+f 搜索yum
7、yum的安装需要:
yum-plugin-fastestmirror
yum-updateonboot
yum-utils
yum-metadata-parser
yum-3.4.3-150.el7
如需要安装yum包,可以用命令: (centos 7 所有版本的安装包都在centos/7/os 目录下面,而不是在 centos/7.XXX/下面)
[root@localhost]#wget http://ftp.sjtu.edu.cn/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://ftp.sjtu.edu.cn/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://ftp.sjtu.edu.cn/centos/7/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://ftp.sjtu.edu.cn/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost]#wget http://ftp.sjtu.edu.cn/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
配置yum源
a. 修改/etc/yum.repos.d/CentOS-Base.repo为
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
关于变量
- $releasever:代表发行版的版本,从[main]部分的distroverpkg获取,如果没有,则根据redhat-release包进行判断。
- $arch:cpu体系,如i686,athlon等
- $basearch:cpu的基本体系组,如i686和athlon同属i386,alpha和alphaev6同属alpha。
清理之前源,保证只有一个配置文件
[root@localhost]# yum clean all
[root@localhost]# ls /etc/yum.repos.d/
CentOS-Base.repo
安装你需要的软件测试是否正常使用
其他国内yum源列表如下:
1. 企业贡献:
搜狐开源镜像站:http://mirrors.sohu.com/
网易开源镜像站:http://mirrors.163.com/
2. 大学教学:
北京理工大学:
http://mirror.bit.edu.cn (IPv4 only)
http://mirror.bit6.edu.cn (IPv6 only)
北京交通大学:
http://mirror.bjtu.edu.cn (IPv4 only)
http://mirror6.bjtu.edu.cn (IPv6 only)
http://debian.bjtu.edu.cn (IPv4+IPv6)
兰州大学:http://mirror.lzu.edu.cn/
厦门大学:http://mirrors.xmu.edu.cn/
清华大学:
http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)
天津大学:http://mirror.tju.edu.cn/
中国科学技术大学:
http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
http://mirrors4.ustc.edu.cn/
http://mirrors6.ustc.edu.cn/
东北大学:
http://mirror.neu.edu.cn/ (IPv4 only)
http://mirror.neu6.edu.cn/ (IPv6 only)
电子科技大学:http://ubuntu.uestc.edu.cn/
备注:
我这里在Centos7.3.1611上配置yum源,测试可以使用的配置:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
# [base]
name=CentOS-centos/7 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=centos/7&arch=$basearch&repo=os
baseurl=http://ftp.sjtu.edu.cn/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://ftp.sjtu.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-centos/7 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=centos/7&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.sjtu.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-centos/7 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=centos/7&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.sjtu.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-centos/7 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=centos/7&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://ftp.sjtu.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users
[contrib]
name=CentOS-centos/7 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=centos/7&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://ftp.sjtu.edu.cn/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
CentOS yum配置的更多相关文章
- (转载)centos yum源的配置和使用
原文地址:http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.html 一.yum 简介 yum,是Yellow dog Updater, ...
- CentOS yum 源的配置与使用
一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的 ...
- 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat
阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat 执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...
- 阿里云服务器Linux CentOS安装配置(三)yum安装mysql
阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...
- 阿里云服务器Linux CentOS安装配置(二)yum安装svn
阿里云服务器Linux CentOS安装配置(二)yum安装svn 1.secureCRT连接服务器 2.先创建一个文件夹,用来按自己的习惯来,用来存放数据 mkdir /data 3.yum安装sv ...
- 为CentOS 6 配置本地YUM源
在网上找了很多为CentOS 6配置本地YUM源的方法,其中有很多是与网络相关的,我只想配个自己用的,结果就发现这个方法比较简单实用,就转过来了. 环境:CentOS 6.0 默认的yum是以网络来安 ...
- Redhat 6 配置CentOS yum source
由于最近曝出linux的bash漏洞,想更新下bash,于是 想到了配置CentOS yum source. 测试bash漏洞的命令: env x='() { :;}; echo "Your ...
- 超详细的 Linux CentOS yum 源的配置与使用【转发+新增】
一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的 ...
- centos yum源配置 与yum配置文件
参考博客 http://www.cnblogs.com/mchina/archive/2013/01/04/2842275.html 1.centos . yum配置文件在目录 /etc/yum.re ...
- centos 系统软件包管理 yum 本地yum配置 扩展源epel rpm 清除yum缓存 yum provides "*/vim" 第十节课
centos 系统软件包管理 yum 本地yum配置 扩展源epel rpm 清除yum缓存 yum provides "*/vim" 第十节课 你不能保证可逆化操 ...
随机推荐
- NetBeans连接SQLServer2008配置
一.配置SQL Server (一)SQL Server配置管理器 1.打开SQL Server配置管理器 (1)文件路径,我的是C:\Windows\SysWOW64\mmc.exe, 也可以从开始 ...
- C++ 数独游戏
C++ 数独游戏 直接上代码: 1 // 数独 sudoku 2 3 #include <iostream> 4 5 using namespace std; 6 7 int P[9][9 ...
- 代码发布平台jenkins中Check-out Strategy选项功能意义
第一个选项:Use'svn update' as much as possible 这个选项能实现快速发布:Use 'svn update' whenever possible, making th ...
- Centos安装ELK
目录 安装Elastic Search 安装 Java 安装Elastic Search 修改配置 开放端口 访问地址 相关命令 安装elasticsearch-head插件 安装Git 安装node ...
- vue和servlet 前后端分离 (复习)
一.vue复习 1.vue的使用步骤: (1)导入vue.js (2)创建除body以外最大的div标签,给定id值 (3)创建vue对象 new Vue({ el:"#app", ...
- C语言指针--二级指针
文章目录 前言 一.什么是二级指针 二.二级指针的使用 1.二级指针的定义 2.二级指针的赋值 3.二级指针的使用 3.1 用二级指针输出一级指针的地址 3.2 用二级指针输出一级指针中的内容 3.3 ...
- .net core 因路径原因导致的JSON解析错误
因解析json配置文件导致的错误: JsonReaderException: '0xEF' is an invalid escapable character within a JSON string ...
- 磁盘问题和解决: fsck,gdisk,fdisk等
错误: Resize inode not valid 对于gpt分区的硬盘一般fsck只能检查分区, 不能用于检查整个硬盘, 但是如果对硬盘设备运行时遇到这样的错误 $ sudo fsck -n /d ...
- Numpy,一篇足以
numpy 用于数值计算 ndarray, 一个有效的多维数组,能提供以数组为导向的快速数值计算和灵活的广播功能(broadcasting) 便利的数学函数 用于读取/写入(reading/writi ...
- cesium中限制地图浏览范围
https://blog.csdn.net/qq_42740164/article/details/119375782?ops_request_misc=%257B%2522request%255Fi ...