Setup DirectAdmin on a cloud server with PCX

Gewijzigd op Do, 21 Nov om 12:36 PM

If you have a cloud server with us you can install DirectAdmin on it. DirectAdmin is a program that allows you to start your own webhosting server. In this manual we'll explain how this works.


Table of contents


Introduction

There are several reasons for setting up your own hostingserver. For example:

  • Create and maintain websites for customers
  • Host a webshop that requires too much traffic for shared hosting but too little for managed hosting
  • Enable webhosting that can easily scale up for an expected visitor peak 


Creating a cloud server

We start by creating a cloud server. We recommend the following properties.

  • OS: CentOS 7.6 
  • Cores: 4 
  • RAM: 4GB 
  • Disk: 100GB


Use a subdomain as host name. For our example we use the following subdomain: directadmin.hetvoorbeelddomein.xyz

Note: You must use a domain you own or manage so that you can point the DNS to the server in a next step.


  • After the server has been created point your domain to the new server
  • Create an A record for the root domain;
  • Ceate a Wildcard record (*.domain.tld) for all subdomains;
  • We recommend using a CNAME-record set-up;
  • If you want to send and receive mail with DirectAdmin set an MX record and an SPF record. 


Obtaining a DirectAdmin license

You can obtain your license directly via DirectAdmin. They will require the following information from you.

  • IP-adres of the server  
  • The server’s host name
  • The operating system (OS)  

When this information has been processed you are ready to install DirectAdmin on your server. The license will be automatically obtained during the installation proces.


Opening port 25 for outgoing mail

On our cloud servers port 25 for outgoing mail traffic is blocked by default. This is done to ensure the safety and integrity of the platform. To open this port follow these steps.

  1. Go to the control panel;
  2. Click on Outgoing port rules;
  3. Choose Add outgoing port rule.


The server and domain are now ready to install DirectAdmin. To install DirectAdmin, you must first connect via SSH. 


MacOS and Linux

On MacOS and Linux you can do this via the Terminal. Use the following command: ssh root@hetvoorbeelddomein.xyz (You replace hetvoorbeeldomein.xyz with your actual domainname). If you did not setup the SSH-keys the server will prompt you for the password. You are now logged in on the server.


Windows

When using Windows you usually need a separate program to connect via SSH. For instance the free application Putty. Experience has shown that it is not straightforward to copy and paste text. So check in advance how you can do this easily.

The first command we issue on the server is to update all software on the machine: yum update && yum upgrade

A number of questions are asked to which you can all answer Yes by typing “Y”.

Issuing the following commands:

  • yum install -y yum-cron 
  • sed -i '/apply_updates/s/no/yes/g' /etc/yum/yum-cron.conf systemctl 
  • enable yum-cron service yum-cron start


Install the packages

Now that everything is up to date, we are going to install some packages (programs) that are needed for DirectAdmin. You can copy and paste the following lines entirely.


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-Perl4-CoreLibs perl-libwww-perl xfsprogs rsyslog logrotate crontabs file kernel-headers

Any questions can again be answered with Yes or simply y.


The following three commands get the DirectAdmin installation file, change the permissions of said file, and install DirectAdmin. The last step should take a while.

  • wget -O setup.sh https://www.directadmin.com/setup.sh 
  • chmod 755 setup.sh 
  • ./setup.sh auto


When the message comes that everything is installed, you can scroll up to find the login password. In our example it looks like this


Admin username: admin Admin password: [******************] Admin email: admin@directadmin.hetvoorbeelddomein.xyz

If you accidentally close the terminal or did not save the information, you can reset the password. Login via SSH and enter the following command: passwd admin.


Safety 

The following steps are advised to harden the security of your DirectAdmin Server.


Protect against DNS Amp Attacks

Bind (nameserver) allows default recursion, which MUST be turned off. Otherwise, you are vulnerable to dns amp attacks. Via SSH, use the following command to edit the configuration file:

  • nano /etc/named.conf
  • then, find the following line.
  • // recursion yes;
  • Change it to the following: recursion no; 


Activate SSL/HTTPS

To ensure that the administration page is secured with an SSL certificate execute the following commands via SSH. Make sure to replace directadmin.hetvoorbeelddomein.xyz with your own subdomain.

  • Create the certificate: cd /usr/local/directadmin/scripts && ./letsencrypt.sh request_single directadmin.hetvoorbeelddomein.xyz 4096
  • You will see the following message in your terminal: Certificate for directadmin.hetvoorbeelddomein.xyz has been created successfully!
  • Ensure that the certificate is actually used: cd /usr/local/directadmin ./directadmin set ssl 1 \ ./directadmin set carootcert /usr/local/directadmin/conf/carootcert.pem \ ./directadmin set ssl_redirect_host directadmin.hetvoorbeelddomein.xyz service directadmin restart


Activate Two-factor-authentication (2FA)

With the user admin you can manage all settings and websites on your DirectAdmin installation. Protect this user with 2FA. 

  1. Login to your DirectAdmin installation;
  2. Click on the Admin User and select Password;
  3. Go to Two-Step Authentication and generate a Secret;
  4. A QR code will appear which you can scan;
  5. You will be automatically logged out to log in again with 2FA.


Add main domain

Finally we are going to add the main domain within DirectAdmin. Site-management is done at user level and for this you have to adjust the access level at the top.

  1. Go to Account Manager and pick Domain Setup at the top menu;
  2. Enter the domain and click Create at the bottom;
  3. Your DirectAdmin is now ready to use.


You can find the FTP data, create a database, and provide SSL certificates through the account manager. 

Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen
CAPTCHA-verificatie is vereist.

Feedback verzonden

We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren