1.1 什么是yum源

Yellowdog Updater, Modified

一个基于RPM包管理的字符前端软件包管理器。

能够从指定的服务器自动下载RPM包并且安装,可以处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

简单来说就是软件仓库--yum源/仓库,类似于应用宝之类。

1.2 修改yum源

1.2.1 yum源分类

按系统选择yum源

阿里云的yum源

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

首选以上阿里云的yum源 如果阿里云的yum源不能用

可以选择清华大学的yum源https://mirrors.tuna.tsinghua.edu.cn/

1.2.2 修改过程

操作前备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

系统是CentOS 6.9  所以选择6的yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

修改完后 生成本地缓存(缓存无处不在)

yum makecache

1.3 增加epel源

增加一个epel源

epel源是什么

epel源---增加和扩展yum仓库  里面包含了许多基本源里没有的软件。

1.3.1 epel源分类

首选以上阿里云的epel源 如果阿里云的epel源不能用

可以选择清华大学的epel源 地址:https://mirrors.tuna.tsinghua.edu.cn/

epel(RHEL 7)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

epel(RHEL 6)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

epel(RHEL 5)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo

1.3.2 修改过程

按系统选择epel增加就可以 直接执行

epel(RHEL 6)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

1.4 yum相关参数

1.4.1 清除本地的yum缓存。

yum clean all  清空yum缓存(缓存的是软件的列表)

1.4.2 查看系统当前的yum源

yum repolist

系统的yum源默认是从世界各地下载软件,优先选择自己离得最近的源下载,不稳定。

[root@oldboyedu-50 ~]# yum repolist

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

base                                                                | 3.7 kB     00:00    

epel                                                                | 3.2 kB     00:00    

epel/primary                                                        | 3.2 MB     00:09    

epel                                                                   12518/12518

extras                                                              | 3.4 kB     00:00    

updates                                                             | 3.4 kB     00:00    

updates/primary_db                                                  | 1.2 MB     00:03    

repo id              repo name                                                      status

base                 CentOS-6 - Base - mirrors.aliyun.com                            6,713

epel                 Extra Packages for Enterprise Linux 6 - x86_64                 12,518

extras               CentOS-6 - Extras - mirrors.aliyun.com                             31

updates              CentOS-6 - Updates - mirrors.aliyun.com                           113

repolist: 19,375  此位置相当于软件包的数量 系统默认的yum源 软件包大概6000多 这里是已经修改后的

1.5 yum常见的错误

1.5.1 查看系统yum源出现的错误

查看系统yum源可能出现的错误

[root@oldboy-50 ~]# yum repolist

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

repolist: 0

[root@oldboy-50~]# ls -l /etc/yum.repos.d

total 40

-rw-r--r--  1 root root 2572 Jul  2  2014 CentOS-Base.repo

/etc/yum.repos.d目录下的 .repo文件的内容没有 或 被删除都可以导致找不到yum源。

会出现以上的错误。

1.5.2 yum 正在运行

[root@znix ~]# yum install tree

Loaded plugins: fastestmirror, security

Existing lock /var/run/yum.pid: another copy is running as pid 5219.

Another app is currently holding the yum lock; waiting for it to exit...

  The other application is: yum

    Memory :  23 M RSS (859 MB VSZ)

    Started: Fri Sep 15 08:46:52 2017 - 00:12 ago

    State  : Sleeping, pid: 5219

    状态   :pid 5219

    正在运行的yum的pid

1.5.2.1  解决办法

1)可以等待该yum程序执行完毕,就可以进行安装

2)可以 使用kill命令 将这个pid进程结束进程

[root@znix ~]# ps -ef |grep 5219

root   5219   5095 44 08:52 pts/1    00:00:21 /usr/bin/python /usr/bin/yum makecache

root   5232   5146  0 08:53 pts/2    00:00:00 grep --color=auto 5219

