1.插⼊优盘,读取优盘数据
指令:
[root@web1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 49G 0 part
├─centos-root 253:0 0 45.1G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
sdb 8:16 1 29.3G 0 disk
└─sdb1 8:17 1 29.3G 0 part
sr0 11:0 1 8.8G 0 rom /mnt
[root@web1 ~]# mkdir /media/myusb
[root@web1 ~]# mount /dev/sdb1 /media/myusb/
[root@web1 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 46G 7.2G 38G 16% /
devtmpfs 224M 0 224M 0% /dev
tmpfs 236M 0 236M 0% /dev/shm
tmpfs 236M 5.7M 230M 3% /run
tmpfs 236M 0 236M 0% /sys/fs/cgroup
/dev/sda1 1014M 142M 873M 14% /boot
/dev/sr0 8.8G 8.8G 0 100% /dvd
tmpfs 48M 0 48M 0% /run/user/0
/dev/sdb1 30G 25G 4.9G 84% /media/myusb
结果:
[root@web1 ~]# ls /media/myusb/
?? 7 Audiobooks kugoumusic Pictures ??.pptx
?? 8 DCIM LOST.DIR Podcasts Ringtones
??? 9 Documents Movies ??????.pptx System Volume Information
??? a Download Music ?????.pptx ?????Web???????????2023.docx
~$???1.xlsm Alarms eNSP Notifications ?????.pptx web????-??????????.doc
?????(3)(1)(1)(1).pptx Android java.rtf ???????????????.pdf ???.pptx ~$???.xlsm
2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件
指令:
[root@web1 ~]# mount -o ro /dev/sr0 /mnt/
[root@web1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 49G 0 part
├─centos-root 253:0 0 45.1G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
sr0 11:0 1 8.8G 0 rom /mnt
结果:
[root@web1 ~]# 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
3.配置阿⾥云yum仓库
[root@tdr ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2024-07-16 16:47:49-- https://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 140.249.108.222, 140.249.108.219, 140.249.108.217
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|140.249.108.222|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
100%[=======================================================================================>] 2,523 --.-K/s 用时 0.008s
2024-07-16 16:47:49 (299 KB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])
[root@tdr ~]# yum clean all
[root@tdr ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/10): base/7/x86_64/primary_db | 6.1 MB 00:00:23
(3/10): extras/7/x86_64/primary_db | 253 kB 00:00:01
(4/10): extras/7/x86_64/filelists_db | 305 kB 00:00:01
(5/10): extras/7/x86_64/other_db | 154 kB 00:00:00
(6/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:27
(7/10): base/7/x86_64/other_db | 2.6 MB 00:00:10
(8/10): updates/7/x86_64/filelists_db | 15 MB 00:00:59
(9/10): updates/7/x86_64/other_db | 1.6 MB 00:00:07
(10/10): updates/7/x86_64/primary_db | 27 MB 00:01:47
元数据缓存已建立
4.配置清华镜像仓库
5.配置腾讯镜像仓库
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
--2024-07-16 17:06:13-- https://mirrors.cloud.tencent.com/repo/centos7_base.repo
正在解析主机 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)... 150.138.251.99, 150.138.251.98, 240e:946:3009:1:8000:0:b00:98, ...
正在连接 mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)|150.138.251.99|:443... 已连接。
已发出 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:06:13 (524 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [1694/1694])
[root@localhost ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: extras os 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
extras | 2.9 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): extras/7/x86_64/primary_db | 253 kB 00:00:00
(2/10): extras/7/x86_64/filelists_db | 305 kB 00:00:00
(3/10): extras/7/x86_64/other_db | 154 kB 00:00:00
(4/10): os/7/x86_64/group_gz | 153 kB 00:00:00
(5/10): os/7/x86_64/filelists_db | 7.2 MB 00:00:01
(6/10): os/7/x86_64/other_db | 2.6 MB 00:00:00
(7/10): os/7/x86_64/primary_db | 6.1 MB 00:00:01
(8/10): updates/7/x86_64/filelists_db | 15 MB 00:00:06
(9/10): updates/7/x86_64/other_db | 1.6 MB 00:00:00
(10/10): updates/7/x86_64/primary_db | 27 MB 00:00:07
元数据缓存已建立
6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包
不能用本地yum下载,这里用的是阿里云
[root@tdr ~]# yum -y remove tree
删除:
tree.x86_64 0:1.6.0-10.el7
完毕!
[root@tdr ~]# yum -y remove net-tools
删除:
net-tools.x86_64 0:2.0-0.22.20131004git.el7
作为依赖被删除:
mysql-community-server.x86_64 0:9.0.0-1.el7
完毕!
[root@tdr ~]# yum -y remove bash-completion
删除:
bash-completion.noarch 1:2.1-6.el7
完毕!
[root@tdr ~]# yum install --downloadonly --downloaddir=./soft tree
[root@tdr ~]# yum install --downloadonly --downloaddir=./soft net-tools
[root@tdr ~]# yum install --downloadonly --downloaddir=./soft bash-completion
[root@localhost ~]# createrepo soft/
[root@localhost ~]# cd soft/
[root@localhost soft]# ls
[root@localhost soft]# rm -rf /etc/yum.repos.d/*.repo
[root@localhost soft]# vim /etc/yum.repos.d/soft.repo
[soft]
name=soft_local
gpgcheck=0
baseurl=file:///root/soft
enable=1
[root@localhost soft]# yum clean all
[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
元数据缓存已建立
[root@tdr ~]# yum -y install 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 soft 46 k
事务概要
===========================================================================================
安装 1 软件包
总下载量:46 k
安装大小:87 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : tree-1.6.0-10.el7.x86_64 1/1
验证中 : tree-1.6.0-10.el7.x86_64 1/1
已安装:
tree.x86_64 0:1.6.0-10.el7
完毕!
[root@tdr ~]# yum -y install bash-completion.noarch
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 bash-completion.noarch.1.2.1-8.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
===========================================================================================
Package 架构 版本 源 大小
===========================================================================================
正在安装:
bash-completion noarch 1:2.1-8.el7 soft 87 k
事务概要
===========================================================================================
安装 1 软件包
总下载量:87 k
安装大小:263 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 1:bash-completion-2.1-8.el7.noarch 1/1
验证中 : 1:bash-completion-2.1-8.el7.noarch 1/1
已安装:
bash-completion.noarch 1:2.1-8.el7
完毕!
[root@tdr ~]# yum -y install net-tools.x86_64
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 net-tools.x86_64.0.2.0-0.25.20131004git.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
===========================================================================================
Package 架构 版本 源 大小
===========================================================================================
正在安装:
net-tools x86_64 2.0-0.25.20131004git.el7 soft 306 k
事务概要
===========================================================================================
安装 1 软件包
总下载量:306 k
安装大小:917 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
验证中 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
已安装:
net-tools.x86_64 0:2.0-0.25.20131004git.el7
完毕!