Use APT-mirror to configure the Ubuntu local software repository in four steps

Source: Internet
Author: User
Tags server website ftp protocol
Today, we will show you how to configure the local software repository directly through the official Ubuntu software repository on your Ubuntu PC or Ubuntu server. Creating a local software repository on your computer has many benefits. 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 mutual

Today, we will show you how to configure the local software repository directly through the official Ubuntu software repository on your Ubuntu PC or Ubuntu server. Creating a local software repository on your computer has many benefits. 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 least120 GBOr more available space. We can configureHTTPOrFTPServers to share the software repository with Local System clients.

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.

  1. $ Sudo apt-get install apache2

Then we need to install apt-mirror:

  1. $ 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:

  1. $ Sudo mkdir/linoxide

Now, open the file/Etc/apt/mirror. list:

  1. $ Sudo nano/etc/apt/mirror. list

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

  1. ############# Config ##################
  2. #
  3. Set base_path/linoxide
  4. #
  5. # Set pai_path $ base_path/mirror
  6. # Set skel_path $ base_path/skel
  7. # Set var_path $ base_path/var
  8. # Set cleanscript $ var_path/clean. sh
  9. # Set defaultarch
  10. # Set postmir_script $ var_path/postmirror. sh
  11. # Set run_postmirror 0
  12. Set nthreads 20
  13. Set _ tilde 0
  14. #
  15. ############ End config ##############
  16.  
  17. Deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
  18. Deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
  19. Deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
  20. # Deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
  21. # Deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
  22.  
  23. The deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
  24. Deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
  25. Deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
  26. # Deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
  27. # Deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
  28.  
  29. 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.

  1. 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.

  1. $ Sudo ln-s/linoxide/var/www/ubuntu
  2. $ 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:

  1. $ Sudo nano/etc/apt/sources. list

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

  1. 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.

  1. $ 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.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-02/113853.htm

Related Article

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.