Directadmin is a pretty nice control panel, cheap and does its job well. Its not as fully featured as cPanel in terms of simply clicking on something to get things done, but its also less cluttered on the administration end. I also find that the integration of the admin, reseller and user accounts is light years ahead of any other panel I’ve used so far. It becomes REALLY easy to fix things once familiarize with the well thought out structure of Directadmin.
One thing that DA could improve on however, is their documentation on the install process. It took me 2 tries to get things done the way I like it, but my first try would have been okay if I knew DA wasn’t as “destructive” as cPanel. What I’m trying to say is that it doesn’t take control of the entire server like cPanel does, forcing you to do things the cPanel way. Your CentOS will still behave like one, and any errors will likely be fixable if you know your way around the command line.
Lets proceed on to the setting up part, this guide will setup the server with suPHP and everything else needed to run a shared hosting server. This guide assumes you have a fresh CentOS or DA supported distro installed and ready to go. Do have DNS pointed appropriately to your FQDN as well.
Blue lines are commands to execute, purple ones are the terminal output /config lines you’ll come across during the install.
1. Update System
2. Install from setup.sh Script
3. Post Installation – Add XSL to PHP, Secure PHP, Add Awstats
4. Install Ioncube
5. Install ImageMagick
6. Optimize PHP
7. Optimize MySQL
8. Install Suhosin
9. Forward root email
10. Enable Spamhaus mail filtering
11. Server Migration tips
chmod 755 setup.sh
You will then be prompted to enter some details, at this point, be sure to have your license information ready. Also select to use custombuild to prepare the list of software you want to have installed on the server. Make sure to select “n” to the default install so you can configure the installed software.
Enter your hostname (FQDN) : <enter the name for your server, e.g. da.mydomain.com>
Client ID: <enter license info e.g. 12345>
License ID: <enter license info e.g. 12345>
Is this correct? (y,n) : y
Is eth0 your network adaptor with the license IP? (y,n) : y
Is 123.456.78.9 the IP in your license? (y,n) : y
DirectAdmin will now be installed on: Enterprise 5.5
Is this correct? (must match license) (y,n) : y
You now have 2 options for your apache/php setup.
1: customapache: end-of-life software. Includes Apache 1.3, php 4 and frontpage. **Not recommended**. Will not work with newer OSs. Limited tech support.
2: custombuild 1.1: newer software (recommended). Includes any Apache version, php 4, 5, or both in cli and/or suphp. Frontpage not available.
Post any issues with custombuild to the forum: http://www.directadmin.com/forum/forumdisplay.php?f=61
Enter your choice (1 or 2): 2
You have chosen custombuild 1.1.
Would you like the default settings of apache 2.2 and php 5 cli? (y/n): n
You have chosen to customize the custombuild options. Please wait while options configurator is downloaded…
You will then be presented with the software options, these are the settings I use.
Do you want to have PHP4 or PHP5 as default? (4/5): 5
Do you want to have PHP5? (yes/no): yes
Do you want to have PHP5 as CLI or CGI? (cli/cgi): cgi
Do you want to have PHP4? (yes/no): no
Do you want to have the php.ini (PHP configuration file) rewritten? (yes/no): yes
For the next question, the usual file is the dist (distribution) version.What type of php.ini (PHP configuration file) do you want to have? (dist/recommended): recommended
Do you want to have Zend Optimizer? (yes/no): yes
Do you want to be able to update/instal MySQL using CustomBuild? (yes/no): yes
Which version of MySQL do you want to have? (4.1/5.0/5.1): 5.1
Do you want CustomBuild to backup MySQL databases before the update? (yes/no): yes
Which version of Apache do you want to have? (1.3/2.0/2.2): 2.2
Do you want to be able to install/update phpMyAdmin using CustomBuild? (yes/no): yes
Do you want to be able to install/update Atmail webmail using CustomBuild? (yes/no): no
Do you want to be able to install/update SquirrelMail webmail using CustomBuild? (yes/no): yes
Do you want to be able to install/update RoundCube webmail using CustomBuild? (yes/no): yes
Do you want to be able to install/update UebiMiau webmail using CustomBuild? (yes/no): no
Do you want to install PHP mail() header patch together with PHP? (yes/no): yes
Do you want to install Dovecot? (yes/no): yes
Do you want to be able to update Exim configuration file (exim.conf) using CustomBuild? (yes/no): yes
Do you want to be able to install/update ProFTPD using CustomBuild? (yes/no): yes
Do you want CustomBuild to install Jailed shell (beta)? (yes/no): yes
Do you want CustomBuild to download versions.txt every time? (yes/no): yes
Do you want to enable bolded text? (yes/no): yes
Do you want to clean everything (run ‘./build clean’ every time) running CustomBuild? (yes/no): yes
Which fileserver do you want to use (1 is located in USA, 2 – Europe)? (1/2): 2
Once the options are selected, the install will then proceed for another 10-15 minutes, depending on your network speed and server specs. The install should finish and you’ll be presented with the admin password, but if you’re using CentOS 64 bit like me, the install will fail halfway through and you’ll need to run additional commands. Not the best installer I know, but hey at least they tell you how to fix their issues.
This appears to be a 64-bit system.
a common cause of http/php compile failures is mentioned here:
If you’re running CentOS (not freebsd or debian) and applies to you, then type:
ln -sf /usr/lib64/libexpat.so /usr/lib/libexpat.so
ln -sf /usr/lib64/libm.so /usr/lib/libm.so
ln -sf /usr/lib64/libssl.so /usr/lib/libssl.so
./build all d
The installer will begin again compiling everything, but at the end of it, Apache won’t start stating a missing IP file error. You can then refer to the DA knowledgebase here or simply just run the following commands.
Admin username: admin
Admin password: abcd1234
Admin email: email@example.com
Server IP: 18.104.22.168
Server Hostname: da.mydomain.com
To login now, follow this link:
That should complete the install and you can now login to the web interface with the given login credentials.
Now for some reason the custombuild installer doesn’t present you with all the options during the initial setup phase, we will then need to add Awstats and a few other modifications to the options file. At the same time, we will add xsl support to PHP, since the default install doesn’t include it.
mkdir -p custom/suphp
cp -Rp configure/suphp/configure.php5 custom/suphp/configure.php5
Add –with-xsl to the end of the file then quit nano (ctrl + o, then ctrl + x). Next, lets add Awstats and autoupdate to DA.
Edit the following lines
awstats to yes
directadmin autoupdate to yes
Finally, we build everything again and secure PHP at the end of it.
./build all d
You will need ioncube if you want to have the encrypted PHP scripts running on your server. A lot of forum scripts, installer scripts etc will require Ioncube so it will be good to have Ioncube on. Do note that Ioncube may be updated with a new version number, so go directly to their website for install instructions if the below doesn’t work.
tar -xzvf ioncube_loaders_lin_x86-64.tar.gz
mv ioncube /usr/local/
chown -R webapps:webapps ./ioncube
Add this line at the end.
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so
What the commands did was to get Ioncube installed and loaded into PHP, and downloaded a verification check file. You can then use your browser to navigate to da.mydomain.com/ioncube/loader-wizard.zip to verify that Ioncube is working on your system. If it is working, we can remove the verification file.
rm -rf ioncube/
yum install ImageMagick
max_execution_time = 150 ; Maximum execution time of each script, in seconds
max_input_time = 300 ; Maximum amount of time each script may spend parsing request data
memory_limit = 96M ; Maximum amount of memory a script may consume (128MB)
post_max_size = 55M
upload_max_filesize = 50M
Not really an optimization, but you’ll want to copy over a suitable my.cnf from the preset directory depending on how much RAM your server has.
mv /etc/my.cnf /etc/my.cnf.bak
cp -f /usr/share/mysql/my-large.cnf /etc/my.cnf
/sbin/service mysqld restart
Install Suhosin if you want better security for PHP. Probably a good idea if you are running a shared hosting server. Once again, Suhosin does get updated so do input updated version numbers from their website.
mkdir -p /usr/src/suhosin
tar -xzvf suhosin-0.9.32.1.tar.gz
Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
Change extension_dir to…
extension_dir = “/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613?
Add line below to “Dynamic Extensions” section, then exit nano and restart Apache.
service httpd restart
echo “admin” > /root/.forward
rm -f /etc/virtual/use_rbl_domains
ln -s /etc/virtual/domains /etc/virtual/use_rbl_domains
If you’ve gotten here without any issues, congrats!! You now have a Directadmin server ready to be used. Feel free to login to the admin panel now, and add domains you wish to host. There are additional setup involved such as securing the server, sysctl, adding spamassassin, installing CSF, forcing SSL login to the panel and adding mod_security to Apache but those are optional steps and can be found (mostly) on the Directadmin knowledgebase. I’ll add the steps for all of the above when I’m not too lazy…
1. [New Server] Install DA on the new server as per previous steps =) Also remind your clients to stop updating their sites for the next couple hours.
2. [Old Server] Now start generating backup files using the Admin Backup/Transfer tool. I normally generate backup files to a local folder and rsync them over to the new server later on. Backups can be sped up by changing the backup_nice directive to a higher priority value, in /usr/local/directadmin/conf/directadmin.conf
3. [Old Server] Wait for the backup to complete, and start the rsync
rsync -avz –progress /home/admin/admin_backups/ -e ssh firstname.lastname@example.org_server.com:/home/admin/admin_backups/
or if you are using alternate SSH ports…
rsync -avz –progress /home/admin/admin_backups/ -e “ssh -p 1234? email@example.com_server.com:/home/admin/admin_backups/
4. [New Server] When rsync finishes, use the Admin Backup/Transfer tool to restore all accounts to the new shared server IP.
5. [New Server] If you have resellers with their own dedicated IP, restore the main account of the reseller first and then assign new IPs to the reseller from the IP Management tool. Then login to the reseller account and change an IP to shared. You can then restore the reseller client accounts, to his/her own shared IP from the Admin Backup/Transfer tool.
6.Once restore is completed, email your clients to switch DNS records to the new server if they are managing their own DNS. Those using your hosting company’s nameservers shouldn’t need to do anything. You must then update your nameservers or DNS to the new server.
7. [Old Server] OPTIONAL… You can then forward requests from the old server to the new server, to make sure data is really in sync.
cp /var/named /var/namedbackup
perl -pi -e ‘s/22.214.171.124/126.96.36.199/’ *.db
service named restart
where 188.8.131.52 is your old IP and 184.108.40.206 is the new one.
8. Done !!! But you may need to copy over or recreate the plan packages for the admin account, as they don’t get moved over.
For large servers, I find it more manageable to separate migrations into batches because backups can take a VERY long time to complete. First transfer and restore the admin account, and then do the rest of the reseller accounts.
To restore a user created backup from a client migrating hosts, first rename the backup file to “account_name.tar.gz”. Then place the backup file in the user_backup folder and do the restore from the Admin Backup/Transfer tool.
Incoming search terms:
- directadmin spamhaus
- apache webapps directive directadmin
- Server to server transfer of all accounts ssh directadmin
- server migratedirectadmin
- directadmin suhosin custombuild
- directadmin server setup
- directadmin initial setup