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

Use Centos to build an open source mirror site

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2024-02-29 14:30:24
forward
1129 people have browsed it

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
Copy after login

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
Copy after login

Synchronize:

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

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 #
Copy after login

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

service crond restart #重启
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template