Linux 网络服务 07——部署 YUM 仓库

                        目录

一、YUM 简介

二、YUM 服务器的搭建

1、YUM 服务器概述

2、部署本地源

三、构建公网源

四、Yum命令

1、基本操作

2、针对单个安装包的操作

3、针对安装包组的操作


一、YUM 简介

UM 的前身是 YUP(Yellow dog Updater)Yellow dog Linux 的软件更新,最初由 TSS 公司 (Terra Soft Solutions,INC.)使用 Python 语音开发而成,后由杜克大学(Duck University)的 Linux 开发队伍进行改进,命名为 YUM(Yellow dog Updater , Modified)

借助于 YUM 软件仓库,可以完成安装、卸载、自动升级 rpm 软件包等任务,能够自动 查找并解决 rpm 包之间的依赖关系,而无需管理员逐个、手工地去安装每个 rpm 包,使管 理员在维护大量 Linux 服务器时更加轻松自如。特别是拥有大量 Linux 主机的本地网络中, 构建一台源服务器可以大大缓解软件安装、升级等对 Internet 的依赖。

二、YUM 服务器的搭建

1、YUM 服务器概述

YUM软件仓库通常借助HTTP或FTP协议来进行发布,这样可以面向网络中的所有客户 机提供软件源服务。为了便于客户机查询软件包,获取依赖关系等信息,在软件仓库中需要 提供仓库数据(Repodata),其中收集了目录下所有 rpm 包的头部信息。

2、部署本地源

服务端:

(1).准备软件仓库目录

1>光盘中的软件包

拷贝 CentOS 7.7 第一张光盘内容到本地 FTP 服务器匿名访问用户的根目录下

[root@Rz ~]# yum -y install vsftpd

[root@Rz ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载

[root@rz ~]# mkdir /var/www/html/centos7

[root@rz ~]# ln -s /mnt/* /var/www/html/centos7/            //节省空间,使用软连接

[root@rz ~]# ll /var/www/html/centos7/
total 0
lrwxrwxrwx 1 root root 20 Jul 27 20:33 CentOS_BuildTag -> /mnt/CentOS_BuildTag
lrwxrwxrwx 1 root root  8 Jul 27 20:33 EFI -> /mnt/EFI
lrwxrwxrwx 1 root root  9 Jul 27 20:33 EULA -> /mnt/EULA
lrwxrwxrwx 1 root root  8 Jul 27 20:33 GPL -> /mnt/GPL
lrwxrwxrwx 1 root root 11 Jul 27 20:33 images -> /mnt/images
lrwxrwxrwx 1 root root 13 Jul 27 20:33 isolinux -> /mnt/isolinux
lrwxrwxrwx 1 root root 11 Jul 27 20:33 LiveOS -> /mnt/LiveOS
lrwxrwxrwx 1 root root 13 Jul 27 20:33 Packages -> /mnt/Packages
lrwxrwxrwx 1 root root 13 Jul 27 20:33 repodata -> /mnt/repodata
lrwxrwxrwx 1 root root 25 Jul 27 20:33 RPM-GPG-KEY-CentOS-7 -> /mnt/RPM-GPG-KEY-CentOS-7
lrwxrwxrwx 1 root root 33 Jul 27 20:33 RPM-GPG-KEY-CentOS-Testing-7 -> /mnt/RPM-GPG-KEY-CentOS-Testing-7
lrwxrwxrwx 1 root root 14 Jul 27 20:33 TRANS.TBL -> /mnt/TRANS.TBL

(2).启动 vsftpd 服务

[root@rz ~]# systemctl start httpd
[root@rz ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

(3).验证:

客户端:

三、构建公网源

##如果是新环境会提示没有wget命令,进行下载
[root@rz ~]# yum -y install wget 

#下载阿里源
[root@rz ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2022-07-27 21:01:38--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 2409:8c0c:310:907:3::3fd, 2409:8c0c:310:907:3::3fe, 223.76.171.227, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|2409:8c0c:310:907:3::3fd|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[===========================================================================================================>] 2,523       --.-K/s   in 0s      

2022-07-27 21:01:38 (6.12 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]


#下载epel源
[root@rz ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
--2022-07-27 21:01:53--  http://mirrors.aliyun.com/repo/epel-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 2409:8c0c:310:907:3::3fe, 2409:8c0c:310:907:3::3fd, 111.19.224.240, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|2409:8c0c:310:907:3::3fe|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 664 [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/epel.repo’

100%[===========================================================================================================>] 664         --.-K/s   in 0s      

2022-07-27 21:01:53 (169 MB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664]

查看所有的源信息:

[root@rz ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                                 repo name                                                                              status
base/7/x86_64                                           CentOS-7 - Base - mirrors.aliyun.com                                                   10,072
epel/x86_64                                             Extra Packages for Enterprise Linux 7 - x86_64                                         13,758
extras/7/x86_64                                         CentOS-7 - Extras - mirrors.aliyun.com                                                    512
updates/7/x86_64                                        CentOS-7 - Updates - mirrors.aliyun.com                                                 4,05

四、Yum命令

1、基本操作

(1).查询软件包列表:

yum list、yum grouplist
yum list installed 查询已安装的包
yum list available 查询可以安装(未安装)的包

(2).查询软件包的描述信息:

yum info 软件包名

(3).查询指定软件包:

yum search 软件包名

(4).清理 yum 缓存:

yum -y clean all

(5).重建 yum 缓存:

yum makecache

2、针对单个安装包的操作

(1)安装:yum -y install
(2)卸载:yum -y remove 或 yum -y erase
(3)升级:yum -y update

3、针对安装包组的操作

(1)安装:yum -y groupinstall “软件包组名称”
(2)卸载:yum -y groupremove
(3)升级:yum -y groupupdate

##选项-y 表示不进行交互,回答 yes。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

改名叫热炸

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值