1 httpyum源头
配置方案三 局域网共享yum源配置
有局域网时,当有多台机器需要配置本地同一yum源,我们不需要把每台服务器都单独配置并挂载镜像,
只要在一台服务器上配置好yum源。使用httpd服务即可让其他服务器正常访问。
##安装httpd服务
yum install -y httpd
##启动httpd服务
systemctl start httpd
##临时关闭防火墙
systemctl stop firewalld
#查看httpd是否启动
systemctl status httpd
##挂载镜像
mv /mnt/* centosiso.iso
mount /mnt/centosiso.iso /var/www/html/centosiso
##查看本机IP并访问就会出现测试页面
ip a
##访问机配置
##在一台机器上配置好httpd后选择局域网内其他机器配置yum源去访问此台服务器
cd /mnt/yum.repos.d/
mv -r * ..
echo "
[local]
name=net_bendiyum
baseurl=http://192.168.1.2/centosiso/
enabled=1
gpgcheck=0" > local.repo
yum clean all
yum makecache
yum repolist
2 配置本地yum源龙溪8.6
此种办法需要将龙溪everything上传到服务器。
mkdir /iso
mount -o loop /home/patrol/AnolisOS-8.6-QU1-x86_64-dvd.iso /iso
cd /etc/yum.repos.d/
ls
mkdir repobak
mv *.repo repobak/
cat >>base.repo <<EOF
[base_install]
name=oracle
baseurl=file:///iso/AppStream
enabled=1
gpgcheck=0
[base_install1]
name=oracle
baseurl=file:///iso/BaseOS
enabled=1
gpgcheck=0
EOF
yum clean all
yum makecache
yum install ftp -y
3 CentOS-7-x86_64-DVD-1511本地yum源
方案1
mkdir /iso
mount -o loop /soft/CentOS-7-x86_64-DVD-1511.iso /iso
rm –rf /etc/yum.repos.d/*
cat >> /etc/yum.repos.d/base.repo << EOF
[base_install]
name=oracle
baseurl=file:///iso
enabled=1
gpgcheck=0
EOF
vi /etc/rc.local
mount -o loop /soft/CentOS-7-x86_64-DVD-1511.iso /iso
yum clean all
yum makecache
yum list|grep has
方案2
[oracle@wgrac01 ~]$ more /etc/yum
yum/ yum.conf yum.repos.d/
[oracle@wgrac01 ~]$ more /etc/yum.repos.d/centos-
centos-base.repo
centos-debuginfo.repo centos-media.repo centos-vault.repo
centos-cr.repo centos-fasttrack.repo centos-sources.repo
[oracle@wgrac01 ~]$ more /etc/yum.repos.d/centos-base.repo
# centos-base.repo
#
# the mirror system uses the connecting ip address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. you should use this for centos updates
# unless you are manually picking other mirrors.
#
# if the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=centos-$releasever - base
baseurl=file:///iso
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7
[oracle@wgrac01 ~]$ cd /isd
-bash: cd: /isd: no such file or directory
[oracle@wgrac01 ~]$ cd /iso
[oracle@wgrac01 iso]$ ls
centos_buildtag eula images liveos repodata rpm-gpg-key-centos-testing-7
efi gpl isolinux packages rpm-gpg-key-centos-7 trans.tbl
[oracle@wgrac01 iso]$