The Perfect Server CentOS 7.6 with Apache, PHP 7.2, Postfix, Dovecot, Pure-FTPD, BIND and ISPConfig 3.1

This tutorial shows the installation of ISPConfig 3.1 on a CentOS 7.6 (64Bit) server. ISPConfig is a web hosting control panel that allows you to configure the following services through a web browser: Apache web server, PHP 7.2, Postfix mail server, MySQL, BIND nameserver, PureFTPd, SpamAssassin, ClamAV, Mailman, and many more.

1 Requirements

To install such a system you will need the following:

  • A Centos 7.6 minimal server system. This can be a server installed from scratch as described in our Centos 7 minimal server tutorial or a virtual-server or root-server from a hosting company that has a minimal Centos 7.6 setup installed.
  • A fast Internet connection.

2 Preliminary Note

In this tutorial, I use the hostname with the IP address and the gateway These settings might differ for you, so you have to replace them where appropriate.

3 Prepare the server

Set the keyboard layout

In case that the keyboard layout of the server does not match your keyboard, you can switch to the right keyboard (in my case "de" for a German keyboard layout, with the localectl command:

localectl set-keymap de

To get a list of all available keymaps, run:

localectl list-keymaps

I want to install ISPConfig at the end of this tutorial, ISPConfig ships with the Bastille firewall script that I will use as the firewall, therefor I disable the default CentOS firewall now. Of course, you are free to leave the CentOS firewall on and configure it to your needs (but then you shouldn't use any other firewall later on as it will most probably interfere with the CentOS firewall).


yum -y install net-tools
systemctl stop firewalld.service
systemctl disable firewalld.service

to stop and disable the CentOS firewall. It is ok when you get errors here, this just indicates that the firewall was not installed.

Then you should check that the firewall has really been disabled. To do so, run the command:

iptables -L

The output should look like this:

[[email protected] ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Or use the firewall-cmd command:

firewall-cmd --state
[[email protected] ~]# firewall-cmd --state
not running
[[email protected] ~]#

Now I will install the network configuration editor and the shell based editor "nano" that I will use in the next steps to edit the config files:

yum -y install nano wget NetworkManager-tui yum-utils

If you did not configure your network card during the installation, you can do that now. Run...


... and go to Edit a connection:

Edit Network connection

Select your network interface:

Select network interface

Then fill in your network details - disable DHCP and fill in a static IP address, a netmask, your gateway, and one or two nameservers, then hit Ok:

Set netmask

Next select OK to confirm the changes that you made in the network settings

Confirm network settings

and Quit to close the nmtui network configuration tool.

Quit nmtui

You should run


now to check if the installer got your IP address right:

[[email protected] ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::20c:29ff:fee5:5b47 prefixlen 64 scopeid 0x20<link>
inet6 2003:c2:9731:a445:20c:29ff:fee5:5b47 prefixlen 64 scopeid 0x0<global>
ether 00:0c:29:e5:5b:47 txqueuelen 1000 (Ethernet)
RX packets 227784 bytes 317714901 (302.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 205574 bytes 23608521 (22.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[[email protected] ~]#

If your network card does not show up there, then it not be enabled on boot, In this case, open the file /etc/sysconfig/network-scripts/ifcfg-eth0

nano /etc/sysconfig/network-scripts/ifcfg-ens33

and set ONBOOT to yes:


and reboot the server.

Check your /etc/resolv.conf if it lists all nameservers that you've previously configured:

cat /etc/resolv.conf

If nameservers are missing, run


and add the missing nameservers again.

Now, on to the configuration...

Adjusting /etc/hosts and /etc/hostname

Next, we will edit /etc/hosts. Make it look like this:

nano /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4 server1

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

Set the hostname in the /etc/hostname file. The file shall contain the fully qualified domain name (e.g. in my case) and not just the short name like "server1". Open the file with the nano editor:

nano /etc/hostname

And set the hostname in the file.

Save the file and exit nano.

Set SELinux to permissive

SELinux is a security extension of CentOS that should provide extended security. ISPConfig does not ship with an SELinux rule set, therefore I set it to permissive (this is a must if you want to install ISPConfig later on).

Edit /etc/selinux/config and set SELINUX=permissive:

nano /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

Afterwards we must reboot the system:


4 Enable Additional Repositories and Install Some Software

First, we import the GPG keys for software packages:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

Then we enable the EPEL repository on our CentOS system as lots of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 7 repository:

yum -y install epel-release

Then we update our existing packages on the system:

yum -y update

Now we install some software packages that are needed later on:

yum -y groupinstall 'Development Tools'

5 Quota

(If you have chosen a different partitioning scheme than I did, you must adjust this chapter so that quota applies to the partitions where you need it.)

To install quota, we run this command:

yum -y install quota

Now we check if quota is already enabled for the file system where the website (/var/www) and maildir data (var/vmail) is stored. In this example setup, I have one big root partition, so I search for ' / ':

mount | grep ' / '
[[email protected] ~]# mount | grep ' / '
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota)
[[email protected] ~]#

If you have a separate /var partition, then use:

mount | grep ' /var '

instead. If the line contains the word "noquota", then proceed with the following steps to enable quota.

Enabling quota on the / (root) partition

Normally you would enable quota in the /etc/fstab file, but if the filesystem is the root filesystem "/", then quota has to be enabled by a boot parameter of the Linux Kernel.

Edit the grub configuration file:

nano /etc/default/grub

search for the line that starts with GRUB_CMDLINE_LINUX and add rootflags=uquota,gquota to the commandline parameters so that the resulting line looks like this:

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet rootflags=uquota,gquota"

and apply the changes by running the following command.

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg_bak
grub2-mkconfig -o /boot/grub2/grub.cfg

and reboot the server.


Now check if quota is enabled:

mount | grep ' / '
[[email protected] ~]# mount | grep ' / '
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)
[[email protected] ~]#

When quota is active, we can see "usrquota,grpquota" in the mount option list.

Enabling quota on a separate /var partition

If you have a separate /var partition, then edit /etc/fstab and add ,uquota,gquota to the / partition (/dev/mapper/centos-var):

nano /etc/fstab

# /etc/fstab
# Created by anaconda on Sun Sep 21 16:33:45 2014
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
/dev/mapper/centos-root / xfs defaults 1 1
/dev/mapper/centos-var /var xfs defaults,uquota,gquota 1 2
UUID=9ac06939-7e43-4efd-957a-486775edd7b4 /boot xfs defaults 1 3
/dev/mapper/centos-swap swap swap defaults 0 0

Then run

mount -o remount /var
quotacheck -avugm
quotaon -avug

to enable quota. When you get an error that there is no partition with quota enabled, then reboot the server before you proceed.

6 Install Apache, PHP, MySQL and phpMyAdmin

Enable the Remi repository to get newer PHP versions:

yum install
yum-config-manager --enable remi-php72

We can install the needed packages with one single command:

yum -y install ntp httpd mod_ssl mariadb-server php php-mysql php-mbstring phpmyadmin

To ensure that the server cannot be attacked through the HTTPOXY vulnerability, we will disable the HTTP_PROXY header in apache globally. 

Add the apache header rule at the end of the httpd.conf file:

echo "RequestHeader unset Proxy early" >> /etc/httpd/conf/httpd.conf

And restart httpd to apply the configuration change.

service httpd restart
Share this page:

Suggested articles

31 Comment(s)

Add comment


By: Gecata at: 2019-04-09 16:18:23

If someone want to use Postfix 3 /instead default Postfix 2/ here is the steps:

yum -y remove postfix ssmtp sendmail

yum -y install

yum-config-manager --enable gfyum-config-manager --enable gf-plusyum -y install postfix3 postfix3-mysql ntp getmail cyrus-sasl-plainsystemctl stop sendmail.servicesystemctl disable sendmail.servicesystemctl enable postfix.servicesystemctl restart postfix.service

Now i'm testing it and it work fine already 2 weeks.

By: me at: 2019-04-12 10:21:50

Hello. Where did you create users for using the mail services ? Thank you.

By: till at: 2019-04-12 10:22:54

Just log into ispconfig and add a mail domain and mailbox there.

By: Vincent Meyer at: 2019-04-15 18:29:54

 I think there's a possible error in the instructions to edit phpMyAdmin.conf.  The instructions look the same as previous versions, however the code is different and the new version (top entry) is missing the "Require all granted" line and has two extra lines commented out.

Am I missing something?


Vincent Meyer

<Directory /usr/share/phpMyAdmin/> <IfModule mod_authz_core.c> # Apache 2.4 # <RequireAny> # Require ip # Require ip ::1 # </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from Allow from ::1 </IfModule> </Directory> <Directory /usr/share/phpMyAdmin/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> # Require ip # Require ip ::1 Require all granted </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from Allow from ::1 </IfModule> </Directory>

By: till at: 2019-04-15 18:35:54

Thank you for the notice. The file was fine just the text needed to be changed. I've changed the description to match the new file structure now.

By: kos at: 2019-04-18 04:38:36

nano /etc/httpd/conf.d/phpMyAdmin.conf


Require all Granted

Require all granted

By: rares at: 2019-04-23 06:54:47

For me it works only with 

# Apache 2.4

<RequireAny> #Require ip #Require ip ::1 Require all granted </RequireAny> Otherwise when trying to connect to / phpmyadmin I received the message "Forbidden"

By: Tushar at: 2019-05-09 07:37:13

anyone provide complete installation service as per our requirments ?

By: till at: 2019-05-09 07:54:11

You can get remote installation support for ISPConfig here:

By: Dimitris at: 2019-05-15 18:43:43

 Any chance of making the same tutorial for NGINX too?

By: nicholas at: 2019-06-12 21:37:47

if enable DKIM... amavisd won't start :/ how to resolve?

By: Haris at: 2019-06-16 12:21:23

I installed perfect server on my VPS. Its working perfectly but i only getting one issue. website harddisk quota showing unlimted, both hard limit and soft limit. I put 5000 mb web space limit for website but me and my client showing unlimited. I think its because I didn't change anything in "/etc/default/grub". If I put "rootflags=uquota,gquota" then my vps will not start and show "Unrecognized mount option uquota or missing value"please help me to install and configure "quota"

my defalut  "/etc/default/grub"GRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet"GRUB_DISABLE_RECOVERY="true"

my default "/etc/fstab"UUID=1b2a04a0-30db-4dcb-8577-31ed02090afa /                       ext4    defaults,noatime        1 0UUID=56a52b27-7b05-47d3-ad5b-deaa4542c70f /boot                   ext4    defaults,noatime        1 0

please help

By: adamjedgar at: 2019-06-23 23:16:26

ifconfig command in Centos 7 may not understanding is that it is obsolete?

An alternative is

[[email protected] ~]# ip addr

By: Submit at: 2019-07-02 10:58:55

Ack, seriously? Can't put that in red or use [] to indicate that is one of the values that needs changed?



By: CMRazvan at: 2019-07-08 05:54:57

Hy, i use a virtual server from DigitalOcean for testing ISPConfig, i create a droplet whit CentoS 7.6 64Bit, but sorry , this is not working can you tel me why ?? and why is so hard to install ISP Confing ? i try more den 5 times and more then 7 times , rebuild droplet for trying other ways for install , can someone explain more ? or give me an hint what linux should i use  ?  


By: till at: 2019-07-08 08:26:52

The recommended Linux Distributions for ISPConfig are Debian and Ubuntu. CentOS is by far the hardest tó install, but nonetheless, a copy/paste of the above guide works, tested it again last week. So not sure where you're installation has gone wrong. Anyway, better use one of the recommended and most easy to install Distributions:

By: Gaston Girardi at: 2019-07-17 19:06:33

Hi, in the fifth step Quota, after installing quota without any problem, i run mount | grep ' / 'And i get the following parameters./dev/md2 on / type ext3 (rw,noatime,seclabel,data=ordered)I try to follow the example with the premise that i have one big partition and that's all, but when i reboot the server i'm not able to connect trougth SSHand i have to reinstall the image, we have our server hosted with Ionos.

Any ideas of what i have to do?, also can i continue skipping that step and finishing at the end?, I'm new and i don't have much experience.

By: Lucas Schatz at: 2019-08-14 14:19:57

For the users thar are experiencing forward e-mails getting DKIM failed, add SRS support in our postfix configuration, it will rewrite the header from the e-mail.



By: Stanislav Panayotov at: 2019-08-22 12:34:25

I'm having problems with SSL options. I successfully created a domain and site in ispconfig, but I get SSL options for it not from its file, but from the ssl.conf file. If I delete ssl.conf file then httpd open only ports 8080, 8081 and 80.

By: Ricardo Lopez at: 2019-09-04 07:45:21

 This Configuration of Mailman , Work with Virtual User and domain , over mysql.


By: Sam Hong at: 2019-09-06 18:51:48

Newbie question, At the beginning of this tutorial it states "ISPConfig ships with the Bastille firewall script that I will use as the firewall".  I am confused, is Bastille a firewall?  I don't see any evidence of a firewall running after installing ISP Config.  Can I just turn iptables back on?

By: till at: 2019-09-09 05:54:00

Bastille is an iptables based firewall script. You can turn on the firewall under System in ISPConfig.

By: Ronald at: 2019-09-25 23:08:08

Great article, very detailed. Just followed all the steps and wanted to use the ISPConfig Migration Toolkit to migrate everything from an old server, but I receive this error message when going to System > Remote Users

Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation

I am pretty sure that the admin account should have these privileges granted from the start.

Any suggestion is appreciated.




By: Ronald at: 2019-09-26 09:14:36

Funny thing that I did not notice is that the same error is also displayed in other parts of ISPConfig.

Any idea how to fix? Do I need to start from fresh, would that be the better option?



By: till at: 2019-09-26 09:18:25

are you sure that you are logged in with the user with the name 'admin'? This is the only user which has the required permissions, if you created another user under system > cp users, even when you assigned him to admin group, he will not be able to access these settings. so you must use the original admin user for that. It might be better if you make a post in the ispconfig support forum here at howtoforge if you need further help.

By: Ronald at: 2019-09-26 14:05:33

yeah, pretty sure, it's the only user in ISPConfig (being a fresh install). 

By: till at: 2019-09-26 14:11:45

Ok, that's strange indeed then. Please use the forum to post your issue there.

By: _ronald_ at: 2019-09-26 15:10:00

I just did.


By: _ronald_ at: 2019-09-26 15:09:37

yeah, pretty sure, it's the only user in ISPConfig (being a fresh install). 

By: Todd B at: 2019-10-10 14:30:55

Followed this to the letter (except for installing mailman) on centos 7.7.

My email is going to system mail /var/mail instead of to /var/vmail/<domain>.

Not sure what's going on, but it seems something is broke.

By: Todd B at: 2019-10-10 14:46:44

Updated... ispconfig3 doesn't bother to check for in mydestination= in postfix/

Found another post that explained this and problem finally solved... I've been fighting this for *4* days.