This article contains instructions on how to create and configure an FTP repository of ISO images with anonymous access.
To create a repository:
-
Install the vsftpd FTP server:
AlmaLinuxyum install vsftpd
Ubuntuapt install vsftpd
-
Create a root directory to store the repository files:
mkdir -p /srv/ftp/iso
-
Check that an entry for the ftp user appears in the /etc/passwd file:
Пример записиftp:x:139:149:ftp daemon,,,:/srv/ftp:/usr/sbin/nologin
-
Specify the following settings in the /etc/vsftpd/vsftpd.conf configuration file:
listen=YES listen_ipv6=NO anonymous_enable=YES anon_root=/srv/ftp/iso/ no_anon_password=YES local_enable=YES hide_ids=YES dirmessage_enable=YES use_localtime=YES xferlog_enable=YES connect_from_port_20=YES secure_chroot_dir=/var/run/vsftpd/empty pam_service_name=vsftpd ssl_enable=NO allow_writeable_chroot=YES
-
Restart the vsftpd service:
systemctl restart vsftpd
- Copy an ISO image to the /srv/ftp/iso/ directory.
-
Define the size of the ISO image in MiB:
ls -l --block-size=M <имя_файла>
Output example-rw-rw-r-- 1 user user 389M May 5 2023 debian-11.7.0-amd64-netinst.iso
-
Define the hash sum of the ISO image:
sha1sum <filename>
Output examplec0d269af8978c625cb480ba2c723c7964c7e52ad debian-11.7.0-amd64-netinst.iso
-
Create a repository description file /srv/ftp/iso/metadata.json. For more information about the file format, see ISO images repositories.
Пример файла metadata.json{ "type": "iso", "images": [ { "name": "Debian 11", "os_type": "linux", "tags": [ "linux", "debian" ], "file_name": "debian-11.7.0-amd64-netinst.iso", "image_size_mib": 389, "updated_at": "2024-06-05 00:00:01", "checksum": "c0d269af8978c625cb480ba2c723c7964c7e52ad" } ] }
-
Specify access rights to the root directory of the repository:
chmod -R 775 /srv/ftp/iso
-
Check access to the repository description file:
curl -v ftp://<server_IP>/metadata.json
If the file cannot be accessed, check if the firewall settings allow incoming connections on ports 20/TCP and 21/TCP. - Add a repository following the instructions in the ISO images repositories article.