Web hosting has become an integral part of all online businesses. DirectAdmin is one of the best hosting control panels available for Linux users. It is bundled with tools and intuitive web interface that enables your servers and websites efficiently and in user-friendly manner ensuring management of hosting accounts is streamlined. DirectAdmin has clean layout for easy navigation making it likable by both beginners and experienced users.

Below are some of the key functionalities of DirectAdmin:

  • DNS and Domains Management: With DirectAdmin you can manage your domains, sub-domains, and DNS settings.
  • Files and FTP Management: It has file management functionality for files upload, download, deleting, and modify files from web interface.
  • Email Management: It offers tools that are used to create email accounts, forward emails, and management of spam filters.
  • Management of Databases: DirectAdmin has tools used to manage Database management systems such as MySQL and PostgreSQL.
  • Security Features: DirectAdmin is security oriented solution. It has firewall management functions, and SSL certificates management, both for the server and added domains.
  • And much more

DirectAdmin provides 3 levels of access control

  • Admin level
  • Reseller level
  • User level

In this brief guide we will share all the process that should be followed when installing and using DirectAdmin on Rocky Linux 8 / AlmaLinux 8. So let’s begin.

1 – Set timezone and configure NTP

Begin by making sure the system is updated and upgraded.

sudo dnf -y update

Set hostname for your DirectAdmin server.

sudo hostnamectl set-hostname hosting.example.com

Next set correct timezone

sudo timedatectl set-timezone Africa/Nairobi

Install chrony ntp server package.

sudo dnf -y install chrony

Enable the service to start at system boot.

sudo systemctl enable --now chronyd

Ensure that the service is running

$ systemctl status chronyd
● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2023-12-10 02:40:04 EAT; 3 days ago
     Docs: man:chronyd(8)
           man:chrony.conf(5)
 Main PID: 749 (chronyd)
    Tasks: 1 (limit: 203493)
   Memory: 2.1M
   CGroup: /system.slice/chronyd.service
           └─749 /usr/sbin/chronyd

Dec 10 02:40:04 hosting.example.com systemd[1]: Starting NTP client/server...
Dec 10 02:40:04 hosting.example.com chronyd[749]: chronyd version 4.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG)
Dec 10 02:40:04 hosting.example.com chronyd[749]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift
Dec 10 02:40:04 hosting.example.com chronyd[749]: Using right/UTC timezone to obtain leap second data
Dec 10 02:40:04 hosting.example.com systemd[1]: Started NTP client/server.
Dec 10 02:40:11 hosting.example.com chronyd[749]: Selected source 160.119.216.202 (2.rocky.pool.ntp.org)
Dec 10 02:40:11 hosting.example.com chronyd[749]: System clock TAI offset set to 37 seconds

Manually synchronize your local system time.

$ sudo chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ 160.119.216.197               3   6    37     5   +162us[  +67us] +/- 7212us
^- time.cloudflare.com           3   6    37     5    +52ms[  +52ms] +/-  163ms
^- time.cloudflare.com           3   6    37     4    +42ms[  +41ms] +/-  152ms
^* 160.119.216.206               3   6    37     4    -72us[ -168us] +/- 7425us

2 – Using additional disk for website data (optional)

The default directory for website data is /home. It’s recommended to mount a dedicated disk for data storage.

We’ve attached a secondary disk to the VM instance /dev/vdb as seen in the command output below.

$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1    4M  0 rom
vda    252:0    0  100G  0 disk
├─vda1 252:1    0   99M  0 part /boot/efi
├─vda2 252:2    0 1000M  0 part /boot
├─vda3 252:3    0    4M  0 part
├─vda4 252:4    0    1M  0 part
└─vda5 252:5    0 98.9G  0 part /
vdb    252:16   0  500G  0 disk

Let’s partition the disk and create a filesystem.

sudo parted /dev/vdb mklabel gpt
sudo parted /dev/vdb mkpart primary 0% 100%
sudo mkfs.xfs /dev/vdb1

