Objective

The objective is to configure network Redhat package repository accessible via FTP protocol. This guide uses vsftpd as a means to provide FTP access to the package repository.

Operating System and Software Versions

  • Operating System: - Red Hat Enterprise Linux Server 7.3 (Maipo)
  • Software: - vsftpd: version 3.0.2

Requirements

Privileged access to your RHEL server system will be required.

Difficulty

EASY

Conventions

  • # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - requires given linux commands to be executed as a regular non-privileged user

Instructions

Install vsftpd

First, step is to install and start vsftpd daemon.
# yum install vsftpd
Enable vsftpd daemon to start after reboot:
# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
Start vsftpd daemon:
# systemctl start vsftpd
vsftpd daemon should now be running:
# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2017-04-07 21:21:08 AEST; 3min 3s ago
  Process: 11630 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 11632 (vsftpd)
   CGroup: /system.slice/vsftpd.service
           └─11632 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Configure Firewall

If you have firewall enabled, add a new rule to allow inbound firewall connections to FTP service:
# firewall-cmd --permanent --add-service=ftp
# firewall-cmd --reload 

Include Packages

What remains is to copy Redhat package repository from ISO image or DVD drive to /var/ftp/pup directory. Mount your CDROM:
# mount /dev/cdrom /media
or RHEL iso image:
# mount -ro loop rhel-server-7.3-x86_64-dvd.iso /media
and copy all source files using cp:
# cp -a /media/* /var/ftp/pub/
If SELinux is enabled on your system set appropriate SELinux context recursively for entire directory:
# chcon -R -t public_content_t /var/ftp
Your FTP server should now be accessible from any remote system via ftp://SERVER-IP/pup/
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: