1:如果每台机器一个一个的部署,利用加载iso镜像特别占磁盘空间
下面利用一台机器部署yum源,然后将yum源发布的web服务器,其他虚拟机更改源地址即可
具体;
先挑选一台机器mini4,挂载一个系统光盘到本地目录/mnt/cdrom,然后启动一个httpd服务器,
将/mnt/cdrom 软连接到httpd服务器的/var/www/html目录中 (cd
/var/www/html; ln -s /mnt/cdrom ./centos )
然后通过网页访问测试一下: http://mini4/centos 会看到光盘的目录内容
至此:网络版yum私有仓库已经建立完毕
剩下就是去各台yum的客户端配置这个http地址到repo配置文件中
自己部署下:首先 我192.168.36.197 已经部署好yum源了
下面我吧此yum源 创建软连接,发布到web服务器上(httpd)
[root@hadoop html]# mkdir centos
[root@hadoop html]# ln -s /mnt/cdrom ./centos
浏览器:http://192.168.36.197/centos/
3:需要配置yum源的机器:
cd /etc/yum.repo.d
[root@hadoop yum.repos.d]# rename .repo .repo.bak *
[root@hadoop yum.repos.d]# ll
total 28
-rw-r--r--. 1 root root 1664 Aug 30 23:53 CentOS-Base.repo.bak
-rw-r--r--. 1 root root 1309 Aug 30 23:53 CentOS-CR.repo.bak
-rw-r--r--. 1 root root 649 Aug 30 23:53 CentOS-Debuginfo.repo.bak
-rw-r--r--. 1 root root 314 Aug 30 23:53 CentOS-fasttrack.repo.bak
-rw-r--r--. 1 root root 630 Aug 30 23:53 CentOS-Media.repo.bak
-rw-r--r--. 1 root root 1331 Aug 30 23:53 CentOS-Sources.repo.bak
-rw-r--r--. 1 root root 3830 Aug 30 23:53 CentOS-Vault.repo.bak
[root@hadoop yum.repos.d]# mv CentOS-Media.repo.bak CentOS-Media.repo
[root@hadoop yum.repos.d]# vi CentOS-Media.repo
file:///med/cdrom/
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media,verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo,put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo,do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=CentOS-yumlocal
baseurl=file:///192.168.36.197/centos/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
~
~
"CentOS-Media.repo" 21L,585C written
root@hadoop yum.repos.d]# yum repolist
Loaded plugins: fastestmirror,langpacks
file:///192.168.36.197/centos/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /192.168.36.197/centos/repodata/repomd.xml"
Trying other mirror.
file:///192.168.36.197/centos/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /192.168.36.197/centos/repodata/repomd.xml"
Trying other mirror.
repo id repo name status
c7-media CentOS-yumlocal 0
repolist: 0
olkkkkk
原文链接:https://www.f2er.com/bash/390341.html