Build a local Ubuntu mirror server

Source: Internet
Author: User

I. Demand Analysis
can you build an Ubuntu mirror server on the LAN,
the benefit of this is that you can save the installation time for some of the most commonly used tools in Ubuntu.

two. Deployment Process

2.1 test Environment
Currently there is an Ubuntu machine in the company that can connect to the outside network, ip:192.168.8.173,
Ubuntu version for Ubuntu 9.04 i686.

2.2 Building Steps
in order to create Ubuntu mirror server, minimum 60G hard disk space, Ubuntu each version has a
and a two-bit version, there are two sets of deb packages. Of course you can create Ubuntu with a version of the + bit and the
mirror server, or you can create a full version of the image.

here the Sohu Company's mirror address is used as the local Ubuntu Source server, and the reason for using Sohu is:

1. Sohu Ubuntu Source Server is very fast
2. Sohu's Ubuntu Source server synchronizes with the official Ubuntu server once a day to
we are using the latest software package.

Modify the method as follows:

[Email protected] ~: cat/etc/apt/sources.list

  1. Deb Http://mirrors.sohu.com/ubuntu/jaunty main restricted universe multiverse

  2. Deb Http://mirrors.sohu.com/ubuntu/jaunty-security main restricted universe multiverse

  3. Deb Http://mirrors.sohu.com/ubuntu/jaunty-updates main restricted universe multiverse

  4. Deb http://mirrors.sohu.com/ubuntu/jaunty-proposed main restricted universe multiverse

  5. Deb Http://mirrors.sohu.com/ubuntu/jaunty-backports main restricted universe multiverse

  6. DEB-SRC Http://mirrors.sohu.com/ubuntu/jaunty main restricted universe multiverse

  7. DEB-SRC http://mirrors.sohu.com/ubuntu/jaunty-security main restricted universe multiverse

  8. DEB-SRC http://mirrors.sohu.com/ubuntu/jaunty-updates main restricted universe multiverse

  9. DEB-SRC http://mirrors.sohu.com/ubuntu/jaunty-proposed main restricted universe multiverse

  10. DEB-SRC http://mirrors.sohu.com/ubuntu/jaunty-backports main restricted universe multiverse




Install the following tools:
[Email protected] ~: Apt-get Install Apt-mirror
[Email protected] ~: Apt-get Install Apache2

Here's an example of building Ubuntu 9.04 32bit native Ubuntu mirror server to illustrate how to configure:
To modify a configuration file:

  1. [Email protected] ~: cat/etc/apt/mirror.list

  2. ############# Config ##################

  3. #

  4. # set Base_path/var/spool/apt-mirror

  5. #

  6. # set Mirror_path $base _path/mirror

  7. # set Skel_path $base _path/skel

  8. # set Var_path $base _path/var

  9. # set Cleanscript $var _path/clean.sh

  10. # set Defaultarch <running host architecture>

  11. # set Postmirror_script $var _path/postmirror.sh

  12. Set Run_postmirror 0

  13. Set Nthreads 20

  14. Set _tilde 0

  15. #

  16. ############# End Config ##############

  17. Deb-i386 http://mirrors.sohu.com/ubuntu Jaunty main restricted universe multiverse

  18. Deb-i386 http://mirrors.sohu.com/ubuntu jaunty-security main restricted universe multiverse

  19. Deb-i386 http://mirrors.sohu.com/ubuntu jaunty-updates main restricted universe multiverse

  20. #deb http://mirrors.sohu.comubuntu jaunty-proposed main restricted universe multiverse

  21. #deb http://mirrors.sohu.comubuntu jaunty-backports main restricted universe multiverse

  22. DEB-SRC http://mirrors.sohu.com/ubuntu Jaunty main restricted universe multiverse

  23. DEB-SRC http://mirrors.sohu.com/ubuntu jaunty-security main restricted universe multiverse

  24. DEB-SRC http://mirrors.sohu.com/ubuntu jaunty-updates main restricted universe multiverse

  25. #deb-src http://mirrors.sohu.com/ubuntu jaunty-proposed main restricted universe multiverse

  26. #deb-src http://mirrors.sohu.com/ubuntu jaunty-backports main restricted universe multiverse

  27. #clean Http://archive.ubuntu.com/ubuntu



Note:


    1. deb-i386/http = Download the version of the Deb software

    2. Deb/http = download 64bit version of Deb software

    3. Jaunty means Ubuntu 9.04 code.



when the settings are complete, enter the following command:

[email protected] ~: Apt-mirror

at this point the system will start 20 threads running wget to http://mirrors.sohu.com/Ubuntu download the corresponding
Deb Package. Time comparison is long, after the execution of the command, the/var/spool/apt-mirror directory has all the required
The desired Deb package and the corresponding configuration file.

since I downloaded it from Sohu, the actual file is in:
the/var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu directory.

this way, the local will have all the files required by the Ubuntu Source Server, and then turn on the appropriate services:
Apache2 is used here as a Web server, the default root directory is/var/www/, so you can do it in this directory
link, as shown below:

    1. [Email protected] ~: cd/var/www

    2. [Email protected] ~: ln/var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu-s




To open the Web service:
[Email protected] ~: Apache2ctl start

Open the browser and enter the address below to see the same page as Sohu Mirror:
Http://192.168.8.173/ubuntu

You can also use crontab for daily updates to modify the configuration file:


    1. [Email protected] ~: Cat/etc/cron.d/apt-mirror

    2. #

    3. # Regular Cron Jobs for the Apt-mirror package

    4. #

    5. #0 4 * * * apt-mirror/usr/bin/apt-mirror >/var/spool/apt-mirror/var/cron.log



Remove the "#" from the front of the command so the system will automatically use Apt-mirror to update the Sohu server.
Finally, all we have to do is modify the update source configuration file on the client machine and change the address to local
The address of the mirror server is as follows:


  1. [Email protected] ~: cat/etc/apt/sources.list

  2. Deb Http://192.168.8.173/ubuntu/jaunty main restricted universe multiverse

  3. Deb Http://192.168.8.173/ubuntu/jaunty-security main restricted universe multiverse

  4. Deb Http://192.168.8.173/ubuntu/jaunty-updates main restricted universe multiverse

  5. Deb http://192.168.8.173/ubuntu/jaunty-proposed main restricted universe multiverse

  6. Deb Http://192.168.8.173/ubuntu/jaunty-backports main restricted universe multiverse

  7. DEB-SRC Http://192.168.8.173/ubuntu/jaunty main restricted universe multiverse

  8. DEB-SRC http://192.168.8.173/ubuntu/jaunty-security main restricted universe multiverse

  9. DEB-SRC http://192.168.8.173/ubuntu/jaunty-updates main restricted universe multiverse

  10. DEB-SRC http://192.168.8.173/ubuntu/jaunty-proposed main restricted universe multiverse

  11. DEB-SRC http://192.168.8.173/ubuntu/jaunty-backports main restricted universe multiverse



Perform "Apt-get Update" to rebuild the local index so that it will be updated with the local mirror server later.


Build a local Ubuntu mirror server

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.