Installation of Directadmin on CentOS


In this guide I will be explaining how to install DirectAdmin on a clean installation of Red Hat Enterprise Linux, CentOS 6, 7 and 8 Debian, Ubuntu or FreeBSD. The procedure is exactly the same on all three operating systems and with both 32-bit and 64-bit versions.

It is very important to start off with a clean installation, as the DirectAdmin installer will take care of the installation and configuration of all software components you need.

 

Note: This guide assumes that you are familiar with SSH and basic command line navigation. These instructions apply primarily to customers who have Virtual Private Servers or Dedicated servers. If you do not have root-level access you will not be able to make these changes.



1. Prerequisites

 

Partition Table

Disk partitioning is the creation of one or more storage regions, so that each region can be managed separately. We suggest a simple partition structure of:

Partition Size
/boot 250 MB
swap < 2GB of RAM: 2 x RAM (ex. when 1GB RAM is installed SWAP should be defined as 2GB)
2GB - 8GB of RAM: equal to the amount of RAM
> 8GB of RAM: at least 4GB, a higher value is recommended
/ Rest of drive

Feel free to modify these numbers as needed.

 

Operating Systems

Operating systems supported by DirectAdmin are listed in the table below.

OS Versions
CloudLinux 6.x 32/64-bit, 7.x 64-bit
RedHat Enterprise / CentOS 6.x 32/64-bit, 7.x 64-bit
Debian 8.x 64-bit, , 9.x 64-bit
Ubuntu 12, 14, 16.04
FreeBSD 11.x 64-bit

 

IP address support

In order for DirectAdmin to be able to run on your system, 3 things must be true:

  1. The licensed IP must exist on the server. Type /sbin/ifconfig, and you should see the licensed IP in the output
  2. The licensed IP must function and be able to be bound to, eg:
    wget --bind-address=1.2.3.4 http://www.directadmin.com/index.html
  3. the IP that connects to our server must be the licensed IP

DirectAdmin can run on a LAN/NAT, but requires some non-standard steps to get it running. More information can be found on this page.



2. Installation Procedure


If you have purchased your license directly from DirectAdmin.com, sign into your client account at https://www.directadmin.com/clients and click the "view" link next to your license. Verify that the server IP address and operating system is correct. Also make sure that the license is Active and Verified (if it isn't, you need to contact Direct Admin support).

If you have a problem with a license obtained through us, please contact Woktron Support.

 

2.1 Update CentOS

yum update

 

2.2 install dependencies

Begin by installing the required dependencies for Directadmin:

 

On Rehat/Fedora/CentOS 6
yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel db4-devel

The libcom_err-devel package is required for CentOS 6.

 

CentOS 7
yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel psmisc net-tools systemd-devel libdb-devel perl-DBI perl-Perl4-CoreLibs xfsprogs rsyslog logrotate crontabs file kernel-headers

 

Debian 6
apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev \
zlib1g zlib1g-dev libcap-dev bzip2 automake autoconf libtool cmake pkg-config python libreadline-dev libdb4.8-dev libsasl2-dev patch

 

Debian 7
apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev \
zlib1g zlib1g-dev libcap-dev bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev libncurses5-dev patch libjemalloc-dev

 

Debian 8
apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev \
zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev \
libncurses5-dev libsystemd-dev bind9 dnsutils quota libsystemd-daemon0 patch libjemalloc-dev logrotate rsyslog libc6-dev

You might need to remove libsystemd-dev from the list, if apt-get cannot find it.

 

Debian 9
apt-get update
apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libperl4-corelibs-perl libaio1 libaio-dev \
zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev \
libncurses5-dev libsystemd-dev bind9 dnsutils quota patch libjemalloc-dev logrotate rsyslog libc6-dev libexpat1-dev \
libcrypt-openssl-rsa-perl libnuma-dev libnuma1 bsd-mailx

 

Debian 10 - not yet officially supported
apt-get update
apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libperl4-corelibs-perl libaio1 libaio-dev \
zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev \
libncurses5-dev libsystemd-dev bind9 dnsutils quota patch logrotate rsyslog libc6-dev libexpat1-dev \
libcrypt-openssl-rsa-perl libnuma-dev libnuma1 bsd-mailx

 

FreeBSD

FreeBSD tends to have everything needed, and the need to run pre-install commands is less common.

Custombuild does require gmake, but will try to install it with dpkg -r or ports if it's missing. If needed:

pkg_add -r gmake perl wget bison flex gd cyrus-sasl2 cmake python autoconf libtool libarchive mailx

 

FreeBSD 10
pkg install gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind99 mailx

 

FreeBSD 11
pkg install gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind911 mailx webalizer gettext-runtime

 

