实习七:epel源配置+yum源配置

昨天总结:

⾼级指令
find
-name
按名称搜索,⽀持通配符
-type
d|f
-size
k M G+3M。-3M。 3M
dd if=/dev/zero of=⽂件路径 bs=300M count=1
-mtime  +3 -3
touch ⽂件名  -m -d "最后修改时间"
-exec
rm -rf {} \;
find / -size +3M | xargs rm -rf
tree
yum install tree -y
将⽂件结构以树状显示
tree -l 2 ⽬录路径
scp
对⽂件或者⽬录进⾏上传和下载
上传 scp /tmp/abc root@192.168.135.143:/tmp
上传如果是⽬录 -r
ls -R。cp -r
c rontab
-l
list 罗列所有的计划任务
-e edit 编辑计划任务
vim编辑状态
时间设置 指令


date “+%Y%m%d%H%M%S”
在计划任务中,%需要添加转义\
公司计划将现有的mysql数据库从云平台迁移到物理机器上,并且已经在相应的物理机上安
装好相应的操作系统,现在需要运维⼈员协助在centos7.6上安装mysql8.33⽤于前期迁移准
备⼯作,同时配置好本地yum源和外⽹源,⽅便后续软件包安装
1.任务要求
配置本地yum源
⽹络yum源
安装mysql
*/3 */3 */3 */3 */2 指令(which) 选项 参数
12 * * * * 指令
2.任务拆解
yum源配置
mysql数据库软件

了解yum源安装软件包的 有点
了解常⻅的⽹络yum源
掌握本地和⽹络yum源的配置
能够使⽤yum⼯具安装软件包 
rpm -ivh xxx
⼿动添加依赖
yum不⽌执⾏安装,⾃动处理依赖管理

yum
软件包管理器,类似于360软件管家,以及⼿机的app市场

 yum优点
Rpm安装(下载软件,单独安装,需要解决依赖关系)
源码安装  confgure make make install
yum基于rpm,相当于rpm升级版,⾃动解决依赖关系
分类
本地yum源
yum仓库在本地,系统光盘/镜像⽂件
⽹络yum源
aliyun
163源
sohu源
清华源
centos源
redhat源
epel源
特定软件
nginx
mysql
zabbix

1.找到源⽂件

# 当前在etc⽬录,跳转到yum.repos.d⽬录
[root@localhost etc]# cd yum.repos.d/
#查看默认的源⽂件
[root@localhost yum.repos.d]# ls
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo        
      mysql-community.repo
CentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repo
      mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo    mysql-community-
debuginfo.repo
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d

2.将所有的repo⽂件做成压缩包,命名为repo.tar.gz

[root@localhost yum.repos.d]# tar -zcvf repo.tar.gz ./*.repo
./CentOS-Base.repo
./CentOS-CR.repo
./CentOS-Debuginfo.repo
./CentOS-fasttrack.repo
./CentOS-Media.repo
./CentOS-Sources.repo
./CentOS-Vault.repo
./CentOS-x86_64-kernel.repo
./mysql-community-debuginfo.repo
./mysql-community.repo
./mysql-community-source.repo
您在 /var/spool/mail/root 中有新邮件
# 查看⽂件信息
[root@localhost yum.repos.d]# ls

CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo        
      mysql-community.repo
CentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repo
      mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo    mysql-community-
debuginfo.repo  repo.tar.gz

3.删除所有的repo⽂件

[root@localhost yum.repos.d]#  rm -rf ./*.repo
您在 /var/spool/mail/root 中有新邮件
[root@localhost yum.repos.d]# ls
repo.tar.gz
[root@localhost yum.repos.d]#

1.查看本地源

Loading mirror speeds from cached hostfile
repolist: 0
# 所有的yum都已经被删除了

