Archive

Posts Tagged ‘repository’

Automatically Find Fastest Repository Server in Ubuntu 8.04

July 2nd, 2008 13 comments

I’ve blogged about this in the past but it seemed to be overlooked.  I blame the poor choice of title.  In any event, I figure it would be worth revisiting as I’ve had a few suggestions on it being a good topic.

note: Your mileage may vary.  I’ve seen these steps suggest a much faster repository and in other cases they can end up being slower.  Perhaps try two or three until you find a good one.

Updating Your Repository Server

Software packages and security updates are made available in Ubuntu by way of a software repository.  These repositories are mirrored all over the world, many times very close to where you live.  I, for example, have three mirrors within 50 miles of my house.  These are generally much faster than the core Ubuntu repositories.

To find a repository near you, or have your system scan for the fastest (which may or may not be local to you), you will need to launch the Software Sources tool.  This can be found in:

System > Administration > Software Sources

software sources

This administrative menu will allow you to change the location of your repository, and which items within the repository you want to subscribe to.  You will have the most software available if all boxes are checked.

other software sources

From here we’ll want to select “Other” from the drop-down menu and we’ll be provided with a list of available servers.

To have your system try and find the fastest server you can select the “Select Best Server” option, which will try to connect to each repository mirror and track the fastest responses.  The location selected when this process is done should be the fastest available mirror at that time.

select best server

Remember, repository mirror speeds can fluctuate based on traffic and other factors.  For best results you might try this scan periodically and find which mirrors are consistently the best for your location.  Enjoy!

Categories: Ubuntu Tags: , , ,

How To Create An Ubuntu Repository Mirror on Ubuntu 8.04

June 10th, 2008 13 comments

I was discussing the creation and maintenance of an Ubuntu repository mirror in IRC today and realized that I haven’t blogged about how to do that.  Its funny sometimes how topics pop up, and something I’ve been using for months never made it onto the blog.  In any event, below I’ll outline how to create your own Ubuntu repository mirror–great for consolidating and saving bandwidth for multiple machines!

Creating the Mirror

To create an Ubuntu repository mirror we’ll use the apt-mirror tool.  This can be installed by issuing the following command or clicking the link:

sudo aptitude install apt-mirror

Once this package is installed you’ll need to configure a few items:

  1. Where will your mirror be stored?
  2. How aggressive will you be about downloading?
  3. What do you want to mirror?

To edit these values you’ll want to edit the /etc/apt/mirror.list file.  I’ve displayed mine below, and broken it down into the three main sections.

Where Will Your Mirror Be Stored?

I’ve configured my apt-mirror to be stored on an external USB drive.  This is defined via the line:

set base_path      /media/gurudisk/UBUNTU/MIRROR

This overrides the default value, which stores the data in /var/spool/apt.

How Aggressive Will You Be About Downloading?

This title may be a bit misleading but this is the way I think about it.  Technically its the number of download threads you want to use.  The higher the number, the more threads, the faster its done.  This will depend on your bandwidth connection though.  On my home DSL I can’t put this number any higher than 2.  In faster locations you’ll be able to put the number much higher.  Your milage may vary.

set nthreads     2

What Do You Want To Mirror?

Now, the most important part, is what do you actually want to mirror?  The syntax for this section is pretty simple.  It looks just like a normal sources.list entry, but for each address you want to mirror.  Here is an example of my entry for Ubuntu 8.04, i386:

# Ubuntu 8.04 "Hardy" i386
deb-i386 http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

If you want amd64 bit mirrored you might add entries like this:

# Ubuntu 8.04 "Hardy" amd64
deb-amd64 http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-amd64 http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

Notice that I’m mirroring main, restricted, universe and multiverse plus the security, proposed, backports and updates sections.  This gives me a complete mirror of everything that would normally be available.  If you don’t want/need proposed or backports, etc you can simply remove those lines.

If you want to be able to use your mirror to support network based installations you’ll also need to add the following (depending on your architecture):

deb-amd64 http://archive.ubuntu.com/ubuntu hardy main main/debian-installer
deb-amd64 http://archive.ubuntu.com/ubuntu hardy restricted restricted/debian-installer
deb-amd64 http://archive.ubuntu.com/ubuntu hardy universe universe/debian-installer
deb-amd64 http://archive.ubuntu.com/ubuntu hardy multiverse multiverse/debian-installer

or

deb-i386 http://archive.ubuntu.com/ubuntu hardy main main/debian-installer
deb-i386 http://archive.ubuntu.com/ubuntu hardy restricted restricted/debian-installer
deb-i386 http://archive.ubuntu.com/ubuntu hardy universe universe/debian-installer
deb-i386 http://archive.ubuntu.com/ubuntu hardy multiverse multiverse/debian-installer

Basically just add the sources.list entry to this file for anything you want to mirror.  I also mirror Medibuntu and a few PPA locations.  It sure makes for faster installation when I am able to use the LAN as compared to the public tubes.

To keep your mirror updated activate the cron entry in /etc/cron.d/apt-mirror.  By default it will try to update your mirror at 4:00am, and it is disabled.  To activate it simply uncomment the line and change the 4 to the preferred hour of your choice.  Enjoy!

