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源的更多相关文章

  1. centos配置yum源为中国镜像源

    有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想.这时候需要将yum源设置为国内镜像站点.国内主要开源的开源镜像站点应该是网易和阿里云了. 修改CentOS默认 ...

  2. 【转】Centos配置yum源

    转载自:http://blog.chinaunix.net/uid-23683795-id-3477603.html 网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的 ...

  3. CentOS配置yum源(补充)

    这是对yum命令的补充 Yum命令 一.用Centos镜像搭建本地yum源 由于安装centos后的默认yum源为centos的官方地址,所以在国内使用很慢甚至无法访问,所以一般的做法都是把默认的yu ...

  4. centos配置yum源

    1.登录mirrors.163.com 2.点击centos后面的“centos使用帮助” 3.下载CentOS7-Base-163.repo 4.sudo mv /etc/yum.repos.d/C ...

  5. CentOS / RHEL 配置yum源

    CentOS / RHEL 配置yum源 */--> CentOS / RHEL 配置yum源 Table of Contents 1. 前言 2. 关于yum 2.1. yum是什么 2.2. ...

  6. Centos配置yum本地源最简单的办法

    有关centos配置yum本地源的方法 一.前提 先连接镜像 然后在命令行输入如下命令 mount /dev/sr0 /mnt cd /etc/yum.repos.d/ ls 之后会看到如下的界面 二 ...

  7. CentOS使用yum源中自带的rpm包安装LAMP环境

    CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...

  8. CentOS7.1 JDK安装 和 CentOS7.1配置yum源

    1.卸载自带OPENJDK #查看自身jdk java -verson #查看自身安装的java  rpm -qa | grep java #显示如下 python-javapackages-3.4. ...

  9. redhat 6 配置 yum 源的两种方法

      由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源. 本文包括配置本地源及第三方源.第三方源包括:网易,epe ...

随机推荐

  1. [Linux]gcc/libc/glibc

    转自:http://blog.csdn.net/weiwangchao_/article/details/16989713 1.gcc(gnu collect compiler)是一组编译工具的总称. ...

  2. How to activate maven profile inside eclipse

    How to activate maven profile inside eclipse Normally maven is use for project dependency management ...

  3. 指数族分布(Exponential Families of Distributions)

    指数族分布是一大类分布,基本形式为: T(x)是x的充分统计量(能为相应分布提供足够信息的统计量) 为了满足归一化条件,有: 可以看出,当T(x)=x时,e^A(theta)是h(x)的拉普拉斯变换. ...

  4. Java并发编程从入门到精通 张振华.Jack --我的书

    [当当.京东.天猫.亚马逊.新华书店等均有销售] 目 录 第一部分:线程并发基础 第1章 概念部分   1 1.1 CPU核心数.线程数 (主流cpu.线程数的大体情况说一下) 1 1.2 CPU时间 ...

  5. [转]Loadrunner Error code 10053 & Tomcat 连接器(connector)优化

    LoadRunner提示错误:Error : socket0 - Software caused connection abort. Error code : 10053. 在今天的测试过程中发现,s ...

  6. Maven仓库的搭建

    http://blog.csdn.net/xiao__gui/article/details/52625660 Maven仓库是有特定规则的目录结构. 目录结构由 仓库根目录 , groupId , ...

  7. 采用std::thread 替换 openmp

    内容转换的,具体详见博客:https://cloud.tencent.com/developer/article/1094617 及对应的code:https://github.com/cpuimag ...

  8. leetcode -- Balanced Binary Tree TODO

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  9. C语言while语句

    在C语言中,共有三大常用的程序结构: 顺序结构:代码从前往后执行,没有任何“拐弯抹角”: 选择结构:也叫分支结构,重点要掌握 if else.switch 以及条件运算符: 循环结构:重复执行同一段代 ...

  10. C#三种字符串拼接方法的效率对比

    C#字符串拼接的方法常用的有:StringBuilder.+.string.Format.List<string>.使用情况不同,效率不同. 1.+的方式 string sql = &qu ...