centos 配置yum源
1、yum配置
yum的配置文件在 /etc/yum.conf
[root@mini ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever # yum缓存的目录,下载安装软件包时存放的目录
keepcache= #安装完成后是否保留软件包 :不保留,:保留
debuglevel=
logfile=/var/log/yum.log # yum日志文件,查询过去所做的更新更改
exactarch=
obsoletes=
gpgcheck= #是否是否进行gpg(GNU Private Guard)校验
plugins=
installonly_limit=
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
$releasever 当前系统的发行版本,$basearch CPU体系,使用命令 arch 查看
2、配置yum源
yum源文件在 /etc/yum.repos.d/ 中
[root@mini ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
看到 .repo 结尾的文件都是yum文件,其中,CentOS-Base.repo 是yum 网络源的配置文件,CentOS-Media.repo 是yum 本地源的配置文件,默认使用网络源进行软件包安装与更新
1)配置本地yum源
配置本地首先要将网络yum源文件更改后缀名,或者将除了 CentOS-Media.repo 之外的文件全备份到一个目录中,不然默认的还是使用网络yum源
[root@mini yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.backup
[root@mini yum.repos.d]# cat CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-. 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=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command] [c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=
enabled=
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
baseurl 为本地yum源的地址,一般是安装光盘中的安装包,要确保光盘已连接
重新生成yum缓存
[root@mini yum.repos.d]# yum clean all
[root@mini yum.repos.d]# yum makecache
这样本地yum源就已经配置完成
2)配置网络yum源
centos默认的网络源为官方源,官方源为国外的站点,下载与更新速度有点慢,这时将网络源设置为国内的就会比较完美了,国内的开源镜像站点主要有
阿里云 https://opsx.alibaba.com/mirror
网易 http://mirrors.163.com/
清华大学 https://mirrors.tuna.tsinghua.edu.cn/
在这里我将以阿里云、网易的进行演示
(1)先备份 CentOS-Base.repo,以后可随时恢复
(2)下载新的CentOS-Base.repo 到/etc/yum.repos.d/
阿里的 ,根据自己的版本选择下载
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
网易的,根据自己的版本选择下载
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
(3)重新生成yum缓存
[root@mini yum.repos.d]# yum clean all
[root@mini yum.repos.d]# yum makecache
centos 配置yum源的更多相关文章
- centos配置yum源为中国镜像源
有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想.这时候需要将yum源设置为国内镜像站点.国内主要开源的开源镜像站点应该是网易和阿里云了. 修改CentOS默认 ...
- 【转】Centos配置yum源
转载自:http://blog.chinaunix.net/uid-23683795-id-3477603.html 网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的 ...
- CentOS配置yum源(补充)
这是对yum命令的补充 Yum命令 一.用Centos镜像搭建本地yum源 由于安装centos后的默认yum源为centos的官方地址,所以在国内使用很慢甚至无法访问,所以一般的做法都是把默认的yu ...
- centos配置yum源
1.登录mirrors.163.com 2.点击centos后面的“centos使用帮助” 3.下载CentOS7-Base-163.repo 4.sudo mv /etc/yum.repos.d/C ...
- CentOS / RHEL 配置yum源
CentOS / RHEL 配置yum源 */--> CentOS / RHEL 配置yum源 Table of Contents 1. 前言 2. 关于yum 2.1. yum是什么 2.2. ...
- Centos配置yum本地源最简单的办法
有关centos配置yum本地源的方法 一.前提 先连接镜像 然后在命令行输入如下命令 mount /dev/sr0 /mnt cd /etc/yum.repos.d/ ls 之后会看到如下的界面 二 ...
- CentOS使用yum源中自带的rpm包安装LAMP环境
CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...
- CentOS7.1 JDK安装 和 CentOS7.1配置yum源
1.卸载自带OPENJDK #查看自身jdk java -verson #查看自身安装的java rpm -qa | grep java #显示如下 python-javapackages-3.4. ...
- redhat 6 配置 yum 源的两种方法
由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源. 本文包括配置本地源及第三方源.第三方源包括:网易,epe ...
随机推荐
- [Application]Ctrl+C终止程序代码
代码如下: #include <stdio.h> #include <stdlib.h> #include <iostream> #include <sign ...
- C++ operator关键字(重载操作符)
operator是C++的关键字,它和运算符一起使用,表示一个运算符函数,理解时应将operator=整体上视为一个函数名. 这是C++扩展运算符功能的方法,虽然样子古怪,但也可以理解:一方面 ...
- koa介绍
https://github.com/koajs/koa https://github.com/demopark/koa-docs-Zh-CN ctx.response.type = 'json'; ...
- 关于VS2013编辑器的问题
如果输出报错 This function or variable may be unsafe. 解决方法 1.用VS2013打开出现错误的代码文件 2.在工程文件名处右击鼠标打开快捷菜单,找到“属性” ...
- 一般来说,主方法main()结束的时候线程结束
suspend()是将一个运行时状态进入阻塞状态(注意不释放锁标记).恢复状态的时候用resume().Stop()指释放全部. 这几个方法上都有Deprecated标志,说明这个方法不推荐使用. 一 ...
- Struts2的拦截器是如何使用AOP工作的
拦截器(interceptor)是Struts2最强大的特性之一,也可以说是struts2的核心,拦截器可以让你在Action和result被执行之前或之后进行一些处理.同时,拦截器也可以让你将通用的 ...
- 1QT在线帮助文档
http://www.kuqin.com/qtdocument/classes.html
- C++ 访问控制 public, protected, private, 友元
1. 变量属性与继承之间的关系 #include <iostream> using namespace std; class A { public: int x; protected: i ...
- 修改tomcat配置通过域名直接访问项目首页
1.在自己项目的web.xml中配置欢迎页面 <welcome-file-list> <welcome-file>index.html</welcome-file> ...
- GO函数总结(转)
GO语言函数与C,JAVA等有点很大的区别,大致如下: 一.函数的定义 例如: func max(a, b int) int{//返回a,b里面最大的一个,而且要注意函数的参数和返回值类型是怎么定义的 ...