1.使⽤光盘作为yum源仓库
1.在vmware中装载centos7.6光盘镜像

 

 [root@localhost ~]# ls /mnt/
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-
GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7
TRANS.TBL

 4.将挂载添加到开机启动⽂件中
chmod +x /etc/rc.local
添加权限
echo 'mount -o ro /dev/sr0 /mnt' >> /etc/rc.local
向⽂件中添加⼀⾏

 5.编写本地repo⽂件
1.创建⼀个repo⽂件
2.编辑内容
yum 仓库的格式
[root@localhost ~]# vim /etc/rc.local
[root@localhost ~]# echo 'mount -o or /dev/sr0 /mnt' >> /etc/rc.local
[root@localhost ~]# vim /etc/rc.local
[root@localhost ~]# vim /etc/rc.local
[root@localhost ~]# ls -l /etc/rc.local
lrwxrwxrwx. 1 root root 13 6⽉  16 20:18 /etc/rc.local -> rc.d/rc.local
编号
属性
1
[仓库名称] 可以有多个仓库
2
name= 仓库名称
3
baseurl= 仓库的路径,⽀持多种格式 file:// ftp:// http/s://
4
gpgcheck= gpg秘钥检测 0不检测,1检测,如果需要配置秘钥链接
5
enable= 0|1 是否启⽤当前仓库
6,清理缓存,查看源列表
[root@localhost ~]# ls /etc/yum.repos.d/
repo.tar.gz
[root@localhost ~]# vim /etc/yum.repos.d/20240714001.repo
[local][local]
name=local0
baseurl=file:///mnt
gpgcheck=0
enable=1
# 清理缓存
[root@localhost ~]# yum clear all
已加载插件:fastestmirror
没有该命令:clear。请使⽤ /usr/bin/yum --help
#创建缓存
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
local                                                                  
                 | 3.6 kB  00:00:00    
(1/2): local/other_db                                                  
                 | 2.5 MB  00:00:00    
7.测试yum
(2/2): local/filelists_db                                              
                 | 6.9 MB  00:00:00    
