Como criar um repositório Ubuntu

6

Click here to load reader

description

 

Transcript of Como criar um repositório Ubuntu

Page 1: Como criar um repositório Ubuntu

How To Create An Ubuntu Repository Mirror onUbuntu 8.04

June 10th, 2008 Christer Edwards Leave a comment Go to comments

If you're new here, you may want to subscribe to my RSS feed. Thanks forvisiting!

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

Creating the Mirror

To create an Ubuntu repository mirror we’ll use the apt-mirror tool. This can beinstalled 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:

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

To edit these values you’ll want to edit the /etc/apt/mirror.list file. I’ve displayedmine 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 isdefined 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 thenumber, the more threads, the faster its done. This will depend on your

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

1 de 6 21-06-2011 14:51

Page 2: Como criar um repositório Ubuntu

number, the more threads, the faster its done. This will depend on yourbandwidth connection though. On my home DSL I can’t put this number anyhigher 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? Thesyntax for this section is pretty simple. It looks just like a normal sources.listentry, but for each address you want to mirror. Here is an example of my entryfor 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 thesecurity, proposed, backports and updates sections. This gives me a completemirror of everything that would normally be available. If you don’t want/needproposed or backports, etc you can simply remove those lines.

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

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

2 de 6 21-06-2011 14:51

Page 3: Como criar um repositório Ubuntu

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 tomirror. I also mirror Medibuntu and a few PPA locations. It sure makes forfaster installation when I am able to use the LAN as compared to the publictubes.

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. Toactivate it simply uncomment the line and change the 4 to the preferred hour ofyour choice. Enjoy!

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

Categories: Ubuntu Tags: apt-mirror, mirror, repository

Related Posts

Automatically Find Fastest Repository Server in Ubuntu 8.04Apt-Cacher and Apt-Mirror : RevisitedFive Tips to Prepare for Release Day!Adding Additional RepositoriesHow to add extra repositories : Ubuntu (5.10 / 6.06.1 / 6.10)

Comments (12) Leave a comment

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

3 de 6 21-06-2011 14:51

Page 4: Como criar um repositório Ubuntu

Ian BartonJune 21st, 2008 at 03:14 | #1Reply | Quote

Nice tutorial. However, note that the default ubuntu config file is /etc/apt/mirror.list, so you should run the update:

apt-mirror -c /etc/apt/mirror.list

The config file name in the original article was wrongly specified asapt-mirror.

Ian.

1.

Ian BartonJune 23rd, 2008 at 01:54 | #2Reply | Quote

Whoops… made a mistake myself:) The correct command is:

apt-mirror /etc/apt/mirror.list

Ian.

2.

NiccoJune 23rd, 2008 at 08:24 | #3Reply | Quote

So after creating the repository mirror how does one access it from theclient computers?

-Thank You

3.

Christer EdwardsJune 23rd, 2008 at 19:56 | #4Reply | Quote

@Nicco – simply update the clients to point to something like:

deb http://ip.address.of.mirror/ubuntu hardy main restricted, etc..

It’ll require that the mirror machine has some web server installed(apache, lightty, etc). Otherwise its the same format as normal, just usingyour local IP vs the public address.

4.

NiccoJune 24th, 2008 at 11:32 | #5

5.

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

4 de 6 21-06-2011 14:51

Page 5: Como criar um repositório Ubuntu

June 24th, 2008 at 11:32 | #5Reply | Quote

Thank You!

DPJune 30th, 2008 at 17:25 | #6Reply | Quote

Hi Christer,

I’m a little unclear about the syntax in the mirror.list file.

Is it necessary to list the d-i packages as:

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

?

Can the debian-installer branches be listed as:

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

Or just incorporated into the first set?

Also, I’ve found that mirroring the d-i packages under updates and securitybreaks my network install: ie. placing:

deb http://archive.ubuntu.com/ubuntu hardy-security main/debian-installer

Resulted in a broken install. I had to clean and and purge the mirror. Anyidea why this is the case?

Thanks for the tutorial.

-DP

6.

JohnnieAugust 21st, 2008 at 18:52 | #7Reply | Quote

I am doing your steps into Hardy Heron but I can´t do than it works. I giveme an error from ../bin/apt-mirror

I am not sure what can be but is difficult to me find the solve.

Thxs

7.

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

5 de 6 21-06-2011 14:51

Page 6: Como criar um repositório Ubuntu

BartOctober 31st, 2008 at 14:29 | #8Reply | Quote

I found a “low-tech” solution for when setting a local mirror is too much fora few computers:http://nxadm.wordpress.com/2008/10/31/home-network-low-tech-trick-for-a-very-fast-ubuntu-release-upgrade/

(BTW: I set up your solution at work and I am the hero )

8.

ClintonFebruary 11th, 2009 at 18:20 | #9Reply | Quote

I have configured a machine with the mirror but do I need to update themirror list and remove the http entries and simply just add the ip addressof the server that mirrors all the updates?

9.

Zzypty ZzypMarch 12th, 2009 at 03:59 | #10Reply | Quote

Hi!

If the amount of memory allotted on a particular server is small (less thanthe 37GB or 18gB you mentioned), what are the directories that can beexcluded without causing too much of a flutter?

10.

adrianherrJune 12th, 2009 at 09:45 | #11Reply | Quote

Hi,

I am new to the forum. Please can you help me with a apt-mirror issue.

I have three repository's but I no longer need one of them. How do Iremove it without re-downloading the once I want?

Regards.

11.

How To Create An Ubuntu Repository Mirror on ... http://ubuntu-tutorials.com/2008/06/10/how-to-cr...

6 de 6 21-06-2011 14:51