ubuntu apt-get local mirror for faster package management

Опубликовано: 29 Сентябрь 2024
на канале: Dan Sheffner
13,290
83

sudo apt-get install apache2 apt-mirror wget

see how much disk space
df -h

see drives attached
fdisk -l

partition drive
fdisk /dev/sdx
prints out info
p
deletes partition
d
new partition
n
write out
w
quit
q

format drive
mkfs.ext4 /dev/sdx1

mount drive
mount /dev/sdx1 /var/spool/apt-mirror

create directories if needed
cd /var/spool/apt-mirror
mkdir var mirror skel

cd /etc/apt/
rm mirror.list
wget https://raw.githubusercontent.com/the...

16.04
wget https://raw.githubusercontent.com/the...
mv 16.04.mirror.list /etc/apt/mirror.list

sync mirror
apt-mirror

clean scripts
chmod +x /var/spool/apt-mirror/var/clean.sh
/var/spool/apt-mirror/var/clean.sh

create the symlink
ln -s /var/spool/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/ /var/www/html/ubuntu

cron entries
crontab -e
0 2 * * * /usr/bin/apt-mirror
0 5 * * * /var/spool/apt-mirror/var/clean.sh

rate limit apt-mirror add to mirror.list
set limit_rate 50k