元数据缓存已建⽴
您在 /var/spool/mail/root 中有新邮件
# 查看源仓库列表
[root@localhost ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识                                               源名称              
                                状态
local                                                local0            
                                   9,911
repolist: 9,911
[root@localhost ~]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识                                           源名称                
                            状态
local                                             local0              
                              启⽤: 9,911  #软件数量
repolist: 9,911
# 查看是否安装httpd
[root@localhost ~]# rpm -q httpd
httpd-2.4.6-99.el7.centos.1.x86_64
# 卸载httpd
[root@localhost ~]# yum remove httpd
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-99.el7.centos.1 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================
=========================================
Package             架构                 版本                        
        源                       ⼤⼩
=======================================================================
=========================================
正在删除:
httpd                x86_64                2.4.6-99.el7.centos.1      
          @updates                9.4 M
事务概要
=======================================================================
=========================================
移除  1 软件包
安装⼤⼩:9.4 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除    : httpd-2.4.6-99.el7.centos.1.x86_64                      
                                   1/1
验证中      : httpd-2.4.6-99.el7.centos.1.x86_64                      
                                   1/1
 
删除:
httpd.x86_64 0:2.4.6-99.el7.centos.1                                
                                         
完毕!
# 再次查看是否安装httpd
[root@localhost ~]# rpm -q httpd
未安装软件包 httpd
[root@localhost ~]# yum -y install httpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-80.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-80.el7.centos,它被软件包 httpd-
2.4.6-80.el7.centos.x86_64 需要
--> 解决依赖关系完成
错误:软件包:httpd-2.4.6-80.el7.centos.x86_64 (local)
        需要:httpd-tools = 2.4.6-80.el7.centos
        已安装: httpd-tools-2.4.6-99.el7.centos.1.x86_64 (@updates)
             httpd-tools = 2.4.6-99.el7.centos.1
        可⽤: httpd-tools-2.4.6-80.el7.centos.x86_64 (local)
             httpd-tools = 2.4.6-80.el7.centos
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执⾏:rpm -Va --nofiles --nodigest
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# rpm -q httpd
未安装软件包 httpd
# 缺少依赖,安装失败
 2.下载软件,使⽤软件包,作为yum源仓库

 

 ⽹络yum源的分离
知名站点
1.搜索阿⾥镜像源

 2.根据官⽅提示配置yum源
https://developer.aliyun.com/mirror/centos

 # 复制阿⾥云提供的url,下载⽂件
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo
https://mirrors.aliyun.com/repo/Centos-7.repo
--2024-07-14 20:00:04--  https://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 117.23.49.221,
117.23.49.224, 58.222.47.210, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|117.23.49.221|:443... 已
连接。
已发出 HTTP 请求,正在等待回应... 200 OK
⻓度:2523 (2.5K) [application/octet-stream]
正在保存⾄: “/etc/yum.repos.d/CentOS-Base.repo”
3.运⾏ yum makecache⽣成缓存 yum clear
4.查看源

 

 httpd                x86_64                2.4.6-99.el7.centos.1      
           updates                2.7 M
事务概要
=======================================================================
=========================================
安装  1 软件包
总下载量:2.7 M
安装⼤⼩:9.4 M
Downloading packages:
httpd-2.4.6-99.el7.centos.1.x86_64.rpm                                
                  | 2.7 MB  00:00:02    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : httpd-2.4.6-99.el7.centos.1.x86_64                      
                                   1/1
验证中      : httpd-2.4.6-99.el7.centos.1.x86_64                      
                                   1/1
已安装:
httpd.x86_64 0:2.4.6-99.el7.centos.1                                
                                         
完毕!
[root@localhost yum.repos.d]#

2.特定软件 nginx mysql zabbix 

下载⽂件
[root@localhost yum.repos.d]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# cd
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.cloud.tencent.com/repo/centos7_base.repo
--2024-07-14 20:17:18--
http://mirrors.cloud.tencent.com/repo/centos7_base.repo
更新缓存
 
正在解析主机 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)...
101.227.191.8, 101.227.191.31, 114.80.12.245, ...
正在连接 mirrors.cloud.tencent.com
(mirrors.cloud.tencent.com)|101.227.191.8|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
⻓度:1694 (1.7K) [application/octet-stream]
正在保存⾄: “/etc/yum.repos.d/CentOS-Base.repo”
100%
[======================================================================
>] 1,694       --.-K/s ⽤时 0s      
2024-07-14 20:17:18 (275 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-
Base.repo” [1694/1694])
[root@localhost ~]#
[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: extras local os updates
Cleaning up list of fastest mirrors
Other repos take up 112 M of disk space (use --verbose for details)
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
extras                                                                
                  | 2.9 kB  00:00:00    
local                                                                  
                 | 3.6 kB  00:00:00    
os                                                                    
                  | 3.6 kB  00:00:00    
updates                                                                
                 | 2.9 kB  00:00:00    
(1/14): extras/7/x86_64/primary_db                                    
                  | 253 kB  00:00:00    
(2/14): local/group_gz                                                
                  | 166 kB  00:00:00    
(3/14): extras/7/x86_64/other_db                                      
                  | 154 kB  00:00:00    
(4/14): local/primary_db                                              
                  | 5.9 MB  00:00:00    
(5/14): local/filelists_db                                            
                  | 6.9 MB  00:00:00    
(6/14): local/other_db                                                
                  | 2.5 MB  00:00:00    
(7/14): extras/7/x86_64/filelists_db                                  
                  | 305 kB  00:00:01    
(8/14): os/7/x86_64/group_gz                                          
                  | 153 kB  00:00:00    
(9/14): os/7/x86_64/primary_db                                        
                  | 6.1 MB  00:00:03    
(10/14): os/7/x86_64/other_db                                          
                 | 2.6 MB  00:00:02    
(11/14): os/7/x86_64/filelists_db                                      
                 | 7.2 MB  00:00:06    
(12/14): updates/7/x86_64/filelists_db                                
                  |  15 MB  00:00:12    
(13/14): updates/7/x86_64/other_db                                    
                  | 1.6 MB  00:00:02    
epel源配置
对官⽅和官⽹源的扩展,有些软件找不到
yum -y install epel-release
(14/14): updates/7/x86_64/primary_db                                  
                  |  27 MB  00:00:20    
元数据缓存已建⽴
[root@localhost ~]# yum -y install epel-release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================
=========================================
Package                       架构                     版本          
        源                       ⼤⼩
=======================================================================
=========================================
正在安装:
epel-release                   noarch                   7-11          
         extras                    15 k
事务概要
=======================================================================
=========================================
安装  1 软件包
总下载量:15 k
安装⼤⼩:24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                          
                  |  15 kB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : epel-release-7-11.noarch                                
                                   1/1
验证中      : epel-release-7-11.noarch                                
                                   1/1
已安装:
epel-release.noarch 0:7-11                                          
                                         
完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]#
[root@localhost ~]# yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                  
                  |  16 kB  00:00:00    
