Thursday, December 19, 2019

Mail Server on Cent os7

Install ‘iRedMail’ (Fully Featured Mail Server) with Virtual Domains, Webmail, SpamAssassin & ClamAV in Linux.


After HTTP and shadow DNS services, mail (SMTP, POP, IMAP and all related encrypted mail protocols) is one of the most used service in Internet, and also, one of the most sensible, due to spam and open-relay mail servers.

This tutorial will guide you through installing a full mail server with MTA, MDA and MUA software in a few minutes on RHELCentOSScientific Linux  with Postfix, Virtual Domains and Users with MySQL, Dovecot – support for POP3/POP3S, IMAP/IMAPS, Roundcube – Webmail and also, mail spam and virus scanning with SpamAssassin and ClamAV, all installed using a single software package called ‘iRedMail’.

About iRedMail


iRedMail is an Open Source full featured mail server solution that can spare a lot of time for system administrators for complex configurations, has support for all major Linux distributions and ships with the following Linux packages.
  1. Postfix: SMTP service – default MTA.
  2. Dovecot: POP3/POP3S, IMAP/IMAPS, Managesieve service – default MDA.
  3. Apache: Web server.
  4. MySQL/PostgreSQL: Storing application data and/or mail accounts.
  5. OpenLDAP: Storing mail accounts.
  6. Policyd: Postfix policy server.
  7. Amavisd: An interface between Postfix and SpamAssassin, ClamAV. Used for spam and virus scanning.
  8. Roundcube: Webmail – default MUA.
  9. Awstats: Apache and Postfix log analyzer.
  10. Fail2ban: scans log files (e.g. /var/log/maillog) and bans IPs that show malicious system attempts.
Required For Mail Server.

1. Public Ip Address
2. Cent os 7 with 2ghz cpu, 2gb RAM
3. Domain

Contents.

Step 1: Initial Configurations and Static IP Address

Step 2: Install iRedMail

Step 3: Initial Webmail Configurations.

Step 4: Installing SpamAssassin Configurations.



Step 1: Initial Configurations and Static IP Address.


1. After first reboot login with your root account and make sure your system is up to date and install some useful packages needed for later usage.
On RHEL/CentOS/Scientific Linux
#yum update && yum upgrade 
# yum install nano wget bzip2
2. Because this box acts like a Mail Server, a static IP needs to be configured on Network Interface. To add a static IP open and edit your NIC configurations file located on /etc/sysconfig/network-scripts/ path and add the following values.
On RHEL/CentOS/Scientific Linux

 # nano /etc/sysconfig/network-scripts/ifcfg-eth0
Use this file as a template and replace it with your customize values.
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:01:99:E8"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="7345dd1d-f280-4b9b-a760-50208c3ef558"
NAME="eth0"
IPADDR=192.168.1.40
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DNS2=8.8.8.8

After you finish editing your NIC file, open network file from the same location as above and add your server unqualified hostname on HOSTNAME directive.
# nano /etc/sysconfig/network-scripts/network



4. After all the configurations above had been written to their corresponding files restart your network service to apply newly configurations and verify it using ping and ifconfig commands.

# service network restart
5. Now that your static network is fully operational, edit /etc/hosts file and add your unqualified and FQDN hostname like the example below.

# nano /etc/hosts
127.0.0.1   centos.mydomain.lan centos localhost localhost.localdomain
192.168.1.40 centos.mydomain.lan centos

# nano /etc/hostname

centos
Replace your mail domain .

6. Another useful package is bash-completion (auto-complete commands sequence using [Tab] key) which is provided by EPEL repository under RedHat based systems and then update your sources.

# rpm –Uvh http://fedora.mirrors.romtelecom.ro/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# yum repolist && yum upgrade
After your sources had been updated install bash-completion utility (answer Yes on all questions).

# yum install bash-completion

Step 2: Install iRedMail

9. In order to downlad iRedMail archive package you must visit it’s official download page section or you can use wget command to download the last version ( 1.0-beta1 at the time of writing this article).

#wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-1.0-beta1.tar.bz2
10. After iRedMail archive download finishes, extract it using the following command.

# tar xvjf iRedMail-1.0-beta1.tar.bz2
11. Then enter newly extracted iRedMail directory path, mark iRedMail.sh script with executable permissions then run it.

# cd iRedMail-1.0-beta1
# chmod +x iRedMail.sh
# sudo ./iRedMail.sh
12. After initial system checks the program starts adding required repository then the first guidance prompt asks you whether you wish to continue with installation or abort. Choose Yes to continue.

13. iRedMail uses Maildir format to store e-mails on /var/vmail system path where it creates separated directories for every domain that you append to your MTA server. If you’re comfortable with this path hit Next to move forward with server configurations else provide your desired location then Next.

14. On the next step choose you preferred database to store mail domains names and recipients that will connect to Postfix. This tutorial focuses on MySQL database, so choose MySQL using [Space] bar then continue with Next and provide a strong password for MySQL root account.







15. On the next step add your first virtual domain name. If you own a registered domain name added here (add just the domain name not system FQDN).


16. By default iRedAdmin creates an administrative user with full powers over your server that can be accessed through iRedAdmin panel or through Dovecot protocols (default Roundcube webmail interface or any other IMAP/POP MUA software like SquirrelMail, Rainloop, Microsoft Outlook, Mozilla Thunderbird, Evolution, Mutt, Elm etc ).

Also this postmaster administrative account is used by the system to report incidents related to mail functions or other system failures or useful information – logwatch usually sends its statistics here- so choose a strong password and continue with Next.








17. On the next step choose your other mail server components like iRedAdmin official administrative panel to Postfix, DKIM domain keys – ( adds a signature to message header evaluating message trust for final delivery or further relays), Roundcube default webmail interface ( if you plan to use other Mail Delivery Agent skip Roundcube ), PhpMyadmin (if you are comfortable with MySQL command line you should also skip installing PhpMyAdmin ), Awstats ( useful log statistics and analyzer ), Fail2ban ( protects your server from brute force attacks).
18. On next series of questions, depending on your optional components installed you should answer with Yes. Pay extra attention to iRedMail.tips file located on $HOME extracted directory because it contains sensitive mail server information like usernames and passwords for server applications, server configurations files, default URL and other important information.





19. After installation finishes reboot your system and verify iRedmail.tips file to see your server default settings – you should move That file folder(/root/iredadmin) to a secure system path(/home or any other) with 600 permissions on it.




20. Access default web applications on the following URLs.
  1. Roundcube Webmail – https://domain_name or server_IP/mail/
  2. IRedAdmin panel – https://domain_name or server_IP/iredadmin/









Step 3: Initial Webmail Configurations.

21. iRedAdmin administrative panel offers a basic webmail interface where you can add virtual domains and accounts for your mail server that Postfix can handle through MySQL backend. To login to iRedAdmin panel point your browser to https://domain_name/iredadmin/ or https://server_IP/iredadmin/ URL and use the following default credentials.
  1. Username: postmaster@your_domain_name.tld
  2. Password: postmaster password set on #16 point



22. To add a user navigate to Add -> User then provide your desired username mail address and password. You can also setup the amount of space your user Mailbox can handle with Quota and you can also promote users with administrative powers over iRedAdmin panel by Marking user as Global admin.











Thank u For Reading This Artical. If Any Question Comment Here.








No comments:

Post a Comment

 Dear all, Kindly Check Out skynetconsult.in For More Blog. Regards, skynetConsultacy.