Debian apt-mirror structures using mirroring

debian official ftpsync script to build the source image, and  apt-mirror  is a mirror in a more simple and convenient tool to build.

Install apt-mirror

sudo apt-get install apt-mirror

Profile /etc/apt/mirror.list just modify a few places, most of the default values.

As used herein, the upstream ftp.cn.debian.org USTC mirror image, only the image debian jessie amd64 architecture, no mirror source code package.

Config ################## ############# # # SET base_path / var / spool / APT-Mirror # # $ base_path SET mirror_path / mirror # skel_path $ base_path the SET / skel # var_path $ base_path the SET / var # cleanscript $ var_path the SET / clean.sh # # default the SET defaultarch consistent architecture and a mirrored host computer architecture, here is the AMD64 # postmirror_script $ var_path the SET / postmirror.sh the SET run_postmirror 0 # the SET nthreads 20 the SET _tilde 0 # ############# End config ############## deb HTTP : //ftp.cn.debian .org / Debian Jessie main contrib non-Free the deb HTTP : //ftp.cn.debian.org/debian/ Jessie-backports main contrib non-Free

             deb http://ftp.cn.debian.org/debian/ jessie-proposed-updates main contrib non-free deb http://ftp.cn.debian.org/debian/ jessie-updates main contrib non-free deb http://ftp.cn.debian.org/debian-security/ jessie/updates main contrib non-free #deb-src http://ftp.us.debian.org/debian unstable main contrib non-free # mirror additional architectures #deb-alpha http://ftp.us.debian.org/debian unstable main contrib non-free #deb-amd64 http://ftp.us.debian.org/debian unstable main contrib non-free #deb-armel http://ftp.us.debian.org/debian unstable main contrib non-free #deb-hppa http://ftp.us.debian.org/debian unstable main contrib non-free #deb-i386 http://ftp.us.debian.org/debian unstable main contrib non-free #deb-ia64 http://ftp.us.debian.org/debian unstable main contrib non-free #deb-m68k http://ftp.us.debian.org/debian unstable main contrib non-free #deb-mips http://ftp.us.debian.org/debian unstable main contrib non-free #deb-mipsel http://ftp.us.debian.org/debian unstable main contrib non-free #deb-powerpc http://ftp.us.debian.org/debian unstable main contrib non-free #deb-s390 http://ftp.us.debian.org/debian unstable main contrib non-free #deb-sparc http://ftp.us.debian.org/debian unstable main contrib non-free clean http://ftp.cn.debian.org/debian

Turn auto-sync

Just as root cron to automatically run apt-mirror command.

# m h  dom mon dow   command
0 0 * * * apt-mirror

Published mirror service

Use nginx release source image

The apt-mirror mirror directory is linked to / var / www / mirror

# ln -sf /var/spool/apt-mirror/mirror/ftp.cn.debian.org/ mirror

Then nginx default host default (or virtual host separately) to the root / var / www / mirror, and open up the directory listing

root /var/www/mirror location / { autoindex on; }

Other machines you can normally use the new source mirroring.

 

 

another:

apt-mirror image can be downloaded to a local official, and to ensure that the directory structure consistent with, but can not modify the mirror repository. If you want to modify the mirror repository is required reprepro.

1, the installation apt-mirror

# aptitude update
# aptitude install -y apt-mirror

# dpkg -L apt-mirror
/.
/usr
/usr/bin
/usr/bin/apt-mirror
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/apt-mirror.1.gz
/usr/share/doc
/usr/share/doc/apt-mirror
/usr/share/doc/apt-mirror/changelog.gz
/usr/share/doc/apt-mirror/changelog.Debian.gz
/usr/share/doc/apt-mirror/copyright
/etc
/etc/cron.d
/etc/cron.d/apt-mirror
/etc/apt
/etc/apt/mirror.list /var /var/spool /var/spool/apt-mirror /var/spool/apt-mirror/skel /var/spool/apt-mirror/mirror /var/spool/apt-mirror/var

2, modify the configuration file, add the source you want to download (I have to add here is the source of debian_squeeze)

# vim /etc/apt/mirror.list

set base_path    /docker/debian_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 40 set _tilde 0 deb-amd64 http://archive.debian.org/debian squeeze main deb-amd64 http://archive.debian.org/debian squeeze-lts main

3, manually run apt-mirror image downloads