* epel: epel.01link.hk
epel                                                                  
                  | 4.3 kB  00:00:00    
epel/x86_64/updateinfo         FAILED                                  
       
https://epel.01link.hk/7/x86_64/repodata/ee7ce72544e0fca006120c613404d9
37cc3da9d09c7d80aea269df31639f310c-updateinfo.xml.bz2: [Errno 14]
curl#60 - "Peer's certificate issuer has been marked as not trusted by
the user."
正在尝试其它镜像。
It was impossible to connect to the CentOS servers.
This could mean a connectivity issue in your environment, such as the
requirement to configure a proxy,
or a transparent proxy that tampers with TLS security, or an incorrect
system clock.
You can try to solve this issue by using the instructions on
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use
https://bugs.centos.org/.
(1/3): epel/x86_64/group                                              
                  | 399 kB  00:00:01    
(2/3): epel/x86_64/updateinfo                                          
                 | 1.0 MB  00:00:03    
(3/3): epel/x86_64/primary_db                                          
                 | 8.7 MB  00:00:12    
源标识                         源名称                                  
                          状态
centosplus/7/x86_64             Qcloud centosplus - x86_64            
                            禁⽤
cr/7/x86_64                     Qcloud centos cr - x86_64              
                            禁⽤
epel/x86_64                     Extra Packages for Enterprise Linux 7 -
x86_64                     启⽤: 13,791
epel-debuginfo/x86_64           Extra Packages for Enterprise Linux 7 -
x86_64 - Debug             禁⽤
epel-source/x86_64              Extra Packages for Enterprise Linux 7 -
x86_64 - Source             禁⽤
epel-testing/x86_64             Extra Packages for Enterprise Linux 7 -
Testing - x86_64           禁⽤
安装⼩⽕⻋
epel-testing-debuginfo/x86_64   Extra Packages for Enterprise Linux 7 -
Testing - x86_64 - Debug   禁⽤
epel-testing-source/x86_64      Extra Packages for Enterprise Linux 7 -
Testing - x86_64 - Source   禁⽤
extras/7/x86_64                 Qcloud centos extras - x86_64          
                            启⽤:    526
fasttrack/7/x86_64              Qcloud centos fasttrack - x86_64      
                            禁⽤
local                           local0                                
                            启⽤:  9,911
os/7/x86_64                     Qcloud centos os - x86_64              
                            启⽤: 10,072
updates/7/x86_64                Qcloud centos updates - x86_64        
                            启⽤:  6,173
