1. Although many free images provide Yum source services, it is necessary to establish your own Yum server, mainly for the following considerations:
L network speed: access to the Internet may be slow
L bandwidth saving: if there are a large number of servers, setting up your own Yum source can effectively save Internet bandwidth
L network restrictions: Some Intranet servers cannot connect to the Internet.
L for RHEL (Redhat Enterprise Linux), you need to purchase services
L easy release of self-developed RPM packages
2. Find the yum synchronization Source Suitable for your site, mainly centos standard software repository, epel, and rpmforge
Centos standard repository selection list
Asian:
Http://www.centos.org/modules/tinycontent/index.php? Id = 32
North American
Http://www.centos.org/modules/tinycontent/index.php? Id = 30
Epel source selection list
Http://mirrors.fedoraproject.org/publiclist/EPEL/
Rpmforge Source
Http://apt.sw.be/
Select the region nearest to your local server and support rsync to facilitate updates and synchronization.
I chose Linux kernel archives.
Centos standard software Repository
Rsync: // mirrors.kernel.org/centos
Epel Source
Rsync: // mirrors.kernel.org/fedora-epel
Rpmforge Source
Rsync: // ftp-stud.fht-esslingen.de/dag
Rsync: // mirror. CPSC. ucalgary. ca/DAG
3. Write a synchronization script for automatic synchronization as needed
[[Email protected] bin] # vi update_yum_source.sh
#! /Bin/bash
#===================================================== ===
# Program: update_yum_source.sh
# Info: regularly synchronize the official Yum source to the Local Machine
# Version: 2013.03.05 first release
#===================================================== ===
Date = 'date + % Y % m % d'
Logfile = "/tmp/update_yum_source.log"
Centostrunkver = "5"
Centoscurrentver = "5.9"
Rsyncbin = "/usr/bin/rsync"
Rsyncperm = "-AVRT -- delete -- exclude = debug/-- exclude = ISOs /"
Centos_trunk_ver_path = "/servers/yum_update/$ centostrunkver"
Centos_current_ver_path = "/servers/yum_update/$ centoscurrentver"
Yumsitelist = "rsync: // mirrors.kernel.org/centos"
Echo "---- $ date 'date + % t' begin ----"> $ logfile
# Centos 5
$ Rsyncbin $ rsyncperm $ yumsitelist/$ centostrunkver/
$ Centos_trunk_ver_path/> $ logfile
# Centos 5.9
$ Rsyncbin $ rsyncperm $ yumsitelist/$ centoscurrentver/
$ Centos_current_ver_path/> $ logfile
Echo "---- $ date 'date + % t' end ----"> $ logfile
[[Email protected] bin] # vi update_epel_source.sh
#! /Bin/bash
#===================================================== ===
# Program: update_epel_source.sh
# Info: regularly synchronize the official epel source to the Local Machine
# Version: 2013.03.05 first release
#===================================================== ===
Date = 'date + % Y % m % d'
Logfile = "/tmp/update_epel_source.log"
Rsyncbin = "/usr/bin/rsync"
Rsyncperm = "-AVRT -- delete -- exclude = 4/-- exclude = 4as/-- exclude = 4es/-- exclude = 4ws/-- exclude = 6/-- exclude = testing /"
#============== Epel ====================
Epelsite = "rsync: // mirrors.kernel.org/fedora-epel"
Epellocalpath = "/servers/epel"
Echo "---- $ date 'date + % t' begin ----"> $ logfile
# Epel
$ Rsyncbin $ rsyncperm $ epelsite $ epellocalpath >>$ logfile
Echo "---- $ date 'date + % t' end ----"> $ logfile
[[Email protected] bin] # vi update_rpmforge_socure.sh
#! /Bin/bash
#===================================================== ===
# Program: update_rpmforge_source.sh
# Info: regularly synchronize the official rpmforge source to the Local Machine
# Version: 2013.03.05 first release
#===================================================== ===
Date = 'date + % Y % m % d'
Logfile = "/tmp/update_rpmforge_source.log"
Rsyncbin = "/usr/bin/rsync"
Rsyncperm = "-AVRT -- delete -- exclude = i386/-- exclude = PPC/-- exclude = source /"
# Rpmforge
# Rpmforgesite = "rsync: // apt. Sw. be/RedHat/EL5/en /"
Rpmforgesite = "rsync: // ftp-stud.fht-esslingen.de/dag/redhat/el5/en /"
Rpmforgelocalpath = "/servers/rpmforge"
Echo "---- $ date 'date + % t' begin ----"> $ logfile
# Rpmforge
$ Rsyncbin $ rsyncperm $ rpmforgesite $ rpmforgelocalpath> $ logfile
Echo "---- $ date 'date + % t' end ----"> $ logfile
4. Make a soft connection in the Apache configuration file or modify the main directory pointing
CD/var/www/html/
Ln-S/servers/yum_update/yum
Ln-S/servers/epel
Ln-S/servers/rpmforge
5. Create three repo configuration files respectively, pointing to the server where the local source is located. Pay attention to the directory
[[E-mail protected] yum. Repos. d] # vi CentOS-Base.repo
[Base]
Name = centos-$ releasever-Base
Baseurl = http: // 172.25.6.8/Yum/$ releasever/OS/$ basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
# Released updates
[Updates]
Name = centos-$ releasever-Updates
Baseurl = http: // 172.25.6.8/Yum/$ releasever/updates/$ basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
Name = centos-$ releasever-Addons
Baseurl = http: // 172.25.6.8/Yum/$ releasever/Addons/$ basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = centos-$ releasever-extras
Baseurl = http: // 172.25.6.8/Yum/$ releasever/extras/$ basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = centos-$ releasever-plus
Baseurl = http: // 172.25.6.8/Yum/$ releasever/centosplus/$ basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
# Contrib-packages by centos users
[Contrib]
Name = centos-$ releasever-contrib
Baseurl = http: // 172.25.6.8/Yum/$ releasever/contrib/$ basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
[[Email protected] yum. Repos. d] # vi epel. Repo
[Epel]
Name = extra packages for Enterprise Linux 5-$ basearch
Baseurl = http: // 172.25.6.8/epel/5/$ basearch
Failovermethod = Priority
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-EPEL
[Epel-debuginfo]
Name = extra packages for Enterprise Linux 5-$ basearch-Debug
Baseurl = http: // 172.25.6.8/epel/5/$ basearch/debug
Failovermethod = Priority
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-EPEL
Gpgcheck = 1
[Epel-source]
Name = extra packages for Enterprise Linux 5-$ basearch-Source
Baseurl = http: // 172.25.6.8/epel/5/srpms
Failovermethod = Priority
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-EPEL
Gpgcheck = 1
[[Email protected] yum. Repos. d] # vi rpmforge. Repo
[Rpmforge]
Name = RHEL $ releasever-rpmforge.net-Dag
Baseurl = http: // 172.25.6.8/rpmforge/$ basearch/rpmforge
Enabled = 1
Protect = 0
Gpgkey = file: // etc/pki/rpm-GPG-key-rpmforge
Gpgcheck = 1
[Rpmforge-extras]
Name = RHEL $ releasever-rpmforge.net-extras
Baseurl = http: // 172.25.6.8/rpmforge/$ basearch/extras
Enabled = 0
Protect = 0
Gpgkey = file: // etc/pki/rpm-GPG-key-rpmforge
Gpgcheck = 1
[Rpmforge-testing]
Name = RHEL $ releasever-rpmforge.net-Testing
Baseurl = http: // 172.25.6.8/rpmforge/$ basearch/Testing
Enabled = 0
Protect = 0
Gpgkey = file: // etc/pki/rpm-GPG-key-rpmforge
Gpgcheck = 1
6. Check whether the GPG key is complete.
[[Email protected] ~] # Ll/etc/pki/rpm-GPG/
Total 24
-RW-r -- 1 Root 1512 Apr 25 2010 rpm-GPG-key-beta
-RW-r -- 1 Root 1504 Apr 25 2010 RPM-GPG-KEY-CentOS-5
-RW-r -- 1 Root 1698 Apr 15 2012 RPM-GPG-KEY-EPEL
If the GPG key is missing, you can use RPM to import it.
# On the local Yum source server
Wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
Music RPM-GPG-KEY.dag.txt rpm-GPG-key-rpmforge
# Run the command on the client that requires Yum Installation
Rpm -- import http: // 172.25.6.8/rpmforge/rpm-GPG-key-rpmforge
7. test whether the three Yum sources are feasible
# Condition Cache
[[Email protected] ~] # Yum clean all
Loaded plugins: fastestmirror
Cleaning up everything
# List available repositories with a total of 22465 available packages
[[Email protected] ~] # Yum repolist
Repo ID repo name status
Addons enabled: 0 CentOS-5-Addons
Base enabled: 3,641 CentOS-5-Base
Epel enabled: 7,244 extra packages for Enterprise Linux 5-x86_64
Extras enabled: 266 CentOS-5-extras
Rpmforge enabled: 11,158 RHEL 5-rpmforge.net-Dag
Updates enabled: 156 CentOS-5-Updates
Repolist: 22,465
Test centos standard software Repository
[[Email protected] ~] # Yum install NSPR nspr-devel
Loaded plugins: fastestmirror
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package NSPR. i386. 9.2-2. el5_9 set to be updated
---> Package NSPR. x86_64. 9.2-2. el5_9 set to be updated
---> Package nspr-devel.i386. 9.2-2. el5_9 set to be updated
---> Package nspr-devel.x86_64. 9.2-2. el5_9 set to be updated
--> Finished dependency resolution
Test epel
[[Email protected] ~] # Yum install nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up install process
Resolving Dependencies
--> Running transaction check
---> Package nginx. x86_64. 8.55-2. EL5 set to be updated
--> Processing dependency: libxslt. so.1 () (64bit) for package: nginx
--> Processing dependency: libgd. so.2 () (64bit) for package: nginx
--> Processing dependency: libexslt. so.0 () (64bit) for package: nginx
--> Processing dependency: libgeoip. so.1 () (64bit) for package: nginx
--> Running transaction check
---> Package geoip. x86_64. 4.8-1. EL5 set to be updated
---> Package GD. x86_64 2. 0.33-9.4.el5 _ 4.2 set to be updated
--> Processing dependency: pkgconfig for package: Gd
--> Processing dependency: libxpm. so.4 () (64bit) for package: Gd
---> Package libxslt. x86_64. 1.17-4. el5_8.3 set to be updated
--> Running transaction check
---> Package libxpm. x86_64. 5.5-3 set to be updated
---> Package pkgconfig. x86_64 1:0. 21-2.el5 set to be updated
--> Finished dependency resolution
Test rpmforge
[[Email protected] ~] # Yum install htop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Rpmforge
Setting up install process
Resolving Dependencies
--> Running transaction check
---> Package htop. x86_64. 0.2-1. el5.rf set to be updated
--> Finished dependency resolution