了解常见的网络yum源及学会本地、网络yum源的配置

Day06

yum功能(具备缓存功能)

yum优点:

rpm -ivh,需手动添加依赖,而yum不止执行安装,相当于rpm升级,自动处理依赖管理

源码安装 configure  make && make install

[root@web2 ~]# ls -l /etc/yum.repos.d/  (查看现有的yum镜像仓库)

[root@web2 ~]# yum repolist all   (查看所有的镜像文件)

[root@web2 ~]# tar -zcvf /etc/yum.repos.d/bak.tar.gz /etc/yum.repos.d/*  (备份原有的镜像文件)

[root@web2 ~]# ls /etc/yum.repos.d/

bak.tar.gz  dvd.repo

[root@web2 ~]# rm -rf /etc/yum.repos.d/*.repo

[root@web2 ~]# ls /etc/yum.repos.d/

bak.tar.gz

[root@peter ~]# yum clean all   (清除缓存)

[root@web2 ~]# yum makecache (创建缓存)

[root@peter ~]# yum repolist   (列出仓库信息)

[root@peter ~]# yum update     (更新)

[root@peter ~]# yum list all     (查看所有软件)

[root@peter ~]# yum list installed   (列出已安装软件)

[root@peter ~]# yum list available   (列出可安装软件)

[root@peter ~]# yum reinstall software   (重新安装)

[root@peter ~]# yum remove software   (卸载)

[root@peter ~]# yum info software     (查看软件信息)

[root@peter ~]# yum history   (查看系统中软件管理信息)

[root@peter ~]#yum history info 数字   (对该数字为id的信息进行显示)

本地yum源备份

1、找到源⽂件

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

[root@localhost etc]# cd yum.repos.d/ # 当前在etc⽬录,跳转到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-communitydebuginfo.repo

[root@localhost yum.repos.d]# pwd

/etc/yum.repos.d

[root@localhost yum.repos.d]# tar -zcvf repo.tar.gz ./*.repo

[root@localhost yum.repos.d]# ls

3.删除所有的repo⽂件

[root@localhost yum.repos.d]# rm -rf ./*.repo

[root@localhost yum.repos.d]# ls

repo.tar.gz

man配置文件

在linux系统中,给定一个配置文件,如何查询文件中每个选项的作用

#man 5 配置文件名称

man 5 yum.con

mount挂载的练习

  1. 创建挂载目录

[root@web2 ~]#mkdir /cd

2、临时挂载  -o:挂载方式,ro=readonly(仅读)rw=read and write

[root@web2 ~]#mount -o ro /dev/sr0 /cd

3、将光盘数据挂载到/mnt目录中,就可以在目录中读取光盘的数据

[root@web2 ~]# lsblk  # 查看磁盘挂载情况

NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda               8:0    0   20G  0 disk

├─sda1            8:1    0    1G  0 part /boot

└─sda2            8:2    0   19G  0 part

  ├─centos-root 253:0    0   17G  0 lvm  /

  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]

sr0              11:0    1  8.8G  0  ro  /cd

4、解除挂载

[root@localhost ~]# umount /cd

[root@localhost ~]# ls /cd/

[root@localhost ~]# lsblk

NAME           MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda               8:0    0   20G  0 disk

"#sda1            8:1    0   1G  0 part /boot

$#sda2            8:2    0   19G  0 part

 "#centos-root 253:0    0   17G  0 lvm /

 $#centos-swap 253:1    0   2G  0 lvm [SWAP]

sr0              11:0    1  8.8G  0 rom

5、将挂载添加到开机自启文件中

[root@web2 ~]#chmod +x /etc/rc.local    # 添加权限

[root@web2 ~]#vim /etc/rc.local  # 法一:修改开机自启动文件

mount -o ro /dev/sr0 /cd

[root@web2 ~]#echo "mount -o ro /dev/sr0 /cd"  >> /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

6、编写本地repo文件

[root@peter ~]# vim /etc/yum.repos.d/local.repo

[root@peter ~]# cat /etc/yum.repos.d/local.repo

[local]

name=local

baseurl=file:///cd

gpgcheck=0  # 本地仓库不需要检测

enable=1

7、创建缓存,查看源列表

[root@web2 ~]#yum clean all  # 清理缓存

[root@web2 ~]# yum makecache

[root@web2 ~]# yum repolist  # 查看源仓库列表

8、测试

[root@localhost ~]# rpm -q httpd  # 查看是否安装httpd

httpd-2.4.6-99.el7.centos.1.x86_64

[root@localhost ~]# yum remove httpd  # 卸载httpd

[root@localhost ~]# rpm -q httpd  # 再次查看是否安装httpd

未安装软件包 httpd

[root@localhost ~]# yum -y install httpd

[root@localhost ~]# rpm -q httpd

未安装软件包 httpd

# 缺少依赖,安装失败

⽹络yum源的分离