repolist: 40,473
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# ls /etc/yum.repos.d/
20240714001.repo  CentOS-Base.repo  epel.repo  epel-testing.repo
repo.tar.gz
[root@localhost ~]# yum -y install sl
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 sl.x86_64.0.5.02-1.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================
=========================================
Package               架构                     版本                  
          源                       ⼤⼩
=======================================================================
=========================================
正在安装:
sl                    x86_64                    5.02-1.el7            
          epel                     14 k
事务概要
=======================================================================
=========================================
安装  1 软件包
总下载量:14 k
安装⼤⼩:17 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/sl-5.02-1.el7.x86_64.rpm: 头
V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
sl-5.02-1.el7.x86_64.rpm 的公钥尚未安装
sl-5.02-1.el7.x86_64.rpm                                              
                  |  14 kB  00:00:00    
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导⼊ GPG key 0x352C64E5:
⽤户ID     : "Fedora EPEL (7) <epel@fedoraproject.org>"
指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
软件包     : epel-release-7-11.noarch (@extras)
来⾃       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : sl-5.02-1.el7.x86_64                                    
                                   1/1
验证中      : sl-5.02-1.el7.x86_64                                    
                                   1/1
已安装:
sl.x86_64 0:5.02-1.el7                                              
                                         
完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# sl

 

 ⾃建yum源仓库
1.缓存安装软件包
下⼀次还⽤
国外源
2.如何缓存
vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releaserver # 定义软件包缓存路径
keepcache=1 #开启缓存
debuglevel=2
logfile=/var/log/yum.log
1.vim /etc/yum.cong
2.keepcache=1
3.测试 yum -y. install tree
4./var/cache/yum/x66_32/7/base/packages/treeexxxxxx.rpm
 
卸载,然后安装nginx 查看缓存⽂件
[root@localhost ~]# vim /etc/yum.conf
[main][main]
cachedir=/var/cache/yum/$basearch/$releasever
#修改为1
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
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
# 卸载
[root@localhost ~]# yum -y remove nginx.x86_64
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 nginx.x86_64.1.1.26.1-2.el7.ngx 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================
=========================================
Package             架构                 版本                          
    源                           ⼤⼩
=======================================================================
=========================================
正在删除:
nginx               x86_64               1:1.26.1-2.el7.ngx          
       @nginx-stable               2.8 M
事务概要
=======================================================================
=========================================
移除  1 软件包
安装⼤⼩:2.8 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除    : 1:nginx-1.26.1-2.el7.ngx.x86_64                        
                                    1/1
验证中      : 1:nginx-1.26.1-2.el7.ngx.x86_64                        
                                    1/1
删除:
nginx.x86_64 1:1.26.1-2.el7.ngx                                      
                                       
完毕!
#安装
[root@localhost ~]# yum install nginx -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 nginx.x86_64.1.1.26.1-2.el7.ngx 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================
=========================================
Package             架构                 版本                        
    源                           ⼤⼩
=======================================================================
=========================================
正在安装:
nginx                x86_64                1:1.26.1-2.el7.ngx        
       nginx-stable                807 k
事务概要
=======================================================================
=========================================
安装  1 软件包
总下载量:807 k
安装⼤⼩:2.8 M
Downloading packages:
nginx-1.26.1-2.el7.ngx.x86_64.rpm                                      
                 | 807 kB  00:00:12    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : 1:nginx-1.26.1-2.el7.ngx.x86_64                        
                                    1/1
----------------------------------------------------------------------
只下载不安装
Thanks for using nginx!
Please find the official documentation for nginx here:
* https://nginx.org/en/docs/
Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* https://nginx.org/en/support.html
Commercial subscriptions for nginx are available on:
* https://nginx.com/products/
----------------------------------------------------------------------
验证中      : 1:nginx-1.26.1-2.el7.ngx.x86_64                        
                                    1/1
已安装:
nginx.x86_64 1:1.26.1-2.el7.ngx                                      
                                       
