Automated Deployment Essentials-building a yum Warehouse

Source: Internet
Author: User

Introduction:

Yum is primarily used to automatically install and upgrade RPM packages, which automatically find and resolve dependencies between RPM packets. To successfully install the Update software or system using the Yum tool, you need to have a repository (software repository) with a variety of RPM packages, which we are used to as a Yum source. There are a lot of Yum sources on the network, but due to the network environment, the software installation takes too long or even fails. The slow progress bar is unbearable, especially when there are a large number of server packages that need to be installed. Therefore, when we optimize the system, we will replace the domestic source.

In comparison, the biggest advantage of the local Yum source server is the fast network connectivity and stability of the LAN. With the Yum source server in the LAN, even if the Internet connection is interrupted, the software installation and upgrade of other Yum clients will not be affected.

1. Create a Yum repository directory
Mkdir-p/application/yum/centos6.6/x86_64/cd/application/yum/centos6.6/x86_64/rz # Upload RPM package to this directory, this directory can also include folders
2. Installing the Createrepo Software

yum -y install createrepo

3. Initializing the Repodata index file
createrepo-pdo/application/yum/centos6.6/x86_64//application/yum/centos6.6/x86_64/
4. Provision of Yum Services
# you can use Apache or Nginx to provide Web services, but Python HTTP module is more simple, suitable for intranet environment Cd/application/yum/centos6.6/x86_64/python-m Simplehttpserver &>/dev/null & can be viewed via browser input to native IP.
5. Add a new RPM package
# only download software does not install Yumdownloader pcre-devel openssl-devel Createrepo--update/application/yum/centos6.6/x86_64/# Every RPM package will be updated.

Usually yum does not remove the installation package when installing the software

# cat/etc/yum.conf keepcache=1# Install package storage directory cachedir=/var/cache/yum/$basearch/$releasever #/var/cache/yum/x86_64/6/base /packages
6. Client Configuration
# cd /etc/yum.repos.d[[email protected] yum.repos.d]# vi oldboy.repo[oldboy] name=serverbaseurl=http://10.0.0.5enable=1gpgcheck=0[[email protected] ~]# yum -- enablerepo=oldboy --disablerepo=base,extras,updates,epel list #  Specifies the use of the Oldboy library 

[[email protected] ~]# cd/etc/yum.repos.d/[[email protected] yum.repos.d]# vim centos-base.repo# at each starting source plus # Enabled=0 #改为1就启用, it is also enabled without this parameter. [base]............enabled=0[updates]............enabled=0[extras]............enabled=0# also has other open warehouses to use this method to close.
7. Image Yum Source

The image synchronization public network Yum source upstream Yum Source must support the Rsync protocol, otherwise it cannot be synchronized using rsync. Http://mirrors.ustc.edu.cn/status/CentOS official Standard Source: Rsync://mirrors.ustc.edu.cn/centos/epel Source: rsync:// mirrors.ustc.edu.cn/epel/sync command:#  using rsync to synchronize Yum sources, I only synced the CentOS6 RPM package to save bandwidth, disk, and download time, so all RPM packages only take up 21G, All synchronization needs about 300G. #  synchronization base source, small tricks, we install the system's disc image contains some RPM package, about 3G, these do not have to re-download. /usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/ /data/yum_data/centos/6/os/ x86_64//usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /data/yum_data/ centos/6/extras/x86_64//usr/bin/rsync -av rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/  /data/yum_data/centos/6/updates/x86_64/# epel Source/usr/bin/rsync -av --exclude=debug rsync:// MIRRORS.USTC.EDU.CN/EPEL/6/X86_64/ /DATA/YUM_DATA/EPEL/6/X86_64/students use the intranet Yum source method #  can self-build an intranet DNS, if not, You can use the hosts resolution. echo  ' 192.168.0.200 mirrors.aliyun.com '  >>/etc/hosts results show [[Email protected] data ]# du -sh yum_data    21g     yum_data[[email protected] data]#  Tree -l 3 yum_data/yum_data/├── centos│   ├── 6│   │    ├── extras│   │   ├── os│   │    └── updates│   └── RPM-GPG-KEY-CentOS-6├── epel│    └── 6│       └── x86_64


Automated Deployment Essentials-building a yum Warehouse

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.