Thursday, July 14, 2011

Local Ubuntu package repository

So I am trying to figure out the best way to create a local repository for Ubuntu (yes I am ashamed it is not for Debian) - Natty. So far I have come across this command for pulling down the packages - debmirror -v --host=archive.ubuntu.com --method=http --root=ubuntu --arch=i386 --dist=natty,natty-updates,natty-security --section=main,multiverse,restricted,universe --nosource --passive natty --ignore-release-gpg

Still working/researching if this is the best way and then how to point all the non-internet accessible machines to the one machine that debmirror was run on. Suggestions welcome!

2 comments:

  1. Debmirror program creates a local mirror of a Deban repository. A quick way to build an offline repository, save it to the docroot directory of your web server, and use it to upgrade computers on the same subnet without internet access:

    1. Install the application on a computer with internet:
    $ sudo apt-get install debmirror

    2. Get the key for the repository and add it to the keyring. This can be done be importing it from a debian keyring:
    $ gpg --no-default-keyring --keyring /home/USER/.gnupg/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg

    3. Download the repository (approximate sizes for different repositories can be found in the man page):
    $ sudo debmirror -a i386 --no-source -s main -h ro.archive.ubuntu.com -d natty,natty-updates,natty-security -r /ubuntu --progress -e http mirror

    This mirrors section main of Ubuntu 11.04 Natty, updates and security. All options are explained in the man page.

    4. Create a backup copy of sources.list file and modify it:
    $ sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
    $ sudo vim /etc/apt/sources.list

    Delete all content and add just:

    deb http://192.168.8.95/ natty main mulitverse restricted universe
    deb http://192.168.8.95/ natty-updates main mulitverse restricted universe
    deb http://192.168.8.95/ natty-security main mulitverse restricted universe

    5. Retrieve the new list of packages from the offline repository:
    $ sudo apt-get update

    6. Upgrade the repository:
    $ sudo apt-get upgrade

    7. Start installing packages....

    ReplyDelete