linux下 yum相关的更多相关文章

  1. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

  2. 【夯实PHP基础系列】linux下yum安装PHP APC

    Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...

  3. linux 下crontab相关定时触发的配置规则

    linux 下crontab相关定时触发的配置规则: 1.基本格式 :* * * * * command(分 时 日 月 周 命令)2.取值范围:分钟1-59 每分钟用*或者 */1表示小时1-23( ...

  4. 20145234黄斐《信息安全系统设计基础》第八周(Linux下vim相关命令)

    Linux下vim相关命令 在编辑程序时经常使用vim,所以记住一些常用的指令还是很有必要的 文件命令 vim file 打开单个文件vim file vim file1 file2 file3 .. ...

  5. Linux下mysql相关操作

    Linux下mysql相关操作 1.创建MySQL mysql -u root -p create user 'username'@'%' identified by 'password'; %可以选 ...

  6. Linux下 svn相关操作

    Linux下 svn相关操作 一.首先看看svn安装的位置: 命令: find / -name svn /var/svn :表示安装目录 /user/bin/svn :表示命令目录 可以看到的是svn ...

  7. [转帖]linux 下yum使用技巧

    linux 下yum使用技巧 https://www.cnblogs.com/galengao/p/5750389.html 本文来自我的github pages博客http://galengao.g ...

  8. linux下yum安装python3

    linux下yum安装python3 linux下yum安装python3yum install python34 -ypython3 --version wget --no-check-certif ...

  9. linux下 yum 安装mysql和卸载

    1.查看有没有安装过: yum list installed mysql* rpm -qa | grep mysql* 2.查看有没有安装包: yum list mysql* 3.安装mysql客户端 ...

随机推荐

  1. 我的MYSQL学习心得链接

    http://www.cnblogs.com/lyhabc/p/3793524.html

  2. 第四章 模块化React和Redux应用

    第四章 模块化React和Redux应用 4.1 模块化应用要点 构建一个应用的基础: 代码文件的组织结构: 确定模块的边界: Store的状态树设计. 4.2 代码文件的组织方式 4.2.1 按角色 ...

  3. UVA - 11214 Guarding the Chessboard(迭代加深搜索)

    题目: 输入一个n*m的棋盘(n,m<10),某些格子有标记,用最少的皇后守卫(即占据或攻击)所有的标记的格子.输出皇后的个数. 思路: 一开始没有想到用迭代加深搜索,直接dfs结果还没写完就发 ...

  4. radis入门

    redis介绍 是远程的,有客户端.服务端 存内存,吃内存 应用场景 缓存 队列 list操作 push pop 数据存储[根据redis硬盘持久化的机制,这里不展开] 5种数据类型 string 字 ...

  5. exists关键词和case表达式

    首先声明一下,exist和case没有必然联系,这里只是为了一起整理个笔记. EXIST谓词 如果存在对应的记录,返回TRUE.否则,返回FALSE.*实际使用中,即使不适用exist,基本也可以使用 ...

  6. [bzoj1833][ZJOI2010][count] (数位dp)

    Description 给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次. Input 输入文件中仅包含一行两个整数a.b,含义如上所述. Output 输出文 ...

  7. 关于datanode多磁盘存储策略

    目的: 节点内各存储磁盘均衡 相关参数: dfs.datanode.fsdataset.volume.choosing.policy=org.apache.hadoop.hdfs.server.dat ...

  8. 关于git上传GitHub以及码云(gitee)

    如果你是gitee(码云),点击链接跳转 首先,你的有一个GitHub的账号(然后新建项目我就不说了) # Linux的方法 GitHub网站下的,点击settings下的emails,确认自己的邮箱 ...

  9. Codeforces 263A. Appleman and Easy Task

    A. Appleman and Easy Task time limit per test  1 second memory limit per test  256 megabytes input  ...

  10. 解决使用myeclipse电脑卡的问题

    1. 原因:myeclipse会自动更新,因此会占用大量内存 2. 解决方法: (1)window->Perferences->General->Startup and Shutdo ...