Ubuntu installation in Lan-build your own Deb source server

Source: Internet
Author: User
Because we need to install Ubuntu on multiple machines in the company, and we don't want to download the package to be installed from the Internet every time, so it's like using a package stored on a PC to create a simple lan library. In this way, every new package can be updated from this library, these new PCs do not need to be connected to the Internet.

Today, I have roughly studied the Deb server. Here I only talk about servers with HTTP access methods. It is actually a standard HTTP service, and all the packages are classified by some special directory names, for example, I use Ubuntu 7.04, which runs on the i386 platform, so that the main package is in the dists/feisty/main/binary-i386/sources file, this file contains information about all packages. APT-Get can find all packages and automatically download and install them.

The following is an example of how to generate this packages.gz file. I read some non-Ubuntu image libraries on the Internet and found a sh file. I made some modifications as follows (update. Sh)

#! /Bin/bash

# Quick package Updater

# John Dong (fixed by vinx)


# Licensed under the GPL.

Dists = "Feisty"

Sections = "Main"
Binary_arch = "binary-i386"

For a in $ dists; do

For B in $ sections; do

For C in $ binary_arch; do

If [-D dists/$ A/$ B/$ C]; then
Echo "Updating dists/$ A/$ B/$ C/packages"
Dpkg-scanpackages/var/Cache/APT/archives/dev/null | gzip-9> dists/$ A/$ B/$ C/packages.gz
Fi
Done
Done

Done

Here, the dpkg-scanpackages plugin searches for the Deb package in the specified directory and writes the package information to packages.gz. Here, I search for the packages installed in the current system and classify all the packages into the main of i386, which is convenient.

With the script, we can start to build a LAN library. First, install an apache2
Sudo apt-Get install apache2
Enter localhost in the browser to check whether Apache is started normally.

Enter/var/WWW, respectively create dists/feisty/main/binary-i386/directory, note that the directory owner should be changed to www-Data

Then execute the script:
Sudo sh update. Sh
The package file can be automatically generated. If any new package is added in the future, you just need to re-execute the script.

Find another PC and add Deb http: // yourip/feisty main to/etc/APT/sources. List.
Sudo apt-Get update
You can see the correct package from your library.

Then you can install all the packages without downloading them from the external server.

Here, a simple Deb library has been created, but some of my packages are not stored in the official source, so they are not stored in archives, I put them in different directories under/home/download/According to the Software category. For other PCs to install this package, I added an update Copy command to the script:
Sudo find/home/vinx/download/-name "*. Deb"-exec CP {}-U/var/Cache/APT/archives //;
Every time it looks for all the Deb packages from the download directory and updates them to the local package cache directory, so that all the packages can be accessed by other PCs :)

 

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.