Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Necessary skills for automatic deployment-- Building YUM Warehouse

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Yum is mainly used to automatically install and upgrade rpm software packages. It can automatically find and solve the dependencies between rpm packages. To successfully install updated software or systems using YUM tools, you need to have a repository (software repository) containing various rpm packages, which we used to call the yum source. There are a large number of yum sources on the network, but due to the limitations of the network environment, the installation of the software takes too long or even fails. The slow progress bar is unbearable, especially when there are a lot of servers and a lot of software packages to install. Therefore, when we optimize the system, we will change the domestic source.

Comparatively speaking, the biggest advantage of local YUM source server is the fast network connection and stability of local area network. With the YUM source server in the local area network, even if the Internet connection is interrupted, it will not affect the software installation and upgrade of other YUM clients.

1. Create a yum warehouse directory

Mkdir-p / application/yum/centos6.6/x86_64/

Cd / application/yum/centos6.6/x86_64/

Rz # uploads rpm packages to this directory, and folders can also be included under this directory

two。 Install createrepo softwar

Yum-y install createrepo

3. Initialize the repodata index file

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

4. Provide yum services

# you can use Apache or nginx to provide web services, but using Python's http module is simpler and suitable for intranet environments

Cd / application/yum/centos6.6/x86_64/

Python-m SimpleHTTPServer 80 & > / dev/null &

You can view it by entering native IP through the browser.

5. Add a new rpm package

# download software only but not install it

Yumdownloader pcre-devel openssl-devel

Createrepo-update / application/yum/centos6.6/x86_64/

# update every time you add a rpm package.

Usually the installation package is not deleted when yum installs the software.

# cat / etc/yum.conf

Keepcache=1

# installation package Storage Directory Notes open

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 jiege.repo

[jiege]

Name=Server

Baseurl= http://192.168.169.10

Enable=1

Gpgcheck=0

[root@YUM] # yum-- enablerepo=jiege-- disablerepo=base,extras,updates,epel list

# specify to use jiege library

The above is the temporary use of private network yum source. If you want to use the yum-y install lrzsz command permanently and simply, you need to modify the configuration file to close the default repo file.

Cd / etc/yum.repos.d/

Vim CentOS-Base.repo

# add to each startup source

# enabled=0 # is enabled if it is changed to 1, or if this parameter is not used.

[base]

.

Enabled=0

[updates]

.

Enabled=0

[extras]

.

Enabled=0

# other open warehouses are closed using this method.

7. Mirror yum source

The above is just to put the self-made rpm package into the yum source. But there is also a kind of enterprise demand, to be more specific, the company's yum installation software is usually downloaded from the public network and takes up bandwidth, so an intranet yum server is built in the company, but considering that employees have to use yum installation software when they go home, if the database file repodata of yum software is different, there will be a problem. So the solution I can think of is to directly use the repodata of the public network yum source.

Mirror synchronization public network yum source

The upstream yum source must support the rsync protocol, otherwise rsync cannot be used for synchronization.

Http://mirrors.ustc.edu.cn/status/

Official standard source of CentOS: rsync://mirrors.ustc.edu.cn/centos/

Epel source: rsync://mirrors.ustc.edu.cn/epel/

Synchronization command:

# use rsync to synchronize yum sources. In order to save bandwidth, disk and download time, I only synchronized CentOS6 rpm packages, so that all rpm packages take up only 21G, and all synchronization takes about 300G.

# synchronize base feeds, tips. The CD image of our installation system contains some rpm packages, about 3G, so you don't have to download them again.

/ usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/ / data/yum_data/os/x86_64/

/ usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ / data/yum_data/extras/x86_64/

/ usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/ / data/yum_data/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 intranet yum source method

# you can build a private network dns. If not, you can use hosts to resolve it.

Echo '192.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/

Yum_data/

├── centos

│ ├── 6

│ │ ├── extras

│ │ ├── os

│ │ └── updates

│ └── RPM-GPG-KEY-CentOS-6

├── epel

│ └── 6

│ └── x86_64

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report