Artigos‎ > ‎Instalação do Sistema‎ > ‎Aptitude‎ > ‎

Mirror do APT


Como ter um mirror do apt local.
Link: http://www.howtoforge.com/local_debian_ubuntu_mirror

sudo apt-get install apt-mirror

sudo gedit /etc/apt/mirror.list

Configuração para armel jaunty (antes que alguém apague isso !!)

############# config ##################
#
# set base_path    /var/spool/apt-mirror
set base_path    /srv/apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############

#deb http://archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

#clean http://archive.ubuntu.com/ubuntu

# Mirror para Motorola Atrix 2011
# Também baseado em https://launchpad.net/ubuntu/jaunty/armel/

# deb http://10.77.32.150/mirror/webtop.updates.com/webtop-updates WEBtop main
# deb http://10.77.32.150/mirror/ports.ubuntu.com/ubuntu-ports jaunty main universe multiverse restricted
deb-armel http://ports.ubuntu.com jaunty main universe multiverse restricted
deb-armel http://ports.ubuntu.com jaunty-security main universe multiverse restricted
deb-armel http://ports.ubuntu.com jaunty-updates main universe multiverse restricted
deb-armel http://jp.archive.ubuntu.com/ports jaunty main universe multiverse restricted
deb-armel http://jp.archive.ubuntu.com/ports jaunty-security main universe multiverse restricted
deb-armel http://jp.archive.ubuntu.com/ports jaunty-updates main universe multiverse restricted
deb-armel http://jp.archive.ubuntu.com/ports jaunty-backports main universe multiverse restricted
deb-armel http://old-releases.ubuntu.com/ubuntu jaunty main universe multiverse restricted
deb-armel http://old-releases.ubuntu.com/ubuntu jaunty-security main universe multiverse restricted
deb-armel http://old-releases.ubuntu.com/ubuntu jaunty-updates main universe multiverse restricted
deb-armel http://old-releases.ubuntu.com/ubuntu jaunty-backports main universe multiverse restricted

# deb-src http://10.77.32.150/mirror/archive.ubuntu.com/ubuntu jaunty main universe multiverse restricted
#deb-src http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse

Como os dados ficarão em outro servidor atualizei a a linha do /etc/fstab para:
192.168.1.13://mnt/pools/A/A0/apt-mirror  /srv/apt-mirror  nfs   rw,hard,intr      0     0

Crie o diretório base:
sudo mkdir /srv/apt-mirror

No servidor fiz os seguintes ajustes de permissão de acesso já que os usuário e grupo abaixo não existem lá:

cat /etc/passwd | grep apt-mirror
apt-mirror:x:131:143::/var/spool/apt-mirror:/bin/sh
cat /etc/group | grep apt-mirror
apt-mirror:x:143:


ssh root@192.168.1.13
cd /mnt/pools/A/A0/apt-mirror
mkdir mirror 
mkdir skel
mkdir var
cd var
touch clean.sh
touch postmirror.sh  
chown -R 131:143 /nfs/apt-mirror/mirror
chown -R 131:143 /nfs/apt-mirror/skel
chown -R 131:143 /nfs/apt-mirror/var
exit

Execute o comando abaixo para iniciar a carga:
sudo mount -all
sudo su - apt-mirror -c apt-mirror

O cliente para acessar o mirror deve ter um /etc/apt/sources.list assim:
deb ftp://192.168.1.13/pools/A/A0/apt-mirror/mirror/old-releases.ubuntu.com/ubuntu/ jaunty main universe multiverse restricted
deb ftp://192.168.1.13/pools/A/A0/apt-mirror/mirror/old-releases.ubuntu.com/ubuntu/ jaunty-security main universe multiverse restricted
deb ftp://192.168.1.13/pools/A/A0/apt-mirror/mirror/old-releases.ubuntu.com/ubuntu/ jaunty-updates main universe multiverse restricted
deb ftp://192.168.1.13/pools/A/A0/apt-mirror/mirror/old-releases.ubuntu.com/ubuntu/ jaunty-backports main universe multiverse restricted

Se quiser rodar automaticamente tire o comentário do arquivo:
sudo gedit /etc/cron.d/apt-mirror
#
# Regular cron jobs for the apt-mirror package
#
#0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log



Se der o erro: apt-mirror is already running , exiting at /usr/bin/apt-mirror line 187.

Tive que apagar o arquivo lock para continuar. Comando que executei:
sudo su - apt-mirror -c "rm /srv/apt-mirror/var/apt-mirror.lock"

Comments