How to build a local Ubuntu mirror server

Source: Internet
Author: User

To install and build a local Ubuntu mirror server on your computer, you can reduce time when installing other common tools! So how to build it! Let's take a look at it!

I. Demand analysis

A recent requirement for the company's software team is: Can you build an Ubuntu mirror server on your LAN,

The advantage of this is that you can save the installation time for some of the most common tools in Ubuntu.

Two. Deployment process

2.1 Test environment

Currently there is an Ubuntu machine in the company that can connect to the extranet, ip:192.168.8.173,

The Ubuntu version is for Ubuntu 9.04 i686.

2.2 Setup Steps

To create an Ubuntu mirror server, you need at least 60G of hard disk space, each version of Ubuntu has a bit

And the bit two versions, there are two sets of Deb bags. Of course you can create Ubuntu a version of the bit and the bit

mirror server, you can also create a full version of the mirror.

This uses the Sohu company's mirror address as the local Ubuntu Source server, and the reason for using Sohu is:

1. Sohu's Ubuntu Source server is very fast

2. Sohu's Ubuntu Source server synchronizes with the Ubuntu official server every day, which will protect

We are using the latest package.

The way to modify it is as follows:

ROOT@MS ~: cat/etc/apt/sources.list

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

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

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

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

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

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

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

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

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

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

Install the following tools:

ROOT@MS ~: Apt-get Install Apt-mirror

ROOT@MS ~: Apt-get Install Apache2

Here's an example of a local Ubuntu mirror server that builds Ubuntu 9.04 32bit to illustrate how to configure:

To modify a configuration file:

ROOT@MS ~: cat/etc/apt/mirror.list

############# Config ##################

#

# set Base_path/var/spool/apt-mirror

#

# set Mirror_path $base _path/mirror

# set Skel_path $base _path/skel

# set Var_path $base _path/var

# set Cleanscript $var _path/clean.sh

# set Defaultarch

# set Postmirror_script $var _path/postmirror.sh

Set Run_postmirror 0

Set Nthreads 20

Set _tilde 0

#

############# End Config ##############

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

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

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

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

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

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

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

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

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

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

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

Note:

deb-i386 http://says download the bit version of Deb software

Deb http://means download the 64bit version of the Deb software

Jaunty says the Ubuntu 9.04 code.

When the settings are complete, enter the following command:

ROOT@MS ~: Apt-mirror

At this point the system will start 20 threads running wget to http://mirrors.sohu.com/Ubuntu download the corresponding

Deb bag. The length of time comparison, after the execution of this command is complete, the/var/spool/apt-mirror directory has all the required

The Deb package you want and the corresponding configuration file.

Since I was downloaded from the Sohu, the actual files are:

The/var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu directory.

This allows you to have all the files you need for the Ubuntu Source server locally, and then open the appropriate service:

This uses apache2 as the Web server, the default root is in/var/www/, so you can do it in the directory

Links, as follows:

ROOT@MS ~: cd/var/www

ROOT@MS ~: ln/var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu-s

To open a Web service:

Root@ms ~: Apache2ctl Start

Open the browser and enter the following address to see the same page as Sohu Mirror:

Http://192.168.8.173/ubuntu

You can also use crontab to make daily updates and modify the configuration files:

ROOT@MS ~: Cat/etc/cron.d/apt-mirror

#

# Regular Cron Jobs for the Apt-mirror package

#

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

Remove the "#" in front of the command so that 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 can be as follows:

ROOT@MS ~: cat/etc/apt/sources.list

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

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

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

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

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

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

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

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

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

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

Perform "Apt-get Update" to rebuild the local index, which will later be updated using the local mirror server.

Summary: Above is installs and constructs the local Ubuntu mirror server The concrete method, hoped that the netizen can have the help Oh!

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.