Set up fastest https apt mirrors for Debian
I wanted to set up some fast apt mirrors for Debian and wasn't really impressed with the options I came across so here is my solution based on apt-transport-mirror (run as root):
apt-get update
apt-get install -y curl ca-certificates netselect --reinstall
netselect -s 3 $(curl -s https://www.debian.org/mirror/list | grep -o -P "http://[^\"]*/debian/" | sed "s/http/https/g" | sort -u) | sed 's/^.* //g' > /etc/apt/mirrorlist.txt
cp /etc/apt/sources.list /etc/apt/sources.list.original
sed -i '/^#/d' /etc/apt/sources.list
sed -i '/^$/d' /etc/apt/sources.list
sed -i 's/deb http.*\/debian\//deb mirror+file:\/etc\/apt\/mirrorlist.txt /g' /etc/apt/sources.list
sed -i 's/deb http.*\/debian /deb mirror+file:\/etc\/apt\/mirrorlist.txt /g' /etc/apt/sources.list
sed -i 's/^deb.*\/debian-security/deb https:\/\/security.debian.org\/debian-security/g' /etc/apt/sources.list
apt-get update
Comments
Post a Comment
Keep it clean and professional...