From e3b89021436a1a9686ecd9946d613afa01c5f4cc Mon Sep 17 00:00:00 2001 From: Sergei Bobkov Date: Fri, 20 Sep 2024 20:50:26 +0300 Subject: [PATCH] Added configs for apt-mirror-server --- apt-mirror-server/README.md | 25 +++++ apt-mirror-server/etc/apt/mirror.list | 24 +++++ apt-mirror-server/etc/apt/mirror.list.def | 34 +++++++ .../etc/nginx/sites-available/default | 37 ++++++++ .../etc/nginx/sites-available/default.def | 91 +++++++++++++++++++ 5 files changed, 211 insertions(+) create mode 100644 apt-mirror-server/README.md create mode 100644 apt-mirror-server/etc/apt/mirror.list create mode 100644 apt-mirror-server/etc/apt/mirror.list.def create mode 100644 apt-mirror-server/etc/nginx/sites-available/default create mode 100644 apt-mirror-server/etc/nginx/sites-available/default.def diff --git a/apt-mirror-server/README.md b/apt-mirror-server/README.md new file mode 100644 index 0000000..1e2b080 --- /dev/null +++ b/apt-mirror-server/README.md @@ -0,0 +1,25 @@ +# Configuration server for mirroring apt repositories. + +First, need to install apt-mirror and nginx:
+
+ +`apt install apt-mirror nginx`
+
+Second, create directory structure for repos:
+
+ +`/DATA`
+`├── iso`
+`└── repos`
+` ├── mirror`
+` ├── skel`
+` └── var`
+
+ +Third, start apt-mirror for sync repos:
+
+ +`apt-mirror`
+
+ +Last, exit conf of nginx. Loock at examples. diff --git a/apt-mirror-server/etc/apt/mirror.list b/apt-mirror-server/etc/apt/mirror.list new file mode 100644 index 0000000..893890d --- /dev/null +++ b/apt-mirror-server/etc/apt/mirror.list @@ -0,0 +1,24 @@ +#### START /etc/apt/mirror.list #### + +set base_path /DATA/repos +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 _autoclean 1 + +#set postmirror_script $var_path/postmirror.sh +set run_postmirror 0 + +set nthreads 40 +set _tilde 0 + +deb-amd64 http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware +deb-amd64 http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware +deb-amd64 http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware + +deb-amd64 http://deb.debian.org/debian/ bookworm main/debian-installer main contrib non-free + +clean http://ftp.us.debian.org/debian + +#### End #### diff --git a/apt-mirror-server/etc/apt/mirror.list.def b/apt-mirror-server/etc/apt/mirror.list.def new file mode 100644 index 0000000..53e1dbf --- /dev/null +++ b/apt-mirror-server/etc/apt/mirror.list.def @@ -0,0 +1,34 @@ +############# 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 +# 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 + +clean http://ftp.us.debian.org/debian diff --git a/apt-mirror-server/etc/nginx/sites-available/default b/apt-mirror-server/etc/nginx/sites-available/default new file mode 100644 index 0000000..b6a2b0e --- /dev/null +++ b/apt-mirror-server/etc/nginx/sites-available/default @@ -0,0 +1,37 @@ +# Default server configuration +# +server { + listen 80 default_server; + root /var/www/html; + + # Add index.php to the list if you are using PHP + + index index.html index.htm index.nginx-debian.html; + + server_name _; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } + + location /debian/ { + root /DATA/repos/mirror/deb.debian.org; + autoindex on; + index index.html index.htm; + } + + location /debian-security/ { + root /DATA/repos/mirror/security.debian.org; + autoindex on; + index index.html index.htm; + } + + location /iso/ { + root /DATA; + autoindex on; + index index.html index.htm; + } + +} diff --git a/apt-mirror-server/etc/nginx/sites-available/default.def b/apt-mirror-server/etc/nginx/sites-available/default.def new file mode 100644 index 0000000..6f0e2f0 --- /dev/null +++ b/apt-mirror-server/etc/nginx/sites-available/default.def @@ -0,0 +1,91 @@ +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen 80 default_server; +# listen [::]:80 default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + + server_name _; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } + + # pass PHP scripts to FastCGI server + # + #location ~ \.php$ { + # include snippets/fastcgi-php.conf; + # + # # With php-fpm (or other unix sockets): + # fastcgi_pass unix:/run/php/php7.4-fpm.sock; + # # With php-cgi (or other tcp sockets): + # fastcgi_pass 127.0.0.1:9000; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + + +# Virtual Host configuration for example.com +# +# You can move that to a different file under sites-available/ and symlink that +# to sites-enabled/ to enable it. +# +#server { +# listen 80; +# listen [::]:80; +# +# server_name example.com; +# +# root /var/www/example.com; +# index index.html; +# +# location / { +# try_files $uri $uri/ =404; +# } +#}