Connect with us
How to Build an SMTP Server using Virtualmin on CentOS

SMTP

How to Build an SMTP Server using Virtualmin on CentOS?

How to Build an SMTP Server using Virtualmin on CentOS?

Virtualmin is a web hosting and server management control panel designed for Unix and Linux systems. It provides a graphical user interface (GUI) to manage various aspects of web hosting, such as creating and managing domains, email accounts, FTP accounts, databases, and more. Virtualmin supports various web servers such as Apache, Nginx, and Lighttpd, and can be used to manage virtual hosts and SSL certificates.

In terms of building an SMTP server, Virtualmin can be beneficial because it includes the option to install and configure the popular email server software, Postfix. Postfix is a powerful and flexible mail transfer agent that can handle both incoming and outgoing email for a domain.

With Virtualmin, users can easily configure Postfix to handle mail delivery and set up email accounts for their domain. Virtualmin also provides anti-spam and anti-virus features, such as SpamAssassin and ClamAV, to help ensure that incoming email is filtered for unwanted content.

Building an SMTP server using Virtualmin is a straightforward process. Here is a step-by-step guide to help you through the process:

Read also: List of VPS Hosting Providers with Port 25 Open

How to Install Virtualmin on Centos?

If you are looking to install Virtualmin on your server, you can do so by following these steps:

Step 1: Update your server

$ sudo -i
$ dnf update -y

Step 2: Set your hostname

$ hostnamectl set-hostname example.com

Step 3: Install wget

To install wget, you can use the following command:

$ sudo yum update
$ sudo yum install wget

Step 4: Download and install Virtualmin

$ wget http://software.virtualmin.com/gpl/scripts/install.sh
$ sudo /bin/sh install.sh

Install PHP 8.1 (PHP-FPM) on CentOS

To install PHP 8.1 with PHP-FPM on CentOS, you will need to follow these steps:

Step 1: Install EPEL and REMI Release 9

$ yum install epel-release && yum install remi-release
$ dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

Step 2: Install PHP 8.1 and other required packages

$ dnf module list php
$ dnf module enable php:remi-8.1
$ dnf install php-fpm php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-mysqlnd php-pdo php-soap php-tidy php-xml php-xmlrpc php-opcache php-redis php-pecl-mcrypt php-brotli php-zip

Step 3: Verify PHP version and enable PHP-FPM to start automatically

$ php -v
$ systemctl enable php-fpm
$ systemctl start php-fpm

Enable PHP openssl extension

To enable the PHP openssl extension, you will need to open the php.ini file located under the PHP installation folder and search for the following line:

extension=php_openssl.dll

If the line is not enabled (commented out), remove the semicolon (;) to enable it and save the file.

What You Should Do After Installing Virtualmin?

Log in to Virtualmin: After installing Virtualmin, you can access it by opening a web browser and navigating to the server’s IP address or domain name followed by the port number 10000 (e.g., https://your-server-ip:10000). Enter your server’s root credentials to log in.

Set up Virtual Hosts: Virtual hosts allow you to host multiple websites on a single server. In Virtualmin, click on “Create Virtual Server” and follow the prompts to create a new virtual host. You will need to specify the domain name, administrator username, and password, among other things.

Configure DNS: To point your domain name to your server, you’ll need to configure the DNS. Virtualmin includes a DNS management module that allows you to create and edit DNS records. Go to “Virtualmin > System Settings > Server Templates > Default Settings > BIND DNS Domain” and set up your DNS zone. You can then go to “Virtualmin > Server Configuration > DNS Records” to add or modify DNS records.

Set up email: Virtualmin includes an email server module that allows you to set up email accounts and aliases. Go to “Virtualmin > Edit Virtual Server > Enabled Features” and check “Mail for Domain” to enable email for the virtual host. You can then create email accounts, set up email forwarding, and manage spam filters and antivirus protection.

Install SSL certificate: To secure your website with SSL, you’ll need to install an SSL certificate. Virtualmin includes a Let’s Encrypt module that allows you to easily obtain and install a free SSL certificate. Go to “Virtualmin > Server Configuration > SSL Certificate” and click “Let’s Encrypt” to generate a certificate.

Configure backups: Backups are important to ensure that you can recover from data loss or server failure. Virtualmin includes a backup module that allows you to schedule and manage backups. Go to “Virtualmin > Backup and Restore” to configure backups.

These are just a few of the steps you can take after installing Virtualmin. Depending on your needs, you may also want to install additional modules or software, such as a web server or database server. Virtualmin provides a comprehensive control panel to manage your server and web hosting needs.

here’s a step-by-step guide on what to do after installing Virtualmin to build an SMTP server:

Install Postfix: Virtualmin includes a module to install and configure Postfix, which is a popular SMTP server. Go to “Virtualmin > System Settings > Features and Plugins” and make sure that “Mail server” is enabled. Then, go to “Virtualmin > System Settings > Re-Check Configuration” to ensure that all necessary packages are installed. Finally, go to “Virtualmin > Install Scripts” and click “Install Scripts” next to “Postfix Mail Server” to install Postfix.

Configure Postfix: Once Postfix is installed, you’ll need to configure it to receive and send emails. Go to “Virtualmin > Edit Virtual Server > Enabled Features” and check “Mail for Domain” to enable email for the virtual host. Then, go to “Virtualmin > Edit Virtual Server > Enabled Features > Postfix Mail Server” and configure the options, such as the email quota and mailbox format. You can also set up email aliases and forwarders.

Set up SMTP authentication: To prevent unauthorized users from using your SMTP server to send spam, you’ll want to set up SMTP authentication. Go to “Virtualmin > Edit Virtual Server > Enabled Features > Postfix Mail Server” and check “SMTP Authentication.” Then, go to “Virtualmin > Edit Virtual Server > Mail Aliases” and create a new alias for the email address you want to use for SMTP authentication. Finally, configure your email client to use SMTP authentication when sending emails.

Set up spam filtering: To prevent spam emails from reaching your mailbox, you’ll want to set up spam filtering. Virtualmin includes a module to configure SpamAssassin, which is a popular spam filtering tool. Go to “Virtualmin > Edit Virtual Server > Enabled Features > Spam Filtering” and check “SpamAssassin.” Then, configure the options, such as the spam score threshold and email quarantine settings.

Test your SMTP server: To ensure that your SMTP server is working correctly, you can test it by sending a test email to yourself or to another email address. You can use an email client, such as Microsoft Outlook or Mozilla Thunderbird, to send and receive emails using your SMTP server.

These are just a few of the steps you can take after installing Virtualmin to build an SMTP server. Depending on your needs, you may also want to configure email forwarding, set up antivirus protection, or install additional email software. Virtualmin provides a comprehensive control panel to manage your server and email hosting needs.

More in SMTP