Debmirror

Revision 1 as of 2007-09-26 21:53:13

Clear message

Чтобы создать зеркало при помощи debmirror следуйте этим инструкциям

Это не покроет все остальные варианты, но даст возможность поэксперементировать. Чтобы всё прошло успешно, понадобится 8,2 ГБ дискового пространства для основных исходников и бинарных пакетов. Это число со временем возростёт.

Альтернативная Точка Зрения

Если вы желаете скачать все возможные бинарники apt для всех ящиков в один из сети, то возможно apt-cache или transparent proxy (т.е. [http-replicator]) - всё что вам нужно.

Ещё один метод - использование rsync. Страница [Rsyncmirror] даёт лучшее детальное представление об этом методе. Rsync может создать полное зеркало сайта и выбирать файлы все без исключения. В свою очередь Debmirror, более контролируемый метод выбора файлов для зеркала и легче для выделения дискового пространства.

Начало Процесса Создания Зеркала

Откройте gnome-terminal кликнув Приложения -> Стандартные -> Терминал. BRЕсли в ваш лист репозитариев включён universe, то следующий шаг пропустите. BROpen your sources list (sudo sensible-editor /etc/apt/sources.list), and add the following line BRdeb http://cc.archive.ubuntu.com/ubuntu/ dapper universe BRThen save and return to a prompt. BRIn the example above, cc is your countrys code (eg au means Australia), and dapper is replaced with the release your using.

Update the package lists (sudo apt-get update) and then install debmirror (sudo apt-get install debmirror). BR Now we have to create a directory to save the files too. The approximate size of the components of the mirror (i386 only) are: # Changes over time.

feisty

~27G

main, restricted, universe, multiverse

dapper

15G

main, restricted, universe, multiverse

Please ensure where ever you make the mirror has room for the packages you want to download! BR(If you are more advanced you can make different parts of the mirror on different volumes, but thats not something for this howto). BRWe will make our mirror on /home/ with

sudo mkdir /home/UbuntuMirror

Create the file `mirrorbuild.sh`

Now to create mirrorbuild.sh BROpen your prefered editor thus

sudo sensible-editor /usr/local/bin/mirrorbuild.sh

Copy the text from the box below into the editor. BRYou may omit the lines starting with # (NB EXCEPTION the line that starts #!/bin/bash must be left in.)

Contents of the mirror script, please adapt it to your needs

#### Start script to automate building of Ubuntu mirror #####
## THE NEXT LINE IS NEEDED THE REST OF THE LINES STARTING WITH A # CAN BE DELETED

#!/bin/bash

## Setting variables with explanations.

# Arch=         -a      # Architecture. For Ubuntu can be i386, powerpc or amd64.
# sparc, only starts in dapper, it is only the later models of sparc
#
arch=i386

# Minimum Ubuntu system requires main, restricted
# Section=      -s      # Section (One of the following - main/restricted/universe/multiverse).
#
section=main,restricted,universe,multiverse

# Release=      -d      # Release of the system (Dapper, Edgy, Feisty, Gutsy), and the -updates and -security ( -backports can be added if desired)
#
release=dapper,dapper-security,dapper-updates

# Server=       -h      # Server name, minus the protocol and the path at the end
# CHANGE "*" to equal the mirror you want to create your mirror from. au. in Australia  ca. in Canada.
# This can be found in your own /etc/apt/sources.list file, assuming you have Ubuntu installed.
#
server=cc.archive.ubuntu.com

# Dir=          -r      # Path from the main server, so http://my.web.server/$dir, Server dependant
#
inPath=/ubuntu

# Proto=        -e      # Protocol to use for transfer (http, ftp, hftp, rsync)
# Choose one - http is most usual the service, and the service must be avaialbe on the server you point at.
#
proto=http

# Outpath=              # Directory to store the mirror in
# Make this a full path to where you want to mirror the material.
#
outPath=/home/UbuntuMirror

# The --nosource option only downloads debs and not deb-src's
# The --progress option shows files as they are downloaded
# --source \ in the place of --no-source \ if you want sources also.
# Start script
#
debmirror       -a $arch \
                --no-source \
                -s $section \
                -h $server \
                -d $release \
                -r $inPath \
                --progress \
                -e $proto \
                --ignore-release-gpg \
                $outPath


#### End script to automate building of Ubuntu mirror ####

How to use the file

  • Save the file and exit.
  • Now change the permissions and ownership on the mirror. The group name is your username:

sudo chown -R root.username /home/UbuntuMirror
sudo chmod -R 571 /home/UbuntuMirror
  • And the final part of setting up the mirror is to download the files

buildmirror.sh

Now walk away. Your machine has a lot of downloading to do!

Set up the mirror

We need to install Apache2, you could choose apache version 1.3 but that is beyond the scope of this document. BR We can do this with sudo apt-get install apache2 BR BR Then (for simplicity sake) lets make a link from /home/UbuntuMirror to /var/www/ubuntu.

ln -s /home/UbuntuMirror /var/www/ubuntu

This means when you go to download from your mirror, you will visit http://mirrorbox/ubuntu/. BR BR Right! So we have all the packages, and a working server. Now we need to set up the clients.

Set up a client system

Open a terminal and enter

cd /etc/apt
sudo mv sources.list sources.list.orig
sudo sensible-editor sources.list

Now in your editor, put the following lines:

# Local network mirror sources.
deb http://mirrorbox/ubuntu dapper main restricted universe multiverse
deb http://mirrorbox/ubuntu dapper-updates main restricted universe multiverse
deb http://mirrorbox/ubuntu dapper-security main restricted universe multiverse

Then save and exit BR If you then run

sudo apt-get update
sudo apt-get dist-upgrade

you should be updating from your new server!


CategoryDocumentation