Installing DirectAdmin on CentOS and Ubuntu

Install and configure Direct Admin on CentOS 7/8 and Ubuntu 20.04/22.4

Introduction

DirectAdmin stands as a robust and user-friendly hosting control panel designed for Linux-based servers. Renowned for its efficiency and ease of use, DirectAdmin simplifies complex server management tasks, making it an ideal choice for both beginners and experienced system administrators. Offering a comprehensive suite of features, DirectAdmin streamlines the deployment and administration of web hosting environments, providing a reliable foundation for website hosting, email management, and more. In this step-by-step guide, we will delve into the process of installing the latest version of DirectAdmin on both CentOS 7/8 and Ubuntu 20.04/22.4 servers, ensuring a smooth and tailored setup for your hosting needs.

Prerequisites

Before initiating the installation, ensure your system has the necessary packages and dependencies. Depending on your operating system, follow the instructions below:

On CentOS 7/8:

$ yum update
$ yum install bind bind-libs bind-utils openssl openssl-devel gcc gcc-c++ flex bison make 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-libwww-perl xfsprogs rsyslog logrotate crontabs file kernel-headers

On Ubuntu 20.04/22.04:

$ apt update
$ sudo apt install build-essential bind9 dnsutils gcc make openssl libssl-dev zlib1g zlib1g-dev libaio1 libaio-dev libcap-dev cron bzip2 cmake pkg-config libdb-dev libsasl2-dev libncurses5 libncurses5-dev libsystemd-dev quota patch logrotate rsyslog libc6-dev libexpat1-dev libcrypt-openssl-rsa-perl

Downloading and Running Installer

  • Download the auto-installer script:
$ wget -O setup.sh https://www.directadmin.com/setup.sh
  • Make the script executable:
$ chmod 755 setup.sh
  • Run the installer in auto mode:
$ ./setup.sh auto
  • Accept the license agreement.
  • Use default options, except for the database; choose “MariaDB” instead of MySQL.
  • Monitor the installation progress at /var/log/directadmin/custombuild.xxxx.log.

The installer automatically detects the OS environment and installs Apache+PHP, DNS server, MariaDB database, and all other DirectAdmin components.

Post-Install Configuration

Once DirectAdmin is installed, adhere to best practices:

  • Enable Opcache for faster PHP performance:
$ cd /usr/local/directadmin/custombuild
$ ./build set opcache yes  
$ ./build opcache
  • Switch the database to MariaDB if MySQL was installed:
$ ./build set mariadb 10.6
$ ./build set mysql_inst mariadb
$ ./build set mysql_backup yes
$ ./build update
$ ./build mariadb  

The base DirectAdmin setup is now complete!

(Optional) Switching Web Server to Nginx

For improved performance, switch to Nginx:

  • Enable PHP as FPM:
$ ./build set php1_mode php-fpm
  • Update configs:
$ ./build update 
  • Install Nginx:
$ ./build set webserver nginx
$ ./build nginx
  • Rebuild PHP for FPM:
$ ./build php d
  • Restart services:
$ ./build restart

The web server is now running on Nginx + PHP-FPM!

(Optional) Switching Web Server to LiteSpeed

For maximum performance, consider LiteSpeed web server with LSPHP:

  • Update config:
$ ./build update
  • Set the webserver to LiteSpeed:
$ ./build set webserver litespeed
  • Set PHP modes to LSPHP:
$ ./build set php1_mode lsphp 
$ ./build set php2_mode lsphp
$ ./build set php3_mode lsphp 
$ ./build set php4_mode lsphp
  • Build and install:
$ ./build litespeed
  • If errors related to mod_ruid2 occur, disable it:
$ ./build set mod_ruid2 no
  • Recompile PHP for LSPHP:
$ ./build php n

This completes the migration to LiteSpeed! Add the commercial license to finish the setup.

Conclusion

You’ve successfully installed and configured DirectAdmin on your server, tailoring it to your preference with either Nginx or LiteSpeed. These comprehensive steps ensure a robust hosting environment. Regularly check logs for updates and improvements. Congratulations on a successful setup!

LEAVE A COMMENT