当前位置:   article > 正文

linux yum配置公网,配置yum源并与公网同步更新

linux yum配置公网,配置yum源并与公网同步更新

服务器端:

1.服务器上YUM源同步网络YUM源

[root@host66 ~]# crontab -l

# rsync yum source

00 02 * * * /usr/bin/rsync -aqrtzH --delete --exclude=SRPMS/ --exclude=x86_64/ --exclude=isos/ rsync://rsync.muug.mb.ca/centos/5.4/  /var/ftp/pub/centos/i386/

2.服务器通过NFS共享YUM源

[root@host66 ~]# cat /etc/exports

/var/ftp/pub/cnetos/i386  *(ro,sync)

客户端:

1.将NFS源共享到本地:(有三种方法)

a.直接 mount 192.168.5.66:/var/ftp/pub/centos/i386 /var/ftp/pub/cnetos/i386 ,可将挂载写到/etc/rc.local(同前面的那样)

b.写到/etc/fstab中   192.168.5.66:/var/ftp/pub/centos/i386    /var/ftp/pub/centos/i386   nfs   ro,intr   0  0

c.通过autofs实现自动挂载

[root@host66 ~]# echo '/var/ftp/pub/centos/ /etc/auto.nfs' >> /etc/auto.master

[root@host66 ~]# echo 'i386 -fstype=nfs 192.168.5.66:/var/ftp/pub/centos/i386' >> /etc/auto.nfs

[root@host66 ~]# chkconfig autofs on

[root@host66 ~]# service autofs restart

2.配置.repo文件(备份/etc/yum.repos.d目录中所有文件到别的地方,然后将下面的写到里面)

[root@host66 ~]# cat /etc/yum.repos.d/local.repo

[updates]

name=CentOS-$releasever - Updates

baseurl=file:///var/ftp/pub/centos/i386/updates/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[base]

name=CentOS-$releasever - base

baseurl=file:///var/ftp/pub/centos/i386/os/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[fasttrack]

name=CentOS-$releasever - fasttrack

baseurl=file:///var/ftp/pub/centos/i386/fasttrack/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[extras]

name=CentOS-$releasever - extras

baseurl=file:///var/ftp/pub/centos/i386/extras/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[contrib]

name=CentOS-$releasever - contrib

baseurl=file:///var/ftp/pub/centos/i386/contrib/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[centosplus]

name=CentOS-$releasever - centosplus

baseurl=file:///var/ftp/pub/centos/i386/centosplus/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[addons]

name=CentOS-$releasever - addons

baseurl=file:///var/ftp/pub/centos/i386/addons/i386

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

好了,整个配置完成了,客户端可以正常使用YUM安装软件了

------------------------------------------------------------------------

以下部分是比较快的源同步实例:(测试均 通过)

rsync -avrtzH --delete --exclude=SRPMS/ --exclude=x86_64/ --exclude=isos/ rsync://rsync.kddilabs.jp/centos/5.4/  /tmp/centos/

rsync -avrtzH --delete --exclude=SRPMS/ --exclude=x86_64/--exclude=isos/rsync://rsync.muug.mb.ca/centos/5.4/  /tmp/centos/

rsync -avrtzH --delete --exclude=SRPMS/ --exclude=x86_64/--exclude=isos/rsync://mirror.aarnet.edu.au/centos/5.4/  /tmp/centos/

RSYNC源同步服务器可在下面链接查找:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/542255
推荐阅读
相关标签
  

闽ICP备14008679号