How to set up a local mirror site in CentOS?

To set up a CentOS local mirror site, you can follow these steps:

  1. To download the CentOS image file, you first need to visit the official website or choose another reliable mirror site for downloading.
  2. Install an HTTP server:
    You need to install an HTTP server on your CentOS server, such as Apache or Nginx. You can use the following command to install Apache:
sudo yum install httpd
  1. Create a mirror site directory:
    Set up a directory to store CentOS image files, such as /var/www/html/centos. Unzip and place the downloaded CentOS image files in this directory.
  2. Setting up an HTTP server:
    Add a new virtual host in the configuration file of the HTTP server, and specify the root directory of the mirror site as the newly created directory. Restart the HTTP server to apply the configuration.
  3. Set up a local Yum repository by editing the configuration file (such as /etc/yum.repos.d/local.repo) and adding the following content:
[local]
name=Local CentOS Mirror
baseurl=http://yourserver/centos
enabled=1
gpgcheck=0
  1. Create Yum repository cache:
    Generate the cache of your local Yum repository on your CentOS server by executing the following command:
sudo yum makecache

You have now successfully set up a local CentOS mirror site, allowing other CentOS servers to update and install software by modifying the Yum repository configuration file to use your local mirror site.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds