centos6.x rsync+httpd build configuration local Yum Source Library

Source: Internet
Author: User
Tags gpg ftp protocol rsync

I. Environmental description

The Yum Library, the Readhat/centos system software repository, can be used to transfer warehouses stored on the network via the HTTP FTP protocol, and Yum's main function is to easily add/remove/update RPM packages, automatically resolve package dependencies, and facilitate the management of a large number of System update maintenance package issues. The Yum library can be configured with multiple repositories (Repository), Concise configuration files (/etc/yum.conf), automatic resolution of dependency issues encountered when adding or removing RPM packages, and maintaining consistency with the RPM database.

This tutorial is to synchronize the open source Yum warehouse on the network to the local, configure the cost of the Yum warehouse (using CD-ROM, interested can configure the following yourself)

The system uses centos6.8_x64, rsync httpd, Sync centos6.x package to local, and add common RPM package to local yum Warehouse; test machine intranet IP is 10.168.118.93


Ii. installation of rsync and httpd

1. Install the Software

#yum Install rsync httpd-y

For the time being, rsync is used to synchronize from the extranet Yum Warehouse, and httpd is used to send local yum repositories

2, Configuration httpd

Modify the httpd configuration as follows (approximately 295 lines)

DocumentRoot "/data1/www/html/" #这个目录即下面脚本中同步外网yum仓库到本地的位置

3. Start httpd Service

#service httpd Start

#chkconfig--httpd on


Third, synchronous external network Yum script

1. Synchronization Scripts

#cat rsync_yum.sh

#!/bin/bashyum_site= "rsync://mirrors.kernel.org/centos/" #存放路径, I'm using a separate partition directory Local_path= "/data1/www/html/centos/ "#需要同步哪些目录LOCAL_VER = './' bw_limit=2048lock_file="/var/log/yum_server.pid "rsync_path=" "# check update  yum server pidmy_pid=$ $if  [ -f  $LOCK _file ]; thenget_pid= '/bin/cat   $LOCK _file ' get_system_pid= '/bin/ps -ef|grep -v grep|grep  $get _pid|wc -l ' if  [  $get _system_pid -eq 0 ] ; thenecho  $MY _pid> $LOCK _fileelseecho   "have update yum server now!" exit 1fielseecho  $MY _pid> $LOCK _filefi# check rsync toolif [ -z $ Rsync_path ]; thenrsync_path= '/usr/bin/whereis rsync|awk  '   ' {print $2} ' if  [ -z  $RSYNC _path ]; thenecho  ' Not find rsync tool. ' echo  ' Use comm: yum install -y rsync ' fifiverlist=6             #指定要同步的yum源, 6 is CentOS6, you can simultaneously synchronize multiple versions, separated by spaces # sync  yum source,only 6for ver in  $verlist;d o    $RSYNC _path -avzh  --delete --bwlimit= $BW _limit --exclude-from=/data1/workshell/exclude.txt  $YUM _site/$VER/ $ local_path/$VER/done# clean lock file '/bin/rm -f  $LOCK _file ' echo  ' rsync end  $ (date +%y-%m-%d_%k:%m:%s) " >> /data1/www/html/centos/centos_rsync_is_end.txtexit  1

2. Add script to scheduled task

Add a script to the CRONTABL schedule every Monday 3 o'clock in the morning to perform a synchronization

1 3 * * 1/data1/workshell/rsync_yum.sh 2>/dev/null


3. Perform the test manually

After synchronization, you can see the following directory structure:

650) this.width=650; "title=" Yum.png "src=" https://s5.51cto.com/wyfs02/M02/9A/2A/wKiom1lSKyWhX4_eAABE_ Nbmskq119.png-wh_500x0-wm_3-wmp_4-s_3485661470.png "alt=" Wkiom1lskywhx4_eaabe_nbmskq119.png-wh_50 "/>


4. Client Testing

Remove the repo warehouse that comes with the system, and create the Local.repo configuration content as follows:

#cd/etc/yum.repos.d/#mkdir bak#mv *.repo./bak

#cat Local.repo

[base]name=centos-basebaseurl=http://10.168.118.93/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http:// 10.168.118.93/centos/rpm-gpg-key-centos-6[updates]name=centos-updatesbaseurl=http://10.168.118.93/centos/$ releasever/updates/$basearch/gpgcheck=1gpgkey=http://10.168.118.93/centos/rpm-gpg-key-centos-6[extras]name= centos-extrasbaseurl=http://10.168.118.93/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=http:// 10.168.118.93/centos/rpm-gpg-key-centos-6

#yum Clean All

#yum Makecache

650) this.width=650; "title=" yum "src=" https://s5.51cto.com/wyfs02/M01/9A/2A/ Wkiol1lslnahkc5vaabmwk6wdf8635.png-wh_500x0-wm_3-wmp_4-s_2631129171.png "alt=" Wkiol1lslnahkc5vaabmwk6wdf8635.png-wh_50 "/>


#测试安装lftp

650) this.width=650; "title=" 1.png "style=" Float:none; "src=" https://s4.51cto.com/wyfs02/M02/9A/2B/ Wkiol1lslyzxsopxaadfzjwb5xa481.png-wh_500x0-wm_3-wmp_4-s_3290864111.png "alt=" Wkiol1lslyzxsopxaadfzjwb5xa481.png-wh_50 "/>

650) this.width=650; "title=" 2.png "style=" Float:none; "src=" https://s2.51cto.com/wyfs02/M00/9A/2A/ Wkiom1lslyzbc048aaibjabkxek425.png-wh_500x0-wm_3-wmp_4-s_2686010564.png "alt=" Wkiom1lslyzbc048aaibjabkxek425.png-wh_50 "/>


To this local yum warehouse configuration complete!


This article is from the "end of the school" blog, please be sure to keep this source http://dyc2005.blog.51cto.com/270872/1942480

centos6.x rsync+httpd build configuration local Yum Source Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.