Build a local yum source in Centos 7 (offline yum repository)

Source: Internet
Author: User

Build a local yum source in Centos 7 (offline yum repository)
System Configuration

  • Operating System: Centos7
  • Software:
1. Create the yum repository directory
mkdir -p /app/yum/centos6.6/x86_64
2. Install the createrepo Software

Online Installation

yum -y install createrepo

Offline installation and download path

Http://rpmfind.net/linux/rpm2html/search.php? Query = createrepo depends on the software http://rpmfind.net/linux/RPM/mageia/cauldron/armv5tl/media/core/release/createrepo-0.10.4-1.mga6.noarch.html

3. initialize the repodata index file

Createrepo-pdo/app/yum/centos6.6/x86_64/app/yum/centos6.6/x86_64

4. yum Service
# Web services can be provided using Apache or nginx, but http modules using Python are simpler, applicable to the Intranet environment cd/app/yum/centos6.6/x86_64 python-m SimpleHTTPServer 80 &>/dev/null & you can enter the local IP address in the browser to view.
5. Add a new rpm package
# Only download software without installing yumdownloader pcre-devel openssl-devel createrepo -- update/app/yum/centos6.6/x86_64/# update every time an rpm package is added

The installation package is not deleted when the yum software is installed.

# Cat/etc/yum. conf keepcache = 1 # installation 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 [root @ B yum. repos. d] # vi oldboy. repo [oldboy] name = Serverbaseurl = http: // 10.0.0.5enable = 1 gpgcheck = 0 [root @ YUM ~] # Yum -- enablerepo = oldboy -- disablerepo = base, extras, updates, epel list # specify that the oldboy library is used for temporary use of the Intranet yum source, to permanently and simply use the yum-y install lrzsz command, you need to modify the configuration file to disable the default repo file. [Root @ oldboy ~] # Cd/etc/yum. repos. d/[root @ oldboy yum. repos. d] # vim CentOS-Base.repo # enabled on each startup source # enabled = 0 # changed to 1, which is also enabled without this parameter. [Base] ...... Enabled = 0 [updates] ...... Enabled = 0 [extras] ...... Enabled = 0 # use this method to disable other enabled repositories.
7. Mirror yum Source
The above is just to put your own rpm package into the yum source. However, there is another enterprise requirement. To be more specific, the yum Installation Software for students is downloaded from the public network and occupies the bandwidth. Therefore, an Intranet yum server is set up in the school, however, considering that students also need to use yum to install software when they go home, if the database file repodata of the yum software is different, there will be problems. Therefore, the solution I came up with is to directly use the repodata from the Internet yum source. You must support the rsync protocol when synchronizing images from the Internet yum source to the game yum source. Otherwise, you cannot use rsync for synchronization. Uses rsync to synchronize the yum source. To save bandwidth, disk, and download time, I only synchronize the rpm packages of CentOS6, so that all the rpm packages only occupy 21 GB, it takes about GB to synchronize all data. # Tips for synchronizing the base source. The CD image we installed on the system contains part of the rpm package, which is about 3 GB. You do not need to download it again. /Usr/bin/rsync-av rsync: // users/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: // users/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 # You can build an intranet dns. If not, you can use hosts for resolution. Echo '2017. 168.0.200 mirrors.aliyun.com '>/etc/hosts result display [root @ KVM data] # du-sh yum_data 21G yum_data [root @ KVM data] # tree-L 3 yum_data/ ├ ── centos │ ── 6 │ ├ ── extras │ ── OS │ └ updatupdates │ └ ── RPM-GPG-KEY-CentOS-6 ├ ── epel │ ── 6 │ ── x86_64

Related Article

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.