How to Install and Configure DirectAdmin on a VPS
Posted On July 14, 2020
Looking to join the DirectAdmin community? This post will guide you through the easy process of installing and configuring DirectAdmin on a Virtual Private Server (VPS) including some additional security tips and usage examples. This guide will take approximately 10-15 minutes to read through.
1 – Introduction to DirectAdmin
DirectAdmin is a long standing control panel for hosting and managing website projects with an abundance of features and an easy to use design. It’s becoming increasingly popular, particularly since the pricing for competing control panels was abruptly hit in 2019 (see cPanel, reference 19).
The team at DirectAdmin have worked extremely hard to get where they are and evidently even harder since the new stream of customers providing suggestions to the team has arrived.
2 – Installation Requirements
To install DirectAdmin, you’ll need a Linux based server that meets the minimum requirements.
DirectAdmin officially supports the following operating systems:
- CentOS 7 and CentOS 8
- CloudLinux 7 and CloudLinux 8
- Debian 8, Debian 9 and Debian 10
- FreeBSD 11 and FreeBSD 12
For the purposes of this guide, we’ll be using CentOS 8.
In terms of server specifications DirectAdmin recommends a processor running at least 500 Mhz if not more, and more cores will enable you to expand and run more processes. You’ll also need at least 1-2GB RAM and additional SWAP memory of 2GB+ if possible. In terms of storage you will need 2-10GB of free space and bare in mind your website files may also need additional storage.
It’s important that you don’t pre-install any applications like PHP, MySQL or Apache before running the DirectAdmin script, as it does it all for you.
The only pre-install commands necessary are the ones advised by DirectAdmin. For CentOS 8:
yum install wget tar 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-libwww-perl xfsprogs rsyslog logrotate crontabs file \
Don’t forget, you’ll also need root access.
3 – Basic Security
When you install DirectAdmin using the automatic installer, it will pre-install the Config Server Firewall plugin which will whitelist your currently used ports. A security technique widely used is to change the SSH port away from the default value to make it harder for automatic attackers to brute force your machine. To change your port, edit the /etc/ssh/sshd_config file.
Find the line which includes #Port 22 and change it to the value you want it to be and remove the hashtag. Then restart the service.
service sshd restart
Make sure to confirm it’s worked by opening another terminal and trying the new details.
4 – Starting the Installation
1. Download the set up script from the DirectAdmin website using the wget package, which is a package designed to retrieve content and files from websites to your Linux server.
wget -O setup.sh https://www.directadmin.com/setup.sh
2. After the script has been downloaded you’ll need to set the permissions using chmod to run it.
chmod 755 setup.sh
3. Now it’s time to run the script. The ‘auto’ syntax is recommended for most installations as it automatically applies a pre-set configuration and comes bundled with the Config Server Firewall.
5 – Accessing the Control Panel
The control panel is hosted on port 2222. You can access it by visiting youripaddress:2222 in your web browser. You can also point your domain name to the IP address to create a panel hostname.
Your admin login details were created during the installation are displayed within the terminal at the end. If you’re accidentally closed your terminal, not to worry as there is a log file stored of the entire installation process which contains your login information.
cat /var/log/directadmin/install.log | grep Admin
6 – Securing the Control Panel with SSL
You’ll need to secure your hostname. This can easily be done using the inbuilt Let’s Encrypt SSL script.
1. Change to the directory containing the Let’s Encrypt script and run it for your panel hostname.
./letsencrypt.sh request_single your.hostname.com 4096
2. Change to the main DirectAdmin directory and enable the SSL configuration. Then force SSL with your panel hostname and restart DirectAdmin.
./directadmin set ssl 1
./directadmin set carootcert /usr/local/directadmin/conf/carootcert.pem
./directadmin set ssl_redirect_host your.hostname.com
service directadmin restart
7 – Administrator / Custombuild Settings
Custombuild is a tool built in to DirectAdmin that manages the installations and updates of several applications such as Apache, PHP, MySQL and Webmail. There are dozens of alternative applications and functions also included and it’s an extremely important part of managing a DirectAdmin server.
You can access the Custombuild directory at /usr/local/directadmin/custombuild – However, there is also a GUI version available within the control panel which will look something like this:
From within this page you can update software as new versions are released as well as change your software configuration, customise your settings, remove old software and build new software.
8 – Creating a Package and User Account
To create a user package navigate to “Manage User Packages” within the “Account Manager” and then select “Add Package“. You’ll be directed to a package creation screen where you can specify your resource assignments and package options.
To create a user account, navigate to “Add New User” within the “Account Manager” where you can enter the username, domain password and email address for the account you’d like to create as well as select from one of the packages that you’ve just created.
8 – Log File Locations and Conclusion
Log files are an important part of diagnosing an error as they will store the error messages received. To view recent logs, use the tail command with the log location.
/var/log/messages (generic errors)
There are various other log files for the processes included with DirectAdmin that can be found here.
Thank you for reading this guide and I hope it’s given you a decent overview of the initial set up process of a DirectAdmin web hosting server.
Your friends at SmallWeb
cPanel Wikipedia: https://en.wikipedia.org/wiki/CPanel
DirectAdmin Website: https://directadmin.com
DirectAdmin Pre-Install Commands: https://help.directadmin.com/item.php?id=354
DirectAdmin Log File Paths: https://help.directadmin.com/item.php?id=11