1.插⼊优盘,读取优盘数据
2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件
![](https://i-blog.csdnimg.cn/direct/5da902a3bfc04d31bee62f5b788fd6b4.png)
[root@2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 18G 0 lvm /
└─centos-swap 253:1 0 1G 0 lvm [SWAP]
sr0 11:0 1 8.8G 0 rom
[root@2 ~]# ls /mnt
[root@2 ~]# mount /dev/cdrom /mnt
mount: /dev/sr0
写保护,将以只读方式挂载
[root@2 ~]# ls /mnt
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata
RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
[root@2 ~]# vim /etc/yum.repos.d/hh.repo
[a]
name=a
baseurl=file:///mnt
gpgcheck=0
[root@2 ~]# yum repolist
3.配置阿⾥云yum仓库
https://developer.aliyun.com/mirror/centos //
查找帮助文档
[root@2 ~]# ls /etc/yum.repos.d
hh.repo
[root@2 ~]# mv /etc/yum.repos.d/hh.repo /etc/yum.repos.d/hh.repo.backup
[root@2 ~]# ls /etc/yum.repos.d/
hh.repo.backup
[root@2 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo
https://mirrors.aliyun.com/repo/Centos-7.repo
![](https://i-blog.csdnimg.cn/direct/d7550925b11d401ab01834c233633c45.png)
[root@2 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo hh.repo.backup
[root@2 ~]# yum clean all
![](https://i-blog.csdnimg.cn/direct/c486a41aeaa641a2a6576ed7b3faf289.png)
[root@2 ~]# yum makecache
![](https://i-blog.csdnimg.cn/direct/d35475f2b45a4d8d9d05878851ff35ae.png)
[root@2 ~]# yum repolist
![](https://i-blog.csdnimg.cn/direct/8a4036ba0cb14161b6c2ae7ce8090acf.png)
4.配置清华镜像仓库
https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ //
查找帮助文档
[root@2 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS
Base.repo.backup
[root@2 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo.backup hh.repo.backup
5.配置腾讯镜像仓库
https://mirrors.tencent.com/
[root@2 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS
Base.repo.backup
[root@2 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo.backup hh.repo.backup
[root@2 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.cloud.tencent.com/repo/centos7_base.repo
![](https://i-blog.csdnimg.cn/direct/fe7fdb30547e411ca4b4e808ab1cb517.png)
[root@2 ~]# yum clean all
[root@2 ~]# yum makecache
[root@2 ~]# yum repolist
![](https://i-blog.csdnimg.cn/direct/ba14a93d47d34894ac1fb9b70b9d9b70.png)
6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包
vim /etc/yum.conf //
将
keepcache
后改为
1
![](https://i-blog.csdnimg.cn/direct/79b7385242b1496193b0d26c3ff802a1.png)
yum install --downloadonly --downloaddir=./soft net-tools
yum install --downloadonly --downloaddir=./soft bash-completion
yum install --downloadonly --downloaddir=./soft nginx
yum install --downloadonly --downloaddir=./soft tree
![](https://i-blog.csdnimg.cn/direct/757245af3e364895b84c1930d3bc54ef.png)
[root@2 ~]# ls soft/
bash-completion-2.1-8.el7.noarch.rpm net-tools-2.0-
0.25.20131004git.el7.x86_64.rpm
[root@2 ~]# yum -y install createrepo
[root@2 ~]# createrepo ./soft/
[root@2 ~]# ls soft/
bash-completion-2.1-8.el7.noarch.rpm net-tools-2.0-
0.25.20131004git.el7.x86_64.rpm repodata nginx-1.26.1-2.el7.ngx.x86_64.rpm
tree-1.6.0-10.el7.x86_64.rpm
[root@2 ~]# mv /etc/yum.repos.d/CentOS-Base.repo.repo
/etc/yum.repos.d/CentOS-Base.repo.txt
[root@2 ~]# mv /etc/yum.repos.d/nginx.repo /etc/yum.repos.d/nginx.repo.txt
[root@2 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS
Base.repo.txt
[root@2 ~]# yum clean all
[root@2 ~]# yum makecache
[root@2 ~]# yum -y install bash-completion.noarch
[root@2 ~]# yum -y install net-tools.x86_64
[root@2 ~]# yum -y install nginx
[root@2 ~]# yum -y install tree