7.16 练习~

练习1.插⼊优盘,读取优盘数据
[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    1 29.3G  0 disk 
└─sda1            8:1    1 29.3G  0 part 
sr0              11:0    1  8.8G  0 rom  /mnt
nvme0n1         259:0    0   20G  0 disk 
├─nvme0n1p1     259:1    0    1G  0 part /boot
└─nvme0n1p2     259:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
[root@localhost ~]# mount /dev/sda1 /usb
[root@localhost ~]# cd /usb
[root@localhost usb]# ls -l
总用量 6611216
drwxr-xr-x.  2 root root      16384 3月  22 06:26 ??
drwxr-xr-x.  2 root root      16384 7月   3 20:44 ?????
drwxr-xr-x.  3 root root      16384 3月  10 01:43 ??????
drwxr-xr-x.  2 root root      16384 8月  28 2023 ??1.????
-rwxr-xr-x.  1 root root    1328863 12月 24 2023 ???+2021531236 MySQL????.docx
-rwxr-xr-x.  1 root root     939302 10月 23 2023 ????_20231022202213.jpg
-rwxr-xr-x.  1 root root    5296705 12月 11 2021 21?????2????2021531236.zip
drwxr-xr-x. 10 root root      16384 4月   8 2022 c??
drwxr-xr-x.  2 root root      16384 5月  30 2023 Debug
-rwxr-xr-x.  1 root root    1985698 12月 19 2023 ???????.docx
-rwxr-xr-x.  1 root root    1985698 12月 19 2023 ???????.docx
-rwxr-xr-x.  1 root root      63516 12月 20 2023 ????.docx
drwxr-xr-x.  2 root root      16384 6月  11 2023 ????Java
-rwxr-xr-x.  1 root root    1365740 6月   3 2023 jd-gui-windows-1.6.6.zip
drwxr-xr-x.  3 root root      16384 12月 25 2023 KingsoftData
-rwxr-xr-x.  1 root root          1 5月  24 17:54 ~$??.pptx
-rwxr-xr-x.  1 root root   27211305 7月  10 17:43 Python-3.12.4.tgz
-rwxr-xr-x.  1 root root  177152000 5月  22 2018 RHEL7-extras.iso
-rwxr-xr-x.  1 root root 3183450112 5月  22 2018 RHEL7OSP-10.iso
drwxr-xr-x.  2 root root      16384 3月  12 17:59 System Volume Information
-rwxr-xr-x.  1 root root 3368839168 5月  21 09:12 windows_server_2008_r2.iso

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

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0              11:0    1  8.8G  0 rom  /mnt
nvme0n1         259:0    0   20G  0 disk 
├─nvme0n1p1     259:1    0    1G  0 part /boot
└─nvme0n1p2     259:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
[root@localhost ~]# ls /mnt
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

练习3.配置阿⾥云yum仓库、

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2024-07-16 16:54:34--  https://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 113.137.56.219, 113.137.56.223, 113.137.56.224, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|113.137.56.219|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”

100%[=====================================>] 2,523       --.-K/s 用时 0.03s   

2024-07-16 16:54:34 (98.3 KB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])

