Step 1: Update the Package Repository.
a). Before installing any software, it’s a good practice to update the package repository to ensure you are getting the latest versions of packages. Open a terminal and run:-
# [ sudo yum update ]
Step 2: Install vsftpd.
a). Once the repository is updated, you can install vsftpd using the following command:-
# [ sudo yum install vsftpd ]
Step 3: Start and Enable vsftpd.
a). After installation, start the vsftpd service and enable it to start on boot:-
# [ sudo systemctl start vsftpd ]
# [ sudo systemctl enable vsftpd ]
Step 4: Adjust Firewall Rules.
a). If you have a firewall enabled, you’ll need to allow FTP traffic. The default FTP port is 21. You can open the FTP port using the following command.
# [ sudo firewall-cmd –permanent –add-port=21/tcp sudo firewall-cmd –reload ]
Step 5: Create a User for FTP.
a). You may want to create a specific user for FTP access. Replace '<username>'
with the desired username.
# [ sudo useradd -m <username> ]
# [ sudo passwd <username> ]
Step 6: Configure vsftpd.
a). Edit the vsftpd configuration file to customize settings. Open the configuration file in a text editor. Here, we’ll use 'nano'
, but you can use any text editor you prefer.
# [ sudo nano /etc/vsftpd/vsftpd. Conf ]
b). Make the following changes or additions:-
# [ anonymous_enable=NO ]
# [ local_enable=YES ]
# [ write_enable=YES ]
# [ chroot_local_user=YES ]
# [ allow_writeable_chroot=YES ]
c). Save and exit the editor.
Step 7: Restart vsftpd.
a). After making changes to the configuration, restart the vsftpd service.
# [ sudo systemctl restart vsftpd ]
Conclusion: Your FTP server should now be up and running on CentOS 7. You can use an FTP client to connect to your server using the username and password you created earlier. Keep in mind that FTP transmits data in plain text, so it’s recommended to use it in a secure network or consider using FTPS (FTP Secure) or SFTP (SSH File Transfer Protocol) for encrypted connections.