1.插⼊优盘,读取优盘数据
![](https://i-blog.csdnimg.cn/direct/0023a58a53f74ba4991e6256e9a1f4fd.png)
![](https://i-blog.csdnimg.cn/direct/611bc7f0ef3b4d858a06cf26556a33d7.png)
[root@b ~]# mkdir /usb/
[root@b ~]# mount -o ro /dev/sdb1 /usb/
[root@b ~]# cd /us
usb/ usr/
[root@b ~]# cd /usb/
[root@b usb]# ls
[root@b ~]# mount -o ro /dev/sdb1 /usb/
[root@b ~]# cd /us
usb/ usr/
[root@b ~]# cd /usb/
[root@b usb]# ls
2.在vmware配置光盘iso⽂件,在linux系统中读取光盘⽂件
![](https://i-blog.csdnimg.cn/direct/0023a58a53f74ba4991e6256e9a1f4fd.png)
[root@b ~]# mount -o ro /dev/sr0 /mnt/
[root@b ~]# ls /mnt/
3.配置阿⾥云yum仓库
[root@b ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# ls /etc/yum.repos.d/
CentOS-Base.repo
[root@b ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d
/CentOS-Base.repo.aly
4.配置清华镜像仓库
[root@b ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/centos/7/readme
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# yum clean all
[root@b ~]# yum makecache
5.配置腾讯镜像仓库
[root@b ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.tecent
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.tecent
6.⾃建仓库 包含 tree net-tools bash-completion nginx tree等包
[root@b ~]# cp /etc/yum.repos.d/CentOS-Base.repo.tecent /etc/yum.repos.d/CentOS-Base.repo
[root@b ~]# yum -y install epel-release
[root@b ~]# yum install --downloadonly --downloaddir=./soft/nginx nginx.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/tree tree.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/net-tools net-tools.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/bash-completion bash-completion.noarch
[root@b ~]# ls soft/
bash-completion net-tools nginx tree
[root@b ~]# ls soft/bash-completion/
bash-completion-2.1-8.el7.noarch.rpm
[root@b ~]# ls soft/net-tools/
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
[root@b ~]# ls soft/nginx/
centos-indexhtml-7-9.el7.centos.noarch.rpm
gperftools-libs-2.6.1-1.el7.x86_64.rpm
make-3.82-24.el7.x86_64.rpm
nginx-1.20.1-10.el7.x86_64.rpm
nginx-filesystem-1.20.1-10.el7.noarch.rpm
openssl-1.0.2k-26.el7_9.x86_64.rpm
openss111-libs-1.1.1k-7. el7. x86_64.rpm
openssl-libs-1.0.2k-26.el7_9.x86_64.rpm
[root@b ~]# ls soft/tree/
bash-completion-2.1-8.el7.noarch.rpm
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
[root@b ~]# yum -y install createrepo
[root@b ~]# createrepo soft/
[root@b ~]# ls soft/
bash-completion net-tools nginx repodata tree
[root@b ~]# vim /etc/yum.repos.d/soft.repo
[soft]
name=soft
baseurl=file:///root/soft/
gpgcheck=0
enable=1
[root@b ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# ls /etc/yum.repos.d/
soft.repo
[root@b ~]# yum -y install nginx //测试
[root@b ~]# yum -y install epel-release
[root@b ~]# yum install --downloadonly --downloaddir=./soft/nginx nginx.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/tree tree.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/net-tools net-tools.x86_64
[root@b ~]# yum install --downloadonly --downloaddir=./soft/bash-completion bash-completion.noarch
[root@b ~]# ls soft/
bash-completion net-tools nginx tree
[root@b ~]# ls soft/bash-completion/
bash-completion-2.1-8.el7.noarch.rpm
[root@b ~]# ls soft/net-tools/
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
[root@b ~]# ls soft/nginx/
centos-indexhtml-7-9.el7.centos.noarch.rpm
gperftools-libs-2.6.1-1.el7.x86_64.rpm
make-3.82-24.el7.x86_64.rpm
nginx-1.20.1-10.el7.x86_64.rpm
nginx-filesystem-1.20.1-10.el7.noarch.rpm
openssl-1.0.2k-26.el7_9.x86_64.rpm
openss111-libs-1.1.1k-7. el7. x86_64.rpm
openssl-libs-1.0.2k-26.el7_9.x86_64.rpm
[root@b ~]# ls soft/tree/
bash-completion-2.1-8.el7.noarch.rpm
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
[root@b ~]# yum -y install createrepo
[root@b ~]# createrepo soft/
[root@b ~]# ls soft/
bash-completion net-tools nginx repodata tree
[root@b ~]# vim /etc/yum.repos.d/soft.repo
[soft]
name=soft
baseurl=file:///root/soft/
gpgcheck=0
enable=1
[root@b ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@b ~]# yum clean all
[root@b ~]# yum makecache
[root@b ~]# ls /etc/yum.repos.d/
soft.repo
[root@b ~]# yum -y install nginx //测试