读取数据文件及部分平台yum网络源配置

练习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@web1 ~]# mv /etc/yum.repos.d/soft.repo /etc/yum.repos.d/soft.repo.bak
[root@web1 ~]# ls /etc/yum.repos.d/
bak.tar.gz  CentOS-Base.repo.bak  local.repo.backup  soft.repo.bak
[root@web1 ~]# 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@web1 ~]# yum clean all 
结果:
[root@web1 ~]# 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.配置清华镜像仓库


镜像支持结束,官网无CentOS7镜像


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


指令:
[root@web1 ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
[root@web1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://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@web1 ~]# 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@web1 ~]# 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等包


指令:
[root@web1 ~]# vim /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
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@web1 ~]# yum -y install --downloadonly --downloaddir=./soft/ tree net-tools bash-completion nginx
[root@web1 ~]# ls soft/
avahi-libs-0.6.31-20.el7.x86_64.rpm            pyldb-1.5.4-2.el7.x86_64.rpm
bash-completion-2.1-8.el7.noarch.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
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
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm  trousers-0.3.14-2.el7.x86_64.rpm
nginx-1.26.1-2.el7.ngx.x86_64.rpm
[root@web1 ~]# yum -y install createrepo
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 createrepo-0.9.9-28.el7.noarch 已安装并且是最新版本
无须任何处理
[root@web1 ~]# createrepo soft/
Spawning worker 0 with 11 pkgs
Spawning worker 1 with 10 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@web1 ~]# vim /etc/yum.repos.d/soft.repo
[soft]
name=soft
baseurl=file:///root/soft/
gpgcheck=0
enable=1
[root@web1 ~]# yum clean all
[root@web1 ~]# yum makecache 
结果:
[root@web1 ~]# 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                          os                         46 k

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

总下载量:46 k
安装大小:87 k
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm                                                                              |  46 kB  00:00:00     
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@web1 ~]# yum -y install net-tools
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 net-tools.x86_64.0.2.0-0.22.20131004git.el7 将被 升级
---> 软件包 net-tools.x86_64.0.2.0-0.25.20131004git.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================================
 Package                      架构                      版本                                         源                     大小
=================================================================================================================================
正在更新:
 net-tools                    x86_64                    2.0-0.25.20131004git.el7                     os                    306 k

事务概要
=================================================================================================================================
升级  1 软件包

总下载量:306 k
Downloading packages:
No Presto metadata available for os
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm                                                             | 306 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                    1/2 
  清理        : net-tools-2.0-0.22.20131004git.el7.x86_64                                                                    2/2 
  验证中      : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                    1/2 
  验证中      : net-tools-2.0-0.22.20131004git.el7.x86_64                                                                    2/2 

更新完毕:
  net-tools.x86_64 0:2.0-0.25.20131004git.el7                                                                                    

完毕!
[root@web1 ~]# yum -y install bash-completion
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 bash-completion.noarch.1.2.1-6.el7 将被 升级
---> 软件包 bash-completion.noarch.1.2.1-8.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================================
 Package                              架构                        版本                             源                       大小
=================================================================================================================================
正在更新:
 bash-completion                      noarch                      1:2.1-8.el7                      os                       87 k

事务概要
=================================================================================================================================
升级  1 软件包

总下载量:87 k
Downloading packages:
No Presto metadata available for os
bash-completion-2.1-8.el7.noarch.rpm                                                                      |  87 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 1:bash-completion-2.1-8.el7.noarch                                                                           1/2 
  清理        : 1:bash-completion-2.1-6.el7.noarch                                                                           2/2 
  验证中      : 1:bash-completion-2.1-8.el7.noarch                                                                           1/2 
  验证中      : 1:bash-completion-2.1-6.el7.noarch                                                                           2/2 

更新完毕:
  bash-completion.noarch 1:2.1-8.el7                                                                                             

完毕!
[root@web1 ~]# yum -y install nginx
[root@web1 ~]# yum -y install 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                      807 k

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

总计:807 k
安装大小: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 
----------------------------------------------------------------------

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                                                                                                

完毕!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值