FreeBSD 12
pkg install gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind911 mailx webalizer gettext-runtime

 

2.3 install DirectAdmin

Continue by downloading the DirectAdmin setup routine using wget, set file permissions to writable with chmod and finally startup the setup routine by issuing the ./setup.sh command:

wget http://www.directadmin.com/setup.sh
chmod 755 setup.sh
./setup.sh

 

 

After the setup routine starts you will be presented with a number of options:

1. Enter your license details (Client ID and License ID).

2. Enter your hostname

Important: The hostname should not be the same as the primary domain name. e.g. woktron.com is not a valid hostname, where myserver.woktron.com is. Having the same host/main domain name will cause e-mail and FTP problems. Also, please make sure the hostname resolves once you setup DNS.

 

(start installation routine:)
***************************************************** * * Have you run the pre-install commands? CTRL-C if not. * http://help.directadmin.com/item.php?id=354 * ***************************************************** Please enter your Client ID : xxxxx Please enter your License ID : xxxxx Please enter your hostname \(server.domain.com\) It must be a Fully Qualified Domain Name Do *not* use a domain you plan on using for the hostname: eg. don't use domain.com. Use server.domain.com instead. Do not enter http:// or www Enter your hostname (FQDN) : xxxxx.xxxxx.com Client ID: xxxxx License ID: xxxxx Hostname: xxxxx.xxxxx.com Is this correct? (y,n) : y The following ethernet devices/IPs were found. Please enter the name of the device you wish to use: eth0 xxx.xxx.xxx.xxx eth1

DirectAdmin will now be installed on: Enterprise 7.6
Is this correct? (must match license) (y,n) : y
You have chosen custombuild 2.0.

3. Enter your network interface (usually ETH0). When using a Virtual Private Server (VPS) you should select the respective virtual network port:

venet0:0 (the usual option)
venet0:1

If you are unsure open a new window and enter the following in commandline to see which ETH adapter is using your public IP address:

ifconfig

 

2.4 Custombuild

Custombuild is a tool used to automatically install, configure and update the major software components of your DirectAdmin web server. The most current version of Custombuild is version 2.0 and adds the ability to automatically configure 4 PHP versions to be used simultaneously. Custombuild includes support for PHP 5.x, PHP 7.x, Apache, Nginx, LiteSpeed and much more!

More Information about CustomBuild can be found on this page.

(installation routine continued:)
Enter the device name: xxx Is xxx.xxx.xxx.xxx the IP in your license? (y,n) : y DirectAdmin will now be installed on: Enterprise 5.7 Is this correct? (must match license) (y,n) : y 2018-11-11 14:47:00 http://files.directadmin.com/services/custombuild/2.0/custombuild/build Resolving files.directadmin.com Connecting to files.directadmin.com|:80 connected. HTTP request sent, awaiting response 200 OK Length: 289046 (282K) [text/plain] Saving to: `/usr/local/directadmin/custombuild/build' 100%[===========================================================================>] 289,046 855K/s in 0.3s 2011-11-11 14:47:01 (855 KB/s) `/usr/local/directadmin/custombuild/build' saved [289046/289046] Would you like the default settings of apache 2.4 and php 7.2? (y/n): y * Using the default settings for custombuild. Would you like to search for the fastest download mirror? (y/n): y

* For a basic webserver installation selecting "Would you like the default settings of apache 2.4 and php 7.2?" to yes works with no problem. If you'd like to have more control over what should or should not be installed set this option to N

Below you will find what options you have when setting this option to N, thus selecting a custom setup of DirectAdmin:

Would you like to backup the current options.conf? (yes/no): yes
Backup created: /usr/local/directadmin/custombuild/options.conf.20190706062140.backup
Please select webserver you would like to use (apache/nginx/nginx_apache/litespeed/openlitespeed):apache
Please select FTP server you would like to use (proftpd/pureftpd/no):proftpd
Please select default PHP version you would like to use (5.3/5.4/5.5/5.6/7.0/7.1/7.2/7.3):7.3
Please select default PHP mode you would like to use (php-fpm/fastcgi/suphp/lsphp/mod_php):fastcgi
Would you like to have a second instance of PHP installed? (yes/no): yes
Please select additional PHP version you would like to use (5.3/5.4/5.5/5.6/7.0/7.1/7.2/7.3):7.2
Please select additional PHP mode you would like to use (php-fpm/fastcgi/suphp/lsphp):fastcgi
Would you like to have a third instance of PHP installed? (yes/no): yes
Please select additional PHP version you would like to use (5.3/5.4/5.5/5.6/7.0/7.1/7.2/7.3):7.1
Please select additional PHP mode you would like to use (php-fpm/fastcgi/suphp/lsphp):fastcgi
Would you like to have a fourth instance of PHP installed? (yes/no): yes
Please select additional PHP version you would like to use (5.3/5.4/5.5/5.6/7.0/7.1/7.2/7.3):7.0
Please select additional PHP mode you would like to use (php-fpm/fastcgi/suphp/lsphp):fastcgi
Please select if you would like to use ionCube (yes/no):yes
Please select if you would like to use Zend Guard Loader (yes/no):yes
Please select if you would like to use suhosin (yes/no):yes
Please select if you would like CustomBuild to manage Exim installation (yes/no):yes
Please select if you would like CustomBuild to manage Dovecot installation (yes/no):yes
Please select if you would like CustomBuild to manage phpMyAdmin installation (yes/no):yes
Please select if you would like CustomBuild to manage SquirrelMail installation (yes/no):yes
Please select if you would like CustomBuild to manage RoundCube installation (yes/no):yes
Would you like to search for the fastest download mirror? (y/n): y