Ultimately we’ll mount it under /home. For now we can use /mnt

sudo mount /dev/vdb1 /mnt

Sync everything from /home to /data directory.

sudo rsync -avz /home/* /mnt

Check the UUID of the disk partition. We’ll use this in /etc/fstab.

$ blkid /dev/vdb1
/dev/vdb1: UUID="e9fafa9a-e2db-4bd2-9a0b-069178c0a133" BLOCK_SIZE="512" TYPE="xfs" PARTLABEL="primary" PARTUUID="4dea6fd1-370d-4b49-90c6-1ecb9ad98d78"

Open the fstab file for editing.

$ sudo vim /etc/fstab
UUID=e9fafa9a-e2db-4bd2-9a0b-069178c0a133 /home xfs defaults,uquota,pquota  0 0

Test to confirm no typis in fstab file.

sudo umount  /mnt
sudo mount -a

Reboot the system

sudo reboot

Check mount options once the system is rebooted.

# mount | grep ' /home '
/dev/vdb1 on /home type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,usrquota,prjquota)

3 – Enabling Disk Quotas

In web hosting business, disk quotas are used in restricting how much disk space a user can use. If your /home is under /, then we must change the kernel boot options by editing the file /etc/default/grub to enable Quota options.

Open the file and add the options rootflags=uquota,pquota:

$ sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX="console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto rootflags=uquota,pquota"

Generate a new grub.cfg file:

$ sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

Reboot the server after generating new Grub configuration.

sudo reboot

Wait for the system to come back online then check the mounting options to ensure that “noquota” doesn’t appear.

# mount | grep ' / '
/dev/vda5 on / type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,usrquota,prjquota)

For dedicated /home partition:

$ mount | grep ' /home '
/dev/vdb1 on /home type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,usrquota,prjquota)

Fore more details on Disk quotas see: How To Enable Disk Quota on XFS or Ext4 Linux system

4 – Install DirectAdmin on Rocky / AlmaLinux 8

Switch to root user.

sudo su -

Install and launch tmux to avoid sessions timeout during installation of DirectAdmin.

sudo dnf -y install tmux
tmux

Visit DirectAdmin Pricing page and acquire one that suits your hosting requirements.

Provide the license key as you execute installation script.

bash <(curl -fsSL https://download.directadmin.com/setup.sh) '<Provided license key should go here>'

The deployment should start with the dependencies resolution.

....
Transaction Summary
======================================================================================================================================================================================================
Install  168 Packages

Total download size: 37 M
Installed size: 110 M

Wait for the installation to complete. All access details will be provided in the screen.

...
Checking quotas...
Running quotacheck
Done quotacheck
Welcome to DirectAdmin version 1.665!

Here is the information given:
Admin User:         admin
Admin Email:        [email protected]
Update channel:     current
Network Device:     eth0
Server IP:          102.216.155.236
Server IP Netmask:  /29
Server Hostname:    admin.example.com
Name Servers:
        ns1.admin.example.com
        ns2.admin.example.com
ip.list written successfully
./data/admin/next_ticket.number written correctly
tickets.list written successfully
Admin admin is being created by root.
Error with quotas: xfs_quota: cannot set limits: Function not implemented

secure_access_group='access' did not exist (9999). Creating it and adding defaults.
Admin user created

System Security Tips:
  https://docs.directadmin.com/operation-system-level/securing/general.html#basic-system-security

The following information has been set:
Admin username: admin
Admin password: 8G0RgYV4iBrcHapLpeWQOQ
Admin email: [email protected]


Server Hostname: nadmin.example.com

Post installation is execution of CustomBuild. It is a tool which manages DirectAdmin-related services, such as WWW, E-mail, SQL, PHP, and others. Most of the packages are compiled from the source.

The build process will take some time.

CustomBuild installation has started, you may check the progress using the following command: tail -f /var/log/directadmin/custombuild.1702629701.18861.YWxsAGQA.log
[setup.sh] You will receive a message in the DirectAdmin panel when background installation finalizes.

Run the commands provided below if you want to check the progress of CustomBuild.

tail -f /var/log/directadmin/custombuild.*.log

When successful you’re informed to reboot the server – “CustomBuild+installation+has+finished

############################################################################################################################################################################################### 100.0%
Lego 4.14.2-SNAPSHOT-cd63b325 Installed.

==> /var/log/directadmin/custombuild.1708774316.34630.YWxsAGQA.log <==
*************************************

Generating grub configuration file ...
File descriptor 99 (/dev/null) leaked on vgs invocation. Parent PID 371910: /usr/sbin/grub2-probe
File descriptor 99 (/dev/null) leaked on vgs invocation. Parent PID 371910: /usr/sbin/grub2-probe
File descriptor 99 (/dev/null) leaked on vgs invocation. Parent PID 372067: /usr/sbin/grub2-probe
File descriptor 99 (/dev/null) leaked on vgs invocation. Parent PID 372067: /usr/sbin/grub2-probe
done
Grub configuration re-generated. Please reboot the box.
2024/02/24 14:44:54  info executing task            task=action=notify&message=CustomBuild+installation+has+finished%2C+to+check+the+full+log+please+check%3A%0A%2Fvar%2Flog%2Fdirectadmin%2Fcustombuild.1708774316.34630.YWxsAGQA.log&subject=CustomBuild+installation+has+finished&value=admin

In some cases the build won’t start automatically. The CustomBuild installer can be initiated manually

da build all d

Checking installed version of DirectAdmin.

 # /usr/local/directadmin/directadmin version
DirectAdmin v.1.657 aa282043f7809054a5b18e1e839716062ba2e621

5 – Configuring Firewalld rules (optional)

Here is a table of all ports and services used by DirectAdmin

PortService NameComment
20,21FTPFTP will use a “random high port number” if the client is in PORT mode, so you may need to add a port range into your /etc/proftpd.conf file to allow FTP connections, e.g., PassivePorts 35000 35999, and then open that same port range as well in your firewall
22SSHdefault port for SSH access
25,587EximSMTP for Exim to receive email
53NamedTCP and UDP, so your sites resolve
80,443Apacha/NGINXApache or Nginx traffic, HTTP and HTTPS
110,143,993,995Dovecotclient Pop and Imap email access
2222DirectAdminAccessing panel
2703RazorOptional: RAZOR check for SpamAssassin
3306MySQLYou don’t need to open this port if you don’t want to allow remote MySQL access, as most MySQL scripts are all accessed locally.

Install Firewalld package.

sudo dnf -y install firewalld

Start and enable firewalld service.

sudo systemctl enable --now firewalld

Enable DirectAdmin and other services port in the firewall:

sudo firewall-cmd --zone=public --add-port={2222,20,21,22,25,587,80,443,110,143,993,995}/tcp --permanent 

Reload the firewall to apply the new rules:

sudo firewall-cmd --reload

6 – Access DirectAdmin web portal

You can set the license after installation if you missed during installation.

da license-set 'LICENSE-KEY'

After the install, access DirectAdmin login portal at http://server.ip.address:2222.

DirectAdmin 01

Login with the Admin username and password from the output information provided by setup.sh. The information can also be accessed in the following file.

cat /usr/local/directadmin/conf/setup.txt

DirectAdmin web interface look:

DirectAdmin 02

Check services status under Control Panel > Admin > Service Monitor

DirectAdmin Services

Conclusion

In this article we’ve been able to install and configure DirectAdmin on Rocky Linux 8 / AlmaLinux 8 system. DirectAdmin has proven to be an ultimate replacement to Cpanel web hosting control panel after its licensing changes. It allows users to manage all aspects of the website, and even do extra such as DNS, Files and and Emails management.

LEAVE A REPLY

Please enter your comment!
Please enter your name here