[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Base.repo.bak  hh.repo  nginx.repo  soft.repo
[root@localhost ~]# yum clean
已加载插件:fastestmirror
错误:清理命令需要参数:headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all
[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: a base extras nginx-stable soft updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
a                                                       | 3.6 kB     00:00     
base                                                    | 3.6 kB     00:00     
extras                                                  | 2.9 kB     00:00     
nginx-stable                                            | 2.9 kB     00:00     
soft                                                    | 2.9 kB     00:00     
updates                                                 | 2.9 kB     00:00     
(1/20): a/group_gz                                        | 166 kB   00:00     
(2/20): a/primary_db                                      | 5.9 MB   00:00     
(3/20): a/filelists_db                                    | 6.9 MB   00:00     
(4/20): a/other_db                                        | 2.5 MB   00:00     
(5/20): base/7/x86_64/group_gz                            | 153 kB   00:00     
(6/20): base/7/x86_64/primary_db                          | 6.1 MB   00:24     
(7/20): extras/7/x86_64/primary_db                        | 253 kB   00:01     
(8/20): base/7/x86_64/filelists_db                        | 7.2 MB   00:26     
(9/20): extras/7/x86_64/filelists_db                      | 305 kB   00:01     
(10/20): extras/7/x86_64/other_db                         | 154 kB   00:00     
(11/20): nginx-stable/7/x86_64/filelists_db               | 121 kB   00:00     
(12/20): soft/filelists_db                                | 6.3 kB   00:00     
(13/20): soft/other_db                                    | 9.8 kB   00:00     
(14/20): soft/primary_db                                  |  33 kB   00:00     
(15/20): nginx-stable/7/x86_64/other_db                   |  59 kB   00:00     
(16/20): nginx-stable/7/x86_64/primary_db                 |  97 kB   00:01     
(17/20): base/7/x86_64/other_db                           | 2.6 MB   00:11     
(18/20): updates/7/x86_64/filelists_db                    |  15 MB   00:56     
(19/20): updates/7/x86_64/other_db                        | 1.6 MB   00:06     
(20/20): updates/7/x86_64/primary_db                      |  27 MB   02:01     
元数据缓存已建立

练习4.配置清华镜像仓库

[root@aa ~]# wget -O https://mirrors.tuna.tsinghua.edu.cn/centos/7/readme

https://mirrors.aliyun.com/repo/Centos-7.repo
--2024-07-16 16:54:34--  https://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 113.137.56.219, 113.137.56.223, 113.137.56.224, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|113.137.56.219|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”

100%[=====================================>] 2,523       --.-K/s 用时 0.03s   

2024-07-16 16:54:34 (98.3 KB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Base.repo.bak  hh.repo  nginx.repo  soft.repo
[root@aa ~]# yum clean all
[root@aa ~]# yum makecache

练习5.配置腾讯镜像仓库

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
--2024-07-16 17:10:54--  http://mirrors.cloud.tencent.com/repo/centos7_base.repo
正在解析主机 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)... 150.138.251.98, 150.138.251.99, 240e:946:3009:1:8000:0:b00:98, ...
正在连接 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)|150.138.251.98|: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-16 17:10:54 (389 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [1694/1694])

[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: a extras nginx-stable os soft updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
a                                                       | 3.6 kB     00:00     
extras                                                  | 2.9 kB     00:00     
nginx-stable                                            | 2.9 kB     00:00     
os                                                      | 3.6 kB     00:00     
soft                                                    | 2.9 kB     00:00     
updates                                                 | 2.9 kB     00:00     
(1/20): a/group_gz                                        | 166 kB   00:00     
(2/20): a/primary_db                                      | 5.9 MB   00:00     
(3/20): a/other_db                                        | 2.5 MB   00:00     
(4/20): a/filelists_db                                    | 6.9 MB   00:00     
(5/20): extras/7/x86_64/primary_db                        | 253 kB   00:00     
(6/20): extras/7/x86_64/filelists_db                      | 305 kB   00:00     
(7/20): extras/7/x86_64/other_db                          | 154 kB   00:00     
(8/20): nginx-stable/7/x86_64/primary_db                  |  97 kB   00:01     
(9/20): nginx-stable/7/x86_64/filelists_db                | 121 kB   00:01     
(10/20): nginx-stable/7/x86_64/other_db                   |  59 kB   00:00     
(11/20): os/7/x86_64/group_gz                             | 153 kB   00:00     
(12/20): os/7/x86_64/filelists_db                         | 7.2 MB   00:01     
(13/20): soft/filelists_db                                | 6.3 kB   00:00     
(14/20): soft/other_db                                    | 9.8 kB   00:00     
(15/20): soft/primary_db                                  |  33 kB   00:00     
(16/20): os/7/x86_64/primary_db                           | 6.1 MB   00:01     
(17/20): os/7/x86_64/other_db                             | 2.6 MB   00:01     
(18/20): updates/7/x86_64/filelists_db                    |  15 MB   00:07     
(19/20): updates/7/x86_64/other_db                        | 1.6 MB   00:01     
(20/20): updates/7/x86_64/primary_db                      |  27 MB   00:10     
元数据缓存已建立

[root@localhost ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Base.repo.bak  hh.repo  nginx.repo  soft.repo

练习6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包

[root@localhost ~]# yum install --downloadonly --downloaddir=./zz/ tree 
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================
 Package         架构              版本                     源            大小
===============================================================================
正在安装:
 tree            x86_64            1.6.0-10.el7             a             46 k

事务概要
===============================================================================
安装  1 软件包

总下载量:46 k
安装大小:87 k
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@localhost ~]# yum install --downloadonly --downloaddir=./zz/ net-tools
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 net-tools.x86_64.0.2.0-0.22.20131004git.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================
 Package          架构          版本                            源        大小
===============================================================================
正在安装:
 net-tools        x86_64        2.0-0.22.20131004git.el7        a        305 k

事务概要
===============================================================================
安装  1 软件包

总下载量:305 k
安装大小:917 k
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@localhost ~]# yum install --downloadonly --downloaddir=./zz/ nginx
已加载插件: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
Background downloading packages, then exiting:
nginx-1.26.1-2.el7.ngx.x86_64.rpm                         | 807 kB   00:01     
exiting because "Download Only" specified
[root@localhost ~]# yum install --downloadonly --downloaddir=./zz/ bash-completion
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 bash-completion.noarch.1.2.1-6.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================
 Package                 架构           版本                   源         大小
===============================================================================
正在安装:
 bash-completion         noarch         1:2.1-6.el7            a          85 k

事务概要
===============================================================================
安装  1 软件包

总下载量:85 k
安装大小:259 k
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@localhost ~]# yum -y install createrepo
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 createrepo-0.9.9-28.el7.noarch 已安装并且是最新版本
无须任何处理
[root@localhost ~]# createrepo zz/
Spawning worker 0 with 1 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost ~]# ls zz
nginx-1.26.1-2.el7.ngx.x86_64.rpm  

bash-completion-2.1-8.el7.noarch.rpm          
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
repodata

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

[zz]
name=zz
baseurl=file:///root/zz
gpgcheck=1
enable=0
 

[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: a nginx-stable soft zz
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
a                                                       | 3.6 kB     00:00     
nginx-stable                                            | 2.9 kB     00:00     
soft                                                    | 2.9 kB     00:00     
zz                                                      | 2.9 kB     00:00     
(1/13): a/group_gz                                        | 166 kB   00:00     
(2/13): a/primary_db                                      | 5.9 MB   00:00     
(3/13): a/filelists_db                                    | 6.9 MB   00:00     
(4/13): a/other_db                                        | 2.5 MB   00:00     
(5/13): nginx-stable/7/x86_64/filelists_db                | 121 kB   00:01     
(6/13): soft/filelists_db                                 | 6.3 kB   00:00     
(7/13): soft/other_db                                     | 9.8 kB   00:00     
(8/13): zz/primary_db                                     | 2.8 kB   00:00     
(9/13): zz/other_db                                       | 1.0 kB   00:00     
(10/13): zz/filelists_db                                  | 1.4 kB   00:00     
(11/13): soft/primary_db                                  |  33 kB   00:00     
(12/13): nginx-stable/7/x86_64/other_db                   |  59 kB   00:00     
(13/13): nginx-stable/7/x86_64/primary_db                 |  97 kB   00:02     
元数据缓存已建立
 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值