完毕!
您在 /var/spool/mail/root 中有新邮件
#查找安装包
[root@localhost ~]# find /var/cache/ -name "*tree*" -type f
/var/cache/yum/x86_64/7/os/packages/tree-1.6.0-10.el7.x86_64.rpm
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# find /var/cache/ -name "*nginx*" -type f
/var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.26.1-
2.el7.ngx.x86_64.rpm
[root@localhost ~]#
[root@localhost ~]# yum install --downloadonly --downloaddir=./soft
samba
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
事务概要
=======================================================================
=========================================
安装  1 软件包 (+18 依赖软件包)
总下载量:9.0 M
安装⼤⼩:29 M
Background downloading packages, then exiting:

-----------------------------------------------------------------------
-----------------------------------------
总计                                                                    
       1.3 MB/s | 9.0 MB  00:00:06    
exiting because "Download Only" specified

[root@localhost ~]# ls soft/
avahi-libs-0.6.31-20.el7.x86_64.rpm      pytalloc-2.1.16-
1.el7.x86_64.rpm
cups-libs-1.6.3-52.el7_9.x86_64.rpm      python-tdb-1.3.18-
1.el7.x86_64.rpm
gnutls-3.3.29-9.el7_6.x86_64.rpm         samba-4.10.16-
25.el7_9.x86_64.rpm
libldb-1.5.4-2.el7.x86_64.rpm            samba-client-libs-4.10.16-
25.el7_9.x86_64.rpm
libtalloc-2.1.16-1.el7.x86_64.rpm        samba-common-4.10.16-
25.el7_9.noarch.rpm
libtdb-1.3.18-1.el7.x86_64.rpm           samba-common-libs-4.10.16-
25.el7_9.x86_64.rpm
libtevent-0.9.39-1.el7.x86_64.rpm        samba-common-tools-4.10.16-
25.el7_9.x86_64.rpm
libwbclient-4.10.16-25.el7_9.x86_64.rpm  samba-libs-4.10.16-
25.el7_9.x86_64.rpm
nettle-2.7.1-9.el7_9.x86_64.rpm          trousers-0.3.14-
2.el7.x86_64.rpm
pyldb-1.5.4-2.el7.x86_64.rpm
您在 /var/spool/mail/root 中有新邮件

1.安装createrepo制作仓库的软件
[root@localhost ~]# yum -y install createrepo
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 createrepo.noarch.0.0.9.9-28.el7 将被 安装
--> 正在处理依赖关系 python-deltarpm,它被软件包 createrepo-0.9.9-
28.el7.noarch 需要
--> 正在处理依赖关系 libxml2-python,它被软件包 createrepo-0.9.9-
28.el7.noarch 需要
--> 正在处理依赖关系 deltarpm,它被软件包 createrepo-0.9.9-28.el7.noarch 需要
--> 正在检查事务
---> 软件包 deltarpm.x86_64.0.3.6-3.el7 将被 安装
---> 软件包 libxml2-python.x86_64.0.2.9.1-6.el7_9.6 将被 安装
---> 软件包 python-deltarpm.x86_64.0.3.6-3.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
========================================================================
========================================
Package                       架构                 版本                
          源                     ⼤⼩
========================================================================
========================================
正在安装:
createrepo                    noarch               0.9.9-28.el7        
           os                     94 k
为依赖⽽安装:
deltarpm                      x86_64               3.6-3.el7          
            os                     82 k
libxml2-python                x86_64               2.9.1-6.el7_9.6    
            updates               247 k
python-deltarpm               x86_64               3.6-3.el7          
            os                     31 k
事务概要
========================================================================
========================================
安装  1 软件包 (+3 依赖软件包)
总下载量:454 k
安装⼤⼩:2.0 M
Downloading packages:
(1/4): createrepo-0.9.9-28.el7.noarch.rpm                              
                 |  94 kB  00:00:00    
(2/4): deltarpm-3.6-3.el7.x86_64.rpm                                    
                |  82 kB  00:00:00    