1、备份

[root@localhost yum.repos.d]#mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

CentOS 7

[root@localhost yum.repos.d]#wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

或者

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

[root@localhost yum.repos.d]# ls  # 查看下载的⽂件

20240714001.repo CentOS-Base.repo repo.tar.gz

注意:wget报错处理无法解析主机或者无反应

root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

 在网卡中查看DNS,如果没有8.8.8.8加一个DNS上去

DNS=8.8.8.8

[root@localhost ~]# systemctl restart network

再次执行wget命令

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、运⾏ yum makecache⽣成缓存 yum clear

4、查看源

[root@localhost yum.repos.d]# yum repolist all

epel源配置

5、再次安装httpd

[root@localhost yum.repos.d]# yum -y install httpd

[root@localhost ~]# yum install --downloadonly --downloaddir=./soft/ samba

[root@localhost ~]# cd /var/cache/yum

腾讯镜像

下载文件

[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/CentOSBase.repo” [1694/1694])

更新缓存

[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

(14/14): updates/7/x86_64/primary_db

 | 27 MB 00:00:20

元数据缓存已建立

epel源配置  (对官方和官网源的扩展,有些软件找不到)

[root@localhost ~]# yum -y install epel-release

[root@localhost ~]# yum repolist all

[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

[root@localhost ~]# sl

特定软件源配置nginx

移除epel源,如果不行就全清空

百度搜nginx的镜像

[root@localhost ~]# rm -rf /etc/yum.repos.d/epel.repo

[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo # 安装稳定版本

创建缓存

[root@localhost ~]# yum clean all

[root@localhost ~]# yum makecache

[root@localhost ~]# yum list|grep nginx

nginx.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-debug.x86_64 1:1.8.0-1.el7.ngx

nginx-stable

nginx-debuginfo.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-geoip.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-geoip-debuginfo.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-image-filter.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-image-filter-debuginfo.x86_64

1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-njs.x86_64 1:1.26.1+0.8.5-2.el7.ngx

nginx-stable

nginx-module-njs-debuginfo.x86_64 1:1.26.1+0.8.5-2.el7.ngx

nginx-stable

nginx-module-perl.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-perl-debuginfo.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-xslt.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-module-xslt-debuginfo.x86_64 1:1.26.1-2.el7.ngx

nginx-stable

nginx-nr-agent.noarch 2.0.0-12.el7.ngx

nginx-stable

安装并且检查

[root@localhost ~]# yum install nginx -y

启动服务

[root@localhost ~]# nginx

查看指令

[root@localhost ~]# whereis nginx

nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx

/usr/share/man/man8/nginx.8.gz

访问服务器

[root@localhost ~]# curl http://localhost

<!DOCTYPE html>

<html>

<head>

<title>Welcome to nginx!</title>

<style>

html { color-scheme: light dark; }

body { width: 35em; margin: 0 auto;

font-family: Tahoma, Verdana, Arial, sans-serif; }

</style>

</head>

<body>

<h1>Welcome to nginx!</h1>

<p>If you see this page, the nginx web server is successfully installed

and

working. Further configuration is required.</p>

<p>For online documentation and support please refer to

<a href="http://nginx.org/">nginx.org</a>.<br/>

Commercial support is available at

<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>

</body>

</html>

[root@localhost ~]# nginx -s stop  # 停⽤nginx

[root@localhost ~]# curl http://localhost  #访问测试

curl: (7) Failed connect to localhost:80; 拒绝连接

缓存某些软件到本地

  1. 修改配置文件:

[root@localhost ~]#vim /etc/yum.conf

[main]

cachedir=/var/cache/yum/$basearch/$releaserver # 定义软件包缓存路径

keepcache=1   # 修改为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

2、测试 :卸载,然后安装tree,查看缓存文件

[root@localhost ~]#yum -y remove tree

[root@localhost ~]#yum -y install tree

[root@localhost ~]# find /var/cache/ -name "*tree*" -type   #查找安装包

/var/cache/yum/x86_64/7/os/packages/tree-1.6.0-10.el7.x86_64.rpm

只下载不安装

[root@localhost ~]# yum install --downloadonly --downloaddir=./soft

samba(Linux和unix上实现共享的软件)

[root@localhost ~]# ls soft/   # 存在.rpm文件

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 中有新邮件

自建yum仓库

  1. 安装createrepo制作仓库的软件并下载samba的安装包

[root@localhost ~]# yum -y install createrepo

[root@localhost ~]# yum install --downloadonly --downloaddir=./soft samba

  1. 查看rpm⽂件

[root@localhost ~]#cd soft/

[root@localhost soft]# ls

folder mysqlcommunity-libs-8.4.1-1.el7.aarch64.rpm

mysql84-community-release-el7-1.noarch.rpm

mysqlcommunity-libs-compat-8.4.1-1.el7.aarch64.rpm

mysql-community-client-8.4.1-1.el7.aarch64.rpm

3、安装createrepo制作仓库的软件

[root@localhost ~]# yum -y install createrepo

4、把soft⽂件夹做成⼀个本地的自建仓库

[root@localhost ~]# createrepo ./soft/

[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

5、在/etc/yum.repos.d/下创建soft.repo

[root@localhost soft]#vim /etc/yum.repos.d/soft.repo

[soft]

name=soft_local

gpgcheck=0

baseurl=file:///root/soft

enable=1

yum clean all

yum makecac

[root@localhost soft]# rm -rf /etc/yum.repos.d/*.repo  # 删除其他仓库⽂件

[root@localhost soft]# ls /etc/yum.repos.d/

repo.tar.gz

[root@localhost soft]# vim /etc/yum.repos.d/soft.repo  # 配置仓库⽂件

6、建⽴缓存 yum clean all && yum makecache

[root@localhost soft]# yum clean all   # 创建缓存

7、再次安装samba

[root@localhost soft]# yum -y install samba

## 练习

1.插⼊优盘,读取优盘数据

2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件

在vmware中装载centos7.6光盘镜像

3.配置阿⾥云yum仓库

(1)备份

[root@localhost yum.repos.d]#mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup

(2)下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

CentOS 7

[root@localhost yum.repos.d]#wget -O /etc/yum.repos.d/CentOS-Base.repo

https://mirrors.aliyun.com/repo/Centos-7.repo  

# -O  --output-document=文件,将数据写入此文件中。含义即为

将 http://mirrors.aliyun.com/repo/Centos-7.repo 文件中的数据写入到

/etc/yum.repos.d/CentOS-Base.repo文件中,CentOS-Base.repo文件不需要事先创

建。

或者

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

[root@localhost yum.repos.d]# ls  # 查看下载的⽂件

20240714001.repo CentOS-Base.repo repo.tar.gz

注意:wget报错处理无法解析主机或者无反应

root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

 在网卡中查看DNS,如果没有8.8.8.8加一个DNS上去

DNS=8.8.8.8

[root@localhost ~]# systemctl restart network

再次执行wget命令

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

(3)运行yum makecache生成缓存,然后清空内容 yum clear all

(4)查看源

[root@localhost yum.repos.d]# yum repolist all

(5)再次安装httpd

[root@localhost yum.repos.d]# yum -y install httpd

[root@localhost ~]# yum install --downloadonly --downloaddir=./soft/ samba

[root@localhost ~]# cd /var/cache/yum

(6)最终效果如图,yum源更换为国内阿里镜像源后,yum 安装或更新包的速

度非常快,保持在几MB/s。

有时候用阿里的yum源,会出现问题,“Could not resolve host:

mirrors.cloud.aliyuncs.com; Unknown error”

此时,阿里云 yum 源域名无法解析,那么我们就要考虑将阿里yum源换成别的

源,比如清华yum源。替换CentOS的yum 源 为 国内的yum源--清华yum源。

4.配置清华镜像仓库

(1)备份

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

(2)创建 /etc/yum.repos.d/

touch /etc/yum.repos.d/CentOS-Base.repo

(3)向 /etc/yum.repos.d/CentOS-Base.repo 写入清华大学yum源配置:

# CentOS-Base.repo

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

# CentOS-Base.repo

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

[base]

name=CentOS-$releasever - Base

baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

此时可以直接使用yum安装所需工具包。       

5.配置腾讯镜像仓库

(1)下载文件

[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/CentOSBase.repo” [1694/1694])

(2)更新缓存

[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

(14/14): updates/7/x86_64/primary_db

 | 27 MB 00:00:20

元数据缓存已建立

6.自建仓库,包含 tree net-tools bash-completion nginx tree等包

(1)修改配置文件

[root@localhost ~]# vim /etc/yum.conf

keepcache=1  #修改为1

  1. 卸载掉之前的软件

[root@localhost ~]# yum -y remove tree net-tools bash-completion nginx.x86_64 

  1. 再安装tree net-tools bash-completion nginx,查看缓存⽂件

[root@localhost ~]# yum -y install tree net-tools bash-completion nginx

(4)查找安装包

[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

[root@localhost ~]# find /var/cache/ -name "*net-tools *" -type f

[root@localhost ~]# find /var/cache/ -name "*bash-completion *" -type f

[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

(5)只安装不下载samba

[root@localhost ~]# yum install --downloadonly --downloaddir=./soft samba

(6)查看rpm⽂件

[root@localhost ~]#cd soft/

[root@localhost soft]# ls

folder mysqlcommunity-libs-8.4.1-1.el7.aarch64.rpm

mysql84-community-release-el7-1.noarch.rpm

mysqlcommunity-libs-compat-8.4.1-1.el7.aarch64.rpm

mysql-community-client-8.4.1-1.el7.aarch64.rpm

  • 22
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值