Four steps for configuring the local Ubuntu software repository with APT-mirror

Source: Internet
Author: User
Tags ftp server website ftp protocol rsync

If you have many computers that require software installation, security upgrades, and repair patches, configuring a local software repository is an efficient way to do this. All software packages to be installed can be downloaded from your local server through a fast LAN connection, which can save your network bandwidth and reduce the annual cost of Internet access...

You can use multiple tools to configure a local Ubuntu software repository on your local PC or server, but in this tutorial we will introduce you to APT-Mirror. Here, we will mirror the default image package to our local server or PC, and in your local or external hard disk, we need at least 120 GB or more available space. We can configure an HTTP or FTP server to share the software repository with the local system client.

We need to install the Apache network server and APT-Mirror to start our work. The steps for configuring a working local software repository are as follows:

1. Install the required software package


We need to get all the software packages from the public software package warehouse of Ubuntu, and then save them in our local Ubuntu Server hard disk.

First, install a Web server to host our local software repository. Here we will install the Apache Web server, but you can install any of your favorite Web servers. For http, Web servers are required. If you need to configure the ftp protocol and rsync protocol, you can also separately install the FTP server, such as proftpd, vsftpd, and Rsync.

$ Sudo apt-get install apache2

Then we need to install apt-mirror:

$ Sudo apt-get install apt-mirror



Note: As I mentioned earlier, we need at least 120 GB of available space for all software packages to be mirrored or downloaded.

2. Configure APT-Mirror

Now, create a directory on your hard disk to save all the software packages. For example, if we create a directory named/linoxide, we will save all the software packages in this directory:

$ Sudo mkdir/linoxide

Now open the file/etc/apt/mirror. list:

$ Sudo nano/etc/apt/mirror. list

Copy the following command line configuration to the mirror. list file and modify it as needed:

############# Config ##################
    #
Set base_path/linoxide
    #
# Set pai_path $ base_path/mirror
# Set skel_path $ base_path/skel
# Set var_path $ base_path/var
# Set cleanscript $ var_path/clean. sh
# Set defaultarch <running host architecture>
# Set postmir_script $ var_path/postmirror. sh
# Set run_postmirror 0
Set nthreads 20
Set _ tilde 0
    #
############ End config ##############
    
Deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
# Deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
# Deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
    
The deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
Deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
Deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
# Deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
# Deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
    
Clean http://archive.ubuntu.com/ubuntu

Note: You can change the official website of the backup storage Server to the address of the Server closest to you. You can find these Server addresses by visiting the Ubuntu Mirror Server. If you do not care too much about the image completion time, you can follow the default official image server website.

Here, we will mirror the latest and largest Ubuntu LTS release version --- Ubuntu 14.04 LTS (Trusty Tahr) --- package repository, so the version number in the above configuration is trusty. If we need to image Saucy or other Ubuntu release versions, please change the above trusy to the corresponding code.

Now, we must run apt-mirror to download or mirror all the software packages in the official repository.

Sudo apt-mirror

The time it takes to download all the software packages from the Ubuntu Server depends on the network connection speed and performance between you and the backup storage. Here I interrupted the download because I have downloaded it...



3. Configure the network server

To allow other computers to access this software repository, you need a Web server. You can also do this through ftp, but I chose to use a Web server because I mentioned using a Web server in step 1 above. Therefore, we need to configure the Apache server:

We will create a symbolic link to the Apache managed directory ---/var/www/ubuntu --- for our local software repository directory.

$ Sudo ln-s/linoxide/var/www/ubuntu
$ Sudo service apache2 start

The above Command will allow us to browse our image software repository from the local host (localhost) --- http: // 127.0.0.1 (by default.

4. Configure the client


Finally, we need to add software sources to other computers so that they can obtain software packages or software repositories from our computers. To achieve this goal, we need to edit the/etc/apt/sources. list file and add the following command:

$ Sudo nano/etc/apt/sources. list

Add the following line to/etc/apt/sources. list and save it.

Deb http: // 192.168.0.100/ubuntu/trusty main restricted universe

Note: 192.168.0.100 is the IP address of the Lan on our server computer. You need to replace it with the IP address of the Lan on your server computer.

$ Sudo apt-get update

Finally, we completed the task. Now, you can use the sudo apt-get install packagename command to install the required software package from your local Ubuntu software repository, which will be high-speed and consume a small amount of bandwidth.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.