When the installation routine has completed, you should be ready to login to your newly installed control panel via: http://xx.xx.xx.xx:2222 (where xx.xx.xx.xx is your IP address or domain name). 2222 is the port DirectAdmin normally communicates on. It is important to keep this port open in your firewall

 

2.5 User Credentials

You will receive your default password at the end of the installation routine. Make sure to write it down. In case you forgot your admin password enter the following:

cd /usr/local/directadmin
./directadmin i

Alternatively, you can open the log file that was created after the installation completed. This file can be found at the following location:

/usr/local/directadmin/scripts/setup.txt



3. Securing DirectAdmin

After having DirectAdmin succesfully installed it is now time to secure your server. Securing your DirectAdmin based server is outside the scope of this article. However, we recommend you read the following articles at a bare minimum:



4. Updating DirectAdmin

It is very important to periodically update your server. Keeping your server updated ensures you are not affected by the various vulnerabilities that may affect your server and its users. You can update your server by issuing the following commands:

cd /usr/local/directadmin/custombuild
./build clean
./build update
./build update_versions



5. Custombuild Plugin

The custombuild plugin allows for easy configuration of your Directadmin server by means of a GUI.

Plugins can be easily installed by logging in to DirectAdmin as an Administrator. Head to Extra Features > Plugin Manager. New plugins can be installed by uploading a file or pointing to the correct URL in the Add Plugin section. When done press the install button.

The custombuild plugin can be downloaded here:

http://www.custombuild.eu/plugin/custombuild.tar.gz



6. Troubleshooting

Dealing with RPM errors

When installing RPMs, errors can sometimes occur. Don't panic, solving them is usually easy. If you didn't know what to install during your RedHat installation, you might have installed a few services, such as apache and sendmail. These services must be removed before the rpm will be able to be installed.

For example, lets say you are trying to install exim and you get the following:

rpm -ivh exim-3.36-2.i386.rpm
  Preparing...                         ########################################### [100%]
  file /somefile from install of exim-3.36-2 conflicts with file from package sendmail-8.1
  ...

This would mean that sendmail is already installed on your server and you must remove it. This can easily be accomplished by running the following:

rpm -e --nodeps sendmail

Then you will be able to install your rpm. This follows for other services such as apache, apache-devel, wu-ftp, php, MySQL and so forth. If you need to figure out if you already have a service installed, you can run

rpm -q servicename

or

rpm -qa | grep substring

Where substring is just a word. For example, using "apache" might return:

rpm -qa | grep apache
apache-fp-1.3.27-2
apache-fp-devel-1.3.27-2
apache-fp-manual-1.3.27-2

 

If you are having trouble with RPMs hanging, please take a look at:

http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=73097



7. Need Help?

Should you require any further assistance or in case you have any questions about DirectAdmin, please open a ticket with our support team by logging in to your Client Account, or you can visit the DirectAdmin support forum, where you can find further documentation and FAQs.

  • directadmin, installation, control panel
  • 12 Users Found This Useful
Was this answer helpful?

Related Articles

Installation of SpamAssassin on DirectAdmin

In this guide I will be explaining how to install and configure SpamAssasin on a Direct Admin...

Installation Clam Anti Virus (ClamAV) on DirectAdmin / CentOS

Clam AntiVirus is a popular open source (GPL) anti-virus toolkit for UNIX, designed for e-mail...

Installation of SpamAssassin on DirectAdmin

In this guide I will be explaining how to install and configure SpamAssasin on a Direct Admin...

Installation of SpamAssassin on DirectAdmin

In this guide I will be explaining how to install and configure SpamAssasin on a Direct Admin...

Installation Rootkit Hunter (rkhunter) on CentOS

  Rootkit Hunter (rkhunter) is a Unix-based tool that scans for rootkits, backdoors and possible...