LINUX系统管理--简易配置YUM源

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]$

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值