(3/4): python-deltarpm-3.6-3.el7.x86_64.rpm                            
                 |  31 kB  00:00:00    
(4/4): libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm                        
                | 247 kB  00:00:01    
------------------------------------------------------------------------
----------------------------------------
总计                                                                    
       264 kB/s | 454 kB  00:00:01    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : deltarpm-3.6-3.el7.x86_64                                
                                  1/4
正在安装    : python-deltarpm-3.6-3.el7.x86_64                        
                                   2/4
2 把soft⽂件夹做成⼀个本地的⾃建仓

正在安装    : libxml2-python-2.9.1-6.el7_9.6.x86_64                    
                                  3/4
正在安装    : createrepo-0.9.9-28.el7.noarch                          
                                   4/4
验证中      : createrepo-0.9.9-28.el7.noarch                          
                                   1/4
验证中      : deltarpm-3.6-3.el7.x86_64                                
                                  2/4
验证中      : libxml2-python-2.9.1-6.el7_9.6.x86_64                    
                                  3/4
验证中      : python-deltarpm-3.6-3.el7.x86_64                        
                                   4/4
已安装:
createrepo.noarch 0:0.9.9-28.el7                                      
                                       
作为依赖被安装:
deltarpm.x86_64 0:3.6-3.el7   libxml2-python.x86_64 0:2.9.1-6.el7_9.6
  python-deltarpm.x86_64 0:3.6-3.el7  
完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]#
root@localhost ~]# createrepo soft/
Spawning worker 0 with 19 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# ls
folder                                                   mysql-
community-libs-8.4.1-1.el7.aarch64.rpm
mysql84-community-release-el7-1.noarch.rpm               mysql-
community-libs-compat-8.4.1-1.el7.aarch64.rpm
mysql-community-client-8.4.1-1.el7.aarch64.rpm           mysql-
community-server-8.4.1-1.el7.aarch64.rpm
mysql-community-client-plugins-8.4.1-1.el7.aarch64.rpm   mysql-
community-server-debug-8.4.1-1.el7.aarch64.rpm
mysql-community-common-8.4.1-1.el7.aarch64.rpm           rpm-4.16.1.3-
25.el9.src.rpm
mysql-community-devel-8.4.1-1.el7.aarch64.rpm            rpmbuild
mysql-community-embedded-compat-8.4.1-1.el7.aarch64.rpm  soft
mysql-community-icu-data-files-8.4.1-1.el7.aarch64.rpm
[root@localhost ~]# cd soft/
[root@localhost soft]# ls
avahi-libs-0.6.31-20.el7.x86_64.rpm      pytalloc-2.1.16-
1.el7.x86_64.rpm
cups-libs-1.6.3-52.el7_9.x86_64.rpm      python-tdb-1.3.18-
1.el7.x86_64.rpm
gnutls-3.3.29-9.el7_6.x86_64.rpm         repodata
3.在/etc/yum.repos.d/下创建
soft.repo
vim /etc/yum.repos.d/soft.repo
[soft]
name=soft_local
gpgcheck=0
baseurl=file:///root/soft
enable=1
yum clean all
libldb-1.5.4-2.el7.x86_64.rpm            samba-4.10.16-
25.el7_9.x86_64.rpm
libtalloc-2.1.16-1.el7.x86_64.rpm        samba-client-libs-4.10.16-
25.el7_9.x86_64.rpm
libtdb-1.3.18-1.el7.x86_64.rpm           samba-common-4.10.16-
25.el7_9.noarch.rpm
libtevent-0.9.39-1.el7.x86_64.rpm        samba-common-libs-4.10.16-
25.el7_9.x86_64.rpm
libwbclient-4.10.16-25.el7_9.x86_64.rpm  samba-common-tools-4.10.16-
25.el7_9.x86_64.rpm
nettle-2.7.1-9.el7_9.x86_64.rpm          samba-libs-4.10.16-
25.el7_9.x86_64.rpm
pyldb-1.5.4-2.el7.x86_64.rpm             trousers-0.3.14-
2.el7.x86_64.rpm
[root@localhost soft]#
yum makecac
# 删除其他仓库⽂件
[root@localhost soft]# rm -rf /etc/yum.repos.d/*.repo
您在 /var/spool/mail/root 中有新邮件
[root@localhost soft]# ls /etc/yum.repos.d/
repo.tar.gz
# 配置仓库⽂件
[root@localhost soft]# vim /etc/yum.repos.d/soft.repo
您在 /var/spool/mail/root 中有新邮件
# 创建缓存
[root@localhost soft]# yum clean all
已加载插件:fastestmirror
正在清理软件源: soft
Cleaning up list of fastest mirrors
Other repos take up 748 M of disk space (use --verbose for details)
[root@localhost soft]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
soft                                                                    
                | 2.9 kB  00:00:00    
