Yesterday's Top Poster

How to Install DirectAdmin on a Server?

Steven

Administrator
DirectAdmin is a lightweight and powerful web hosting control panel that helps manage websites, emails, and databases efficiently. This guide walks you through the installation process on a fresh Linux server.

Prerequisites

Before proceeding with the installation, ensure that you have:
  • A fresh server installation of CentOS 7/8, AlmaLinux 8/9, Debian 9/10/11, or Ubuntu 18/20/22
  • Root access to the server
  • A valid DirectAdmin license (purchase from DirectAdmin’s official website)
  • A static public IP address

Step 1: Update Your System

Before installing DirectAdmin, update your system packages to ensure stability.

For CentOS/AlmaLinux:
Code:
yum update -y
For Debian/Ubuntu:
Code:
apt update && apt upgrade -y

Step 2: Set Hostname

DirectAdmin requires a fully qualified domain name (FQDN) as the hostname. You can set it using the following command:
Code:
hostnamectl set-hostname server.example.com
Replace server.example.com with your actual domain or subdomain

Step 3: Disable SELinux (For CentOS/AlmaLinux Only)

Run the following command to disable SELinux:

Code:
setenforc 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

Then, verify SELinux status with:

Code:
sestatus

It should show SELinux status: disabled.

Step 4: Download and Run DirectAdmin Installation Script

Use the following command to download the installation script:

Code:
bash <(curl -fsSL https://www.directadmin.com/setup.sh)
This will start the installation process.

Step 5: Follow Installation Prompts

During installation, you’ll be prompted for:

1. License Key: Enter the license details provided by DirectAdmin.

2. Operating System Selection: Choose the appropriate OS.

3. Additional Software Options: Select software like PHP, MySQL/MariaDB, Apache, Nginx, etc.

The installer will then configure and install DirectAdmin and its dependencies automatically.

Step 6: Access DirectAdmin

Once the installation is complete, you will see a success message with login details. By default, DirectAdmin runs on port 2222. You can access it via your web browser using:
Code:
http://YOUR_SERVER_IP:2222

or

https://YOUR_SERVER_IP:2222 (if SSL is enabled)

For example:
Code:
https://192.168.1.100:2222
You will be prompted to log in using the admin username and password generated during installation.


If you need to retrieve your login details, you can find them in:

Code:
cat /usr/local/directadmin/scripts/setup.txt

Step 7: Configure Firewall (If Needed)

Ensure that port 2222 is open in your firewall. Use the following commands based on your system:

For CentOS/AlmaLinux (Firewalld):
Code:
firewall-cmd --add-port=2222/tcp --permanent

firewall-cmd --reload

For Debian/Ubuntu (UFW):
Code:
ufw allow 2222/tcp

ufw reload

Step 8: Secure DirectAdmin

To enhance security, consider the following:

1. Change the Default Admin Password

Use this command to change the password:

Code:
passwd admin

2. Enable SSL for Secure Access

Run the following command to enable Let’s Encrypt SSL for DirectAdmin:
Code:
/usr/local/directadmin/scripts/letsencrypt.sh request_single server.example.com 4096
Replace server.example.com with your hostname.

3. Change the Default Port (Optional, for Security)

Edit the DirectAdmin configuration file:
Code:
nano /usr/local/directadmin/conf/directadmin.conf
Find this line:
Code:
port=2222
Change 2222 to another port (e.g., 8443), then restart DirectAdmin:

Code:
service directadmin restart

Step 9: Start Using DirectAdmin

You can now start managing websites, databases, and emails through DirectAdmin’s web interface.

Create a New User Account

To create a hosting account:

1. Log in as admin.

2. Navigate to Account Manager > Create a New User.

3. Fill in the required details (username, domain, package, etc.).

Your DirectAdmin server is now fully set up and ready to use!

Conclusion

Installing DirectAdmin is straightforward when following these steps. With a secure setup and firewall rules in place, your server will be ready to host websites and applications efficiently. If you encounter any issues, you can check the DirectAdmin logs using:

Code:
tail -f /var/log/directadmin/error.log



For more advanced configurations, refer to the official DirectAdmin documentation.
 
Back
Top