Apt-mirror: Build local Ubuntu private source

Source: Internet
Author: User
First, we need to install apt-mirror $ sudoapt-getinstallapt-mirror. Suppose we put the image and other files under the/service/Ubuntu Folder: Please create the following folder (mirror. list prompts us to create a folder in advance):/service/ubuntu/mirror/service/ubuntu/skel/service/ubunt

First, we need to install apt-mirror.
$ Sudo apt-get install apt-mirror

Suppose we put images and other files in the/service/Ubuntu Folder:

Please create the following folder in advance (mirror. list prompts you to create a folder in advance ):

/Service/ubuntu
/Service/ubuntu/mirror
/Service/ubuntu/skel
/Service/ubuntu/var

Configure apt-mirror:

$ Sudo vi/etc/apt/mirror. list
--------------------------------------------------------------
############# Config ##################
#
# Set base_path/var/spool/apt-mirror
#
# If you change the base path you must create the directories below with write privlages
#
# 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

# Add or modify the following content:
Set base_path/service/ubuntu

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 nthreads 20
Set _ tilde 0
#
############ End config ##############

# It is enough to synchronize common software.
Deb-i386 http://archive.Ubuntu.com/ubuntu hard main restricted universe multiverse
Deb-i386 http://archive.ubuntu.com/ubuntu hard-updates main restricted universe multiverse
Deb-i386 http://archive.ubuntu.com/ubuntu hard-backports main restricted universe multiverse
Deb-i386 http://archive.ubuntu.com/ubuntu hard-security main restricted universe multiverse
Deb-i386 http://archive.ubuntu.com/ubuntu hard-proposed main restricted universe multiverse

# When some software packages are upgraded on the server or are no longer needed on the server, we use apt-mirror to synchronize with the server, A clean is generated under $ var_path. sh script to list legacy and useless software packages that are left locally. You can manually run this script to delete software packages that are left locally and are not needed.
Clean http://archive.ubuntu.com/ubuntu

-----------------------------------------------------------------------------

If you use a package in an amd64-bit architecture, you can add a deb-amd64 tag
If the format of deb http... is used directly without adding anything, only the software packages in the architecture used by the current system are synchronized in the same step. For example, in a 64-bit system, debhttp directly synchronizes only 64-bit software packages. If it is too troublesome, change set defaultarch directly. This parameter is good. For example, you can change it to set defaultarch i386, so that you can use the debhttp... format to synchronize only the i386 software package in the same step.

If you still want the source code, you can add the source code to the mirror. list for synchronization, such as adding the deb-src mark. You can append the corresponding tag for other things.

After configuration, We can synchronize with the specified image.
$ Sudo apt-mirror

If this is the first synchronization, it may take several days for the official image to complete synchronization. If it is synchronized with the domestic source, only common software will be synchronized, with an average speed of 1 Mbps (Byte) it takes about 5-8 hours to synchronize 30 GB of data.

After synchronization, we can use clean. sh to clear useless software packages (this document uses set base_path/server/ubuntu as an example ):
$ Sudo sh/service/ubuntu/var/clean. sh

After the update, you can use apache to publish the source image.

In the preceding excerpt, 64-bit source synchronization for 68 Gb is mirrors.163.com.

Configure apache2 below

Go to httpd. conf to modify
#
# AllowOverride none
# Require all denied
#

Change

Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all

In Add virtual directories to the node

Alias/ubuntu/workspace/ubuntu/mirror/mirrors.163.com/ubuntu

Add virtual directory permissions

Options Indexes FollowSymLinks
AllowOverride None
Require all granted

Because opengrok implements tomcat port forwarding
ProxyPass/source http: // localhost: 8081/source
ProxyPassReverse/source http: // localhost: 8081/source

Restart apache.

Configure source. list on the client

Sudo vim/etc/source. list

Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty main restricted
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-updates main restricted
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty universe
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-updates universe
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty multiverse
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-updates multiverse
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-backports main restricted universe multiverse
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-security main restricted
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-security universe
Deb [arch = amd64] http: // 192.168.19.184/ubuntu/trusty-security multiverse

Sudo apt-get update

Build local ubuntu-apt repository source http://www.linuxidc.com/Linux/2010-01/24284.htm for your Enterprise

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/2014-08/105415.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.