(1/3): soft/filelists_db                                                
                | 6.6 kB  00:00:00    
(2/3): soft/other_db                                                    
                |  10 kB  00:00:00    
(3/3): soft/primary_db                                                  
                |  33 kB  00:00:00    
元数据缓存已建⽴
# 再次安装samba
[root@localhost soft]# yum -y install samba
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 解决依赖关系完成
依赖关系解决
========================================================================
========================================
Package                         架构                 版本              
            源                 ⼤⼩
========================================================================
========================================
正在安装:
samba                            x86_64               4.10.16-25.el7_9
               soft               720 k
为依赖⽽安装:

事务概要
========================================================================
========================================
安装  1 软件包 (+18 依赖软件包)
总下载量:9.0 M
安装⼤⼩:29 M
Downloading packages:
------------------------------------------------------------------------
----------------------------------------
总计                                                                    
       202 MB/s | 9.0 MB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
已安装:
samba.x86_64 0:4.10.16-25.el7_9                                                                           
作为依赖被安装:
avahi-libs.x86_64 0:0.6.31-20.el7                      cups-
libs.x86_64 1:1.6.3-52.el7_9                      
gnutls.x86_64 0:3.3.29-9.el7_6                         libldb.x86_64
0:1.5.4-2.el7                            
libtalloc.x86_64 0:2.1.16-1.el7                        libtdb.x86_64
0:1.3.18-1.el7                          
libtevent.x86_64 0:0.9.39-1.el7                      
libwbclient.x86_64 0:4.10.16-25.el7_9                  
1.下载samba的安装包 yum install --downloadonly --downloaddir=./soft samba
2.查看rpm⽂件
3.使⽤createrepo指令。createrepo ./soft/
4.在soft⽬录中发现repodata
5.在/etc/yum.repos.d/soft.repo
5.
6.建⽴缓存 yum clean all && yum makecache
7.yum -y install samba
nettle.x86_64 0:2.7.1-9.el7_9                          pyldb.x86_64
0:1.5.4-2.el7                            
pytalloc.x86_64 0:2.1.16-1.el7                         python-
tdb.x86_64 0:1.3.18-1.el7                      
samba-client-libs.x86_64 0:4.10.16-25.el7_9            samba-
common.noarch 0:4.10.16-25.el7_9                
samba-common-libs.x86_64 0:4.10.16-25.el7_9            samba-common-
tools.x86_64 0:4.10.16-25.el7_9          
samba-libs.x86_64 0:4.10.16-25.el7_9                   trousers.x86_64
0:0.3.14-2.el7                        
完毕!
[root@localhost soft]#
[soft]
name=soft
baseurl=file:///root/soft/
gpgcheck=0
enable=1
使⽤光盘创建本地仓库
mount -o ro /dev/sr0 /mnt
引⼊镜像仓库 aliyun。tentxun。
qinghua'
mirror
⾃建仓库
 
 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值