Home  >  Article  >  System Tutorial  >  Use Centos to build an open source mirror site

Use Centos to build an open source mirror site

WBOY
WBOYforward
2024-02-29 14:30:24892browse

Building a mirror site requires three steps: find a faster domestic source, install and configure tomcat, and synchronize target source data.
用 Centos 搭建开源镜像站

domestic source

Domestic sources are also synchronized with foreign official servers. We need to find domestic sources that support rsync. You can search the keyword [centos mirror station] on Baidu or use my recommended Tsinghua University open source software mirror station https://mirrors4. tuna.tsinghua.edu.cn/centos/.

tomcat installation and configuration

Install

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24-fulldocs.tar.gz
tar -zxvf apache-tomcat-8.5.24-fulldocs.tar.gz

Configuration
Set the specified directory as the resource directory
用 Centos 搭建开源镜像站

Set tomcat to display the soft link directory
Tomcat installation directory / conf directory: context.xml file, add the allowLinking="true" attribute to .

Set up tomcat directory browsing
用 Centos 搭建开源镜像站

Official website address: https://tomcat.apache.org/

Link address: http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24-fulldocs.tar.gz

Sync source

The synchronization source is to synchronize the data of the domestic mirror station to the local centos.

    First create folders: centos basic source directory centos epel source directory
    Synchronize using rsync
    Set up scheduled tasks

Create Folder

mkdir -p /data/centos
mkdir -p /data/epel

Synchronize:

rsync -avrt rsync://mirrors4.tuna.tsinghua.edu.cn/centos/ /data/centos/
rsync -avrt rsync://mirrors4.tuna.tsinghua.edu.cn/epel/ /data/epel/

Scheduled tasks:
Write the above two lines of synchronization statements into the script yum_rsync.sh, vi /etc/crontab #Add the following code to the last line

0 1 * * * root /home/crontab/yum_rsync.sh #

Set to start executing the script at 1:00 a.m. every day, :wq! #Save and exit

service crond restart #重启

Finally, let me show you what the built mirror source looks like:
用 Centos 搭建开源镜像站

The above is the detailed content of Use Centos to build an open source mirror site. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete