Installing DirectAdmin on CentOS and Ubuntu
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. This guide will also explore alternative methods for achieving similar outcomes.
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
$ wget -O setup.sh https://www.directadmin.com/setup.sh
$ chmod 755 setup.sh
$ ./setup.sh auto
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:
$ cd /usr/local/directadmin/custombuild
$ ./build set opcache yes
$ ./build opcache
$ ./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:
$ ./build set php1_mode php-fpm
$ ./build update
$ ./build set webserver nginx
$ ./build nginx
$ ./build php d
$ ./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:
$ ./build update
$ ./build set webserver litespeed
$ ./build set php1_mode lsphp
$ ./build set php2_mode lsphp
$ ./build set php3_mode lsphp
$ ./build set php4_mode lsphp
$ ./build litespeed
$ ./build set mod_ruid2 no
$ ./build php n
This completes the migration to LiteSpeed! Add the commercial license to finish the setup.
Alternative Solutions for Server Management
While DirectAdmin provides a comprehensive control panel solution, other options exist that may be more suitable depending on specific needs and technical expertise. These alternatives range from other control panels to more hands-on approaches utilizing command-line tools and scripting.
1. Using a Different Control Panel: cPanel or Plesk
Explanation: cPanel and Plesk are popular alternatives to DirectAdmin, each offering a unique set of features and interface designs. cPanel is known for its user-friendliness and extensive third-party integrations, while Plesk boasts excellent support for both Linux and Windows servers, along with robust security features. The choice between these control panels often comes down to personal preference and specific requirements.
Implementation (Conceptual):
The installation process for cPanel and Plesk differs from DirectAdmin, involving downloading specific installation scripts and following their respective setup wizards. The core concept remains the same: providing a web-based interface for managing server resources, domains, emails, and databases.
Advantages:
- cPanel: Wide community support, numerous plugins, and a familiar interface for many users.
- Plesk: Cross-platform compatibility, advanced security features, and integrated support for Docker.
Disadvantages:
- Cost: cPanel and Plesk licenses can be more expensive than DirectAdmin, particularly for larger installations.
- Resource Usage: Some users find cPanel and Plesk to be more resource-intensive than DirectAdmin, potentially impacting server performance.
2. Command-Line Management with Webmin/Virtualmin
Explanation: For users comfortable with the command line, Webmin and its Virtualmin module offer a powerful and flexible alternative to traditional control panels. Webmin provides a web-based interface for managing system-level tasks, such as user accounts, software packages, and network configuration. Virtualmin extends Webmin with features specifically tailored for web hosting, including domain management, email configuration, and database administration.
Implementation:
First, install Webmin:
On CentOS/RHEL:
sudo tee /etc/yum.repos.d/webmin.repo <<EOF
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
EOF
sudo rpm --import http://www.webmin.com/jcameron-key.asc
sudo yum install webmin
On Ubuntu/Debian:
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
sudo tee /etc/apt/sources.list.d/webmin.list <<EOF
deb http://download.webmin.com/download/repository sarge contrib
EOF
sudo apt update
sudo apt install webmin
After installing Webmin, you can install Virtualmin from within the Webmin interface.
Advantages:
- Lightweight: Webmin and Virtualmin are less resource-intensive than full-fledged control panels, resulting in improved server performance.
- Flexibility: Webmin provides granular control over system settings, allowing for advanced customization.
- Cost-Effective: Webmin and Virtualmin are open-source and free to use.
Disadvantages:
- Steeper Learning Curve: Requires familiarity with command-line administration.
- Less User-Friendly: The interface can be less intuitive than dedicated hosting control panels.
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. While DirectAdmin is a powerful tool, alternative solutions like cPanel, Plesk, and Webmin/Virtualmin offer different approaches to server management. The best choice depends on your specific needs, technical expertise, and budget. Carefully evaluate the pros and cons of each option before making a decision. Congratulations on a successful setup!