Ubuntu Mirror Setup Guide

To set up an Ubuntu mirror source, you can follow the steps below:

Step 1: Install Nginx
Install Nginx as the web server on an Ubuntu server using the following command.

sudo apt update
sudo apt install nginx

Step 2: Create a directory for storing image source files. You can use the following command to create the directory:

sudo mkdir -p /var/www/html/ubuntu

Step 3: Download Ubuntu image
Download the necessary Ubuntu image file from the official Ubuntu website. You can find available image files at https://ubuntu.com/download.

Step 4: Copy the image file to the directory
Copy the downloaded Ubuntu image file to the previously created image source directory. You can use the following command to copy the file to the directory:

sudo cp <path_to_downloaded_iso_file> /var/www/html/ubuntu

Step 5: Configuring Nginx
Edit the default Nginx configuration file to include the new mirror source. You can use the following command to open the default configuration file:

sudo nano /etc/nginx/sites-available/default

Add the following content in the server block:

location /ubuntu {
    alias /var/www/html/ubuntu;
    autoindex on;
}

Save and close the file. Then, reload the Nginx configuration.

sudo systemctl reload nginx

Step 6: Verify the mirror source
Access the IP address or domain name of the server, add the “/ubuntu” path to verify if the mirror source is correctly configured. For example, if the server’s IP address is 192.168.1.100, you can enter “http://192.168.1.100/ubuntu” in a browser to verify.

Step 7: Configure the client to use the mirror source
Edit the source list file on the Ubuntu client where the mirror source is needed in order to use the new mirror source. Use the following command to edit the file:

sudo nano /etc/apt/sources.list

Change the default source in the file to the URL of the mirror source. For example, if the server IP address is 192.168.1.100, change it to:

deb http://192.168.1.100/ubuntu focal main restricted universe multiverse

Save and close the file. Then update the package list.

sudo apt update

Now, the Ubuntu client will retrieve software packages and updates from the newly configured mirror source.

The above is the basic method for setting up an Ubuntu mirror source, which can be further configured and optimized according to actual needs.

bannerAds