YUM源、磁盘基础知识 CDN概念

本文介绍了YUM源的基本概念及配置方法,包括如何查看系统中的YUM源、指定国内源地址、添加EPOL源等。同时,还简要介绍了如何查询内存使用情况。

第1章 YUM

1.1 什么是yum

Yellowdog Updater, Modified

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

简单来说就是软件仓库--yum/仓库,类似于电脑管家之类。

1.2 查看系统中有什么yum

yum repolist 目录可以列出服务器中使用的什么yum源。

[root@znix ~]# yum repolist

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * epel: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

repo id   repo name                                         status

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

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

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

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

repolist: 19,757

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

1.3 指定一个国内的yum源地址 aliyun

修改为阿里云的yum

1.3.1 操作前备份

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

 

1.3.2 下载新的CentOS-Base.repo /etc/yum.repos.d/

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

1.3.3 生成本地缓存

缓存无处不在

yum makecache

1.4 增加一个epel

1.4.1 epel源时干什么的

epel---增加和扩展yum仓库

里面包含了许多基本源里没有的软件。

1.4.2 添加上一个aliyunepel

安装自己的系统版本选择epel源。

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.5 安装htopsl 程序

htop 是一个类似与top的软件,但是更好看

sl  是一个小软件,哈哈。

[root@znix ~]# yum install htop sl -y

1.6 清除yum缓存   

清除本地的yum缓存。

yum clean all

1.7 查看系统yum源信息时可能出现的错误

1.7.1 可能出现的错误

[root@oldboy-40 ~]# yum repolist

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

repolist: 0

[root@znix ~]# 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.7.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

    正在运行的yumpid

1.7.3 解决办法

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

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

    [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

第2章 磁盘的基础知识

2.1 磁盘知识体系

2.2 如何查询内存的使用情况

free  -h 参数,在旧版本的系统中没有这个参数,可以使用-m,以M为单位显示。

[root@oldboyedu-40 ~]# free -h

             total       used       free     shared    buffers     cached

Mem:          1.8G       887M       974M       228K       221M       302M

-/+ buffers/cache:       363M       1.5G    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值