# apt-mirror
Downloading 28 index files using 28 threads... Begin time: Mon Aug 21 11:24:11 2017 [28]... [27]... [26]... [25]... [24]... [23]... [22]... [21]... [20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... End time: Mon Aug 21 11:24:18 2017 Processing tranlation indexes: [TT] Downloading 32 translation files using 32 threads... Begin time: Mon Aug 21 11:24:19 2017 [32]... [31]... [30]... [29]... [28]... [27]... [26]... [25]... [24]... [23]... [22]... [21]... [20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... End time: Mon Aug 21 11:24:20 2017 Processing indexes: [PP] 32.8 GiB will be downloaded into archive. Downloading 25138 archive files using 40 threads... Begin time: Mon Aug 21 11:24:23 2017 [40]... [39]... [38]... [37]... [36]... [35]... [34]... [33]... [32]... [31]... [30]... [29]... [28]... [27]... [26]... [25]... [24]... [23]... [22]... [21]... [20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... End time: Mon Aug 21 21:38:48 2017 0 bytes in 0 files and 0 directories can be freed. Run /docker/debian_mirror/var/clean.sh for this purpose.

4, set the timer task, timing synchronization source official

# vim /etc/cron.d/apt-mirror
0 0 * * * apt-mirror > /docker/mirror.log 2>&1

5, set the publishing directory soft link

# ln -sv /docker/debian_mirror/mirror/archive.debian.org /docker/mirror

6, nginx configuration directory publishing Mirror

# cd /usr/local/nginx/conf/vhosts/
# vim debian_mirror.conf

server {
    listen 8081; server_name debian_mirror; root /docker/mirror location / { autoindex on; } access_log /usr/local/nginx/logs/debian_mirror.access.log oupeng_logs; error_log /usr/local/nginx/logs/debian_mirror.error.log; } # /usr/local/nginx/sbin/nginx -t # /usr/local/nginx/sbin/nginx -s reload

7, looking for a debian6 the addition of local sources testing machine

# vim /etc/apt/sources.list
deb http://117.119.33.138:8081/debian squeeze main deb http://117.119.33.138:8081/debian squeeze-lts main # aptitude update Hit http://117.119.33.138 squeeze Release.gpg Ign http://117.119.33.138/debian/ squeeze/main Translation-en Ign http://117.119.33.138/debian/ squeeze/main Translation-en_US Get:1 http://117.119.33.138 squeeze-lts Release.gpg [819 B] Ign http://117.119.33.138/debian/ squeeze-lts/main Translation-en Ign http://117.119.33.138/debian/ squeeze-lts/main Translation-en_US Hit http://117.119.33.138 squeeze Release Get:2 http://117.119.33.138 squeeze-lts Release [34.3 kB] Hit http://117.119.33.138 squeeze/main amd64 Packages E: Release file expired, ignoring http://117.119.33.138:8081/debian/dists/squeeze-lts/Release (invalid since 524d 12h 54min 42s)

Where the second source squeeze-lts will prompt expired, add an apt configuration in the configuration file can be

# vim /etc/apt/apt.conf
Acquire::Check-Valid-Until false; # aptitude update Get:1 http://apt.oupeng.com squeeze Release.gpg [1,655 B] Ign http://apt.oupeng.com/debian/ squeeze/main Translation-en Ign http://apt.oupeng.com/debian/ squeeze/main Translation-en_US Get:2 http://apt.oupeng.com squeeze-lts Release.gpg [819 B] Ign http://apt.oupeng.com/debian/ squeeze-lts/main Translation-en Ign http://apt.oupeng.com/debian/ squeeze-lts/main Translation-en_US Get:3 http://apt.oupeng.com squeeze Release [96.0 kB] Get:4 http://apt.oupeng.com squeeze-lts Release [34.3 kB] Get:5 http://apt.oupeng.com squeeze/main amd64 Packages [6,527 kB] Get:6 http://apt.oupeng.com squeeze-lts/main amd64 Packages [305 kB] Hit http://apt.puppetlabs.com squeeze Release.gpg Ign http://apt.puppetlabs.com/ squeeze/dependencies Translation-en Ign http://apt.puppetlabs.com/ squeeze/dependencies Translation-en_US Ign http://apt.puppetlabs.com/ squeeze/main Translation-en Ign http://apt.puppetlabs.com/ squeeze/main Translation-en_US Hit http://apt.puppetlabs.com squeeze Release Ign http://apt.puppetlabs.com squeeze/main Sources Ign http://apt.puppetlabs.com squeeze/dependencies Sources Ign http://apt.puppetlabs.com squeeze/main amd64 Packages Ign http://apt.puppetlabs.com squeeze/dependencies amd64 Packages Hit http://apt.puppetlabs.com squeeze/main Sources Hit http://apt.puppetlabs.com squeeze/dependencies Sources Hit http://apt.puppetlabs.com squeeze/main amd64 Packages Hit http://apt.puppetlabs.com squeeze/dependencies amd64 Packages Fetched 6,965 kB in 2s (3,148 kB/s) Current status: 43 updates [+41], 27994 new [+27654].

 

Guess you like

Origin www.cnblogs.com/surplus/p/11441206.html