Update: My mirror, including main, restricted, universe, multiverse, -proposed, -backports, -security, Medibuntu and the network installation sections takes up 37G.  I do mirror i386 and amd64, so if you just need one architecture you could half-that.

Categories: Ubuntu Tags: , ,

Adding Additional Repositories

January 17th, 2008 5 comments

UPDATE: As it has been pointed out in the comments, all of the core repositories are enabled in Ubuntu 7.10. This post will only apply to users still on 6.10 and earlier.

It has been quite some time since I’ve outlined adding and customizing your repository setup on Ubuntu. I figure it’s time for a reminder post, and I’ll show you what I use on my machines.

Repositories

In order to download and install Ubuntu packages your machine needs to know where to find them. These packages are stored in different locations called repositories, which are organized into a few main groups. The group definitions are as follows:

  • main – supported by canonical, core repository.
  • restricted – supported by canonical, containing non-free software.
  • universe – community supported, strictly free software.
  • multiverse – community supported, containing non-free software.

By default only main and restricted are activated on a new machine. In order to follow many of my tutorials you’ll need the other two activated. (I know I haven’t done a great job of specifying which repository is needed for which package, but I’ll try and improve.)

To activate these you can use the graphical method or the commad line method. Both are pretty easy, I’ll outline each below:

Graphical Repository Configuration

Navigate to “System > Admin > Software Sources” and you’ll be presented with five check-boxes. By default you may only see two of these checked. Check the additional two (universe and multiverse), and you can safely leave the fifth item, source code, unchecked.

Command Line Repository Configuration

The method above is dead-easy, but you may also be working on a server that doesn’t have a GUI installed. In this case you may want to edit the file under-the-hood manually. You can find this file in /etc/apt/sources.list. My file looks like:

deb http://us.archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse

Each line should begin with deb, so if the browser or wordpress wraps the lines above, it should come to three lines when you edit your file.

By default you’ll have a bunch of other lines, and a lot of commented options. I find that my config should be a safe bet for most users. Note: you also may want to change your repository location, as mine is pointing to the US servers.

It is also common to find suggestions on using third-party repositories for other software. I, and most other members of the support community, HIGHLY avoid this. It can cause problems with current packages, and can cause issues with upgrading. Adding a repository other than the official Ubuntu repositories can limit the level of support you can recieve.

Categories: Ubuntu Tags:

How to add extra repositories : Ubuntu (5.10 / 6.06.1 / 6.10)

November 19th, 2006 No comments

This post is something that may be fairly basic for many of you, but extremely helpful for anyone new to using Ubuntu. In an attempt to be as comprehensive as I can with my tutorials I wanted to go back to the basics.

Ubuntu (and Debian) use a package management system called APT. This system uses a list of repositories to access updates and install programs specifically designed for your distribution and version. This system is generally more secure and more stable than other methods. Mainly for the reasons that access into these public repositories is kept very strict, and each package is thouroughly tested before it is included. Packages are also digitally signed for verification and security.
This tutorial will outline how to manually edit and update your repository source list to access whatever program you might need.

As usual, before editing any system file you will want to back it up. You should backup your sources.list file using the following command at a terminal:

sudo cp /etc/apt/sources.list /etc/apt/sources.list-backup

Below is an example of a sources list for Ubuntu including main, restricted, security, universe and multiverse. This will give you access to everything in the official Ubuntu repositories (over 20,000 packages)

# Ubuntu supported packages
deb http://archive.ubuntu.com/ubuntu edgy main restricted
deb http://archive.ubuntu.com/ubuntu edgy-updates main restricted
deb http://security.ubuntu.com/ubuntu edgy-security main restricted

# Ubuntu community supported packages
deb http://archive.ubuntu.com/ubuntu edgy universe multiverse
deb http://archive.ubuntu.com/ubuntu edgy-updates universe multiverse
deb http://security.ubuntu.com/ubuntu edgy-security universe multiverse

To update your current sources.list to this expanded list (by default the universe and multiverse are not activated) run the following command:

sudo gedit /etc/apt/sources.list

..and overwrite the contents of the existing file with the example above. Note: the example above does not include the “source” for these packages. Normal users generally don’t make use of the source for the packages. Unless you know you are going to be manually compiling and editing the source for the programs you don’t need to worry about it. If you do want the source simply add a duplicate line using the prefix deb-src instead of deb.
After you’ve made changes to your sources.list file you can update to the latest list using the command:

sudo aptitude update

At that point you can request any available updates using the command:

sudo aptitude upgrade

At this point the system will compare any current versions you have and install any upgrades that are available on the public repositories. Your system will automagically check for updates normally on a daily basis.
EDIT: To create a customized sources.list file based on your interests or needs you can visit the Source-O-Matic published by the Ubuntu Netherlands Team. (note: the source-o-matic currently only supports up to Dapper and NOT edgy.)

You may also be interested in my recent post, Seveas Repository.

technorati tags:, , , , , , , , ,

Categories: Ubuntu Tags: , ,