0. Ставим пакеты:
apt update
apt install apt-mirror vim nginx gnupg
1. Редактируем настройки apt-mirror
vim /etc/apt/mirror.list
------------------------
############# config ##################
#
set base_path /var/spool/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://ftp.us.debian.org/debian unstable 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
### need repo
#
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
#
#### need repo end
#clean
clean http://deb.debian.org/debian
clean http://deb.debian.org/debian-security
------------------------
2. Редактируем настройки nginx
vim /etc/nginx/conf.d/mirrors.conf
----------------------------------
server {
listen 80;
server_name mirror.b14esh.com;
root /var/spool/apt-mirror;
location / {
autoindex on;
}
}
----------------------------------
3. еще можно заменить дефолтный nginx
vim /etc/nginx/sites-available/default
--------------------------------------
root /var/spool/apt-mirror;
--------------------------------------
4. После настройки nginx
systemctl restart nginx.service
!!! Придется делать каждый раз после обновления репозитория, но проще добавить "[trusted=yes]"
5. Подпись репозитория
- Переходим в каталог root:
cd /root
- Создаем ключ:
#gpg --full-gen-key
gpg --gen-key
- Переходим в каталог репозитория:
cd /var/spool/apt-mirror
- Ищем "Release.gpg":
find -name Release.gpg
./mirror/deb.debian.org/debian-security/dists/bullseye-security/Release.gpg
./mirror/deb.debian.org/debian/dists/bullseye-backports/Release.gpg
./mirror/deb.debian.org/debian/dists/bullseye-updates/Release.gpg
./mirror/deb.debian.org/debian/dists/bullseye/Release.gpg
./skel/deb.debian.org/debian-security/dists/bullseye-security/Release.gpg
./skel/deb.debian.org/debian/dists/bullseye-backports/Release.gpg
./skel/deb.debian.org/debian/dists/bullseye-updates/Release.gpg
./skel/deb.debian.org/debian/dists/bullseye/Release.gpg
- Подписываем репозиторий:
cd /var/spool/apt-mirror/mirror/deb.debian.org/debian-security/dists/bullseye-security/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/mirror/deb.debian.org/debian/dists/bullseye-backports/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/mirror/deb.debian.org/debian/dists/bullseye-updates/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/mirror/deb.debian.org/debian/dists/bullseye/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/skel/deb.debian.org/debian-security/dists/bullseye-security/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/skel/deb.debian.org/debian/dists/bullseye-backports/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/skel/deb.debian.org/debian/dists/bullseye-updates/
gpg --armor -o Release.gpg -sb Release
cd /var/spool/apt-mirror/skel/deb.debian.org/debian/dists/bullseye/
gpg --armor -o Release.gpg -sb Release
- Экспортируем ключ:
gpg --list-keys - смотрим какие есть ключи
gpg --export -a USER_NAME > /var/spool/apt-mirror/public.gpg