in Challenge

Running DirectAdmin On Amazon EC2 Linux- Solved!

We were able to install DirectAdmin (a Web hosting control panel) on Amazon’s Elastic Compute Cloud, branded as EC2. We would like to share the steps required to build a working instance of DirectAdmin on an Amazon server. First, I would like to personally thank Mark from DirectAdmin for being so accommodating and granting us a trial license. His help is very much appreciated! Keep in mind that UNIXY‘s truly fully managed server service goes above and beyond. We take business dreams and make them a reality.

Before we list the requirements, it is important to note that EC2 instances are Xen Virtual Machines. We encountered some issues running DA on the “Small” Amazon instances. The issues are related to 64-bit mode library mismatches. The only instances to be able to run DirectAdmin out of the box are of type “Large” and better. They are more expensive but ideal for this configuration.

Here are the requirements:

  • Instance of type Large
  • Linux CentOS 5 image
  • One elastic (which is another word for static) IP address

Go ahead and bring up the node as you would normally do. Be sure to remove all extra software that comes pre-installed with the CentOS 5 image. Otherwise, it will break DirectAdmin. If in doubt, follow the instructions on the DirectAdmin Install page:

http://www.directadmin.com/install.html

Once logged in as root, go ahead and download the DirectAdmin install tarball:

# wget http://www.directadmin.com/setup.sh

By default, the licensing scheme of DirectAdmin makes it that setup.sh binds to the licensed IP address. Here’s how the license verification command looks like:

$BIN_DIR/wget $WGET_OPTION -O $DA_PATH/update.tar.gz –bind-address=$IP https://www.directadmin.com/cgi-bin/daupdate?uid=$CID\&lid=$LID

But as you know, EC2 instances are 1:1 private:public NAT. Which means that the license check step will fail and the DA install won’t start. To avoid this chicken-and-egg problem, we are going to tell setup.sh to not bind to any IP address but to simply connect to the DA licensing server using the elastic external IP address, which it will do by default. Go ahead and run this command against the setup.sh file:

# sed -i 's/--bind-address=\$IP//;' setup.sh

Before we run setup.sh, we need to trick the setup script to think that the external IP address is “attached” to the server. Here’s how:

# ifconfig eth0:0 inet 1.1.1.1 netmask 255.255.255.255 up

Be sure to replace the IP address 1.1.1.1 with your elastic IP. Then simply run setup.sh:

# cd /usr/local/directadmin/scripts; while [ true ]; do sed -i 's/--bind-address=\$IP//; s/--bind-address=\${3}//;' *.sh > /dev/null > 2&>1; sleep 10; done & sh setup.sh 11111 22222 vpslux.com eth0:0 1.1.1.1

Woaah! Wait a minute! What is that!? OK, let’s break it down. The DA scripts directory gets unpacked into the server after you run setup.sh. It dumps a list of scripts that are used by DA to setup accounts, domains, etc. Some scripts use the same –bind-address flag. Having that flag in those scripts breaks DA. the one-line script “while [ true ]; do sed -i ‘s/–bind-address=\$IP//; s/–bind-address=\${3}//;’ *.sh; sleep 10; done” simply goes to that directory and removes the flag.

The trick being DA attempts to run some of those scripts while setup.sh is running. So it’s important to have the sed script run in parallel during the installation. Once the setup.sh is done running, we’ll kill the job (or reboot per the final step). The arguments supplied to setup.sh are in this format

# setup.sh <ClientID> <LicenseID> <Hostname> <Interface> <ExternalIP>

Be sure to replace those values accordingly. Once the install finishes, simply reboot the VM:

# reboot

That’s all folks. Enjoy!

Write a Comment

Comment

Comment moderation is enabled. Your comment may take some time to appear.

  1. Thanks for the great article.

    Quick question about DA-APIs.http://www.directadmin.com/api.html

    Have you confirmed that these GET/POST requests work with Amazon EC2? We are looking at this type of solution and I am curious if you’ve tested these, specifically around user provisioning.

    Thanks!

    Scott

  2. Hi,

    When you state static IP address in your list of requirements are you referring to my statis public IP or the static private internal IP that my public is translated to using NAT?

    I’m trying to get this working but unsure if I’m following it properly or putting the right IP addresses in. Plus I don’t have a host name. This server is for development/testing. Should I enter my public IP as the hostname or make one up?

    Apologies for my ignorance. I’m new enough to web programming, primarily a desktop programmer.

    Thanks,
    JP

  3. The static public IP is the IP facing the Internet and not the private IP. As for the host name, you can just make one up but be sure to save it (hostname server.hostname.com).

    Cheers

  4. Anybody face this issue after reboot the DA doesn’t work?

  5. What do you do if you get this after running the whole command?

    sed -i ‘s/–bind-address=\$IP//; s/–bind-address=\${3}//;’ *.sh > /dev/null > 2&>1; sleep 10;done & sh setup.sh 11111 22222 host.domain.com eth0:1 0.0.0.0
    -bash: syntax error near unexpected token `done’

  6. First of all thanks for the detailed guide!
    I’ve started trying the same thing on ubuntu

    Fixed the setup.sh file with the first sed you gave
    Then fixed the eth0:0 interface with my ip address

    ifconfig output:

    eth0:0 Link encap:Ethernet HWaddr 12:31:3e:00:ec:e6
    inet addr:**.**.46.55 Bcast:50.255.255.255 Mask:255.255.255.255
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    And than executed this:

    cd /usr/local/directadmin/scripts; while [ true ]; do sed -i ‘s/–bind-address=\$IP//; s/–bind-address=\${3}//;’ *.sh > /dev/null > 2&>1; sleep 10; done & sh /home/ubuntu/setup.sh user license host.com eth0:0 *.*.46.55

    But unfortunately it outputs “You are not authorized to download the update package with that client id and license id for this IP address. Please email sales@directadmin.com

    Am i doing something wrong?

    Thank you!
    Shai

Webmentions

  • directadmin behind nat | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin trial | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin license | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin trial license | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin node js | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin vps license | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin nat | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin update license | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • directadmin requirements | ???? ????? March 16, 2011

    […] Running DirectAdmin On Amazon EC2 Linux- Solved – UNIXy […]

  • meizitang soft gel March 16, 2011

    meizitang soft gel…

    On each weekend, we all friends jointly used to watch film, because enjoyment is also essential in life….

  • payday loans uk March 16, 2011

    payday loans uk…

    My partner and I stumbled more than here various site and believed I really should check issues out….

  • Homepage March 16, 2011

    … [Trackback]…

    […] Find More Informations here: blog.unixy.net/2009/06/running-directadmin-on-amazon-ec2-linux-solved/ […]…

  • 48.228 Elite Proxies Pack March 16, 2011

    Google change in algorith killed proxies providers business…

    Days ago a change in Google search engine platform make anonymous public proxies, almost useless. Most blog posting tools depend on proxies to do their job. We build and provide the best raw anonymous public proxies you can find. Follow the link and gr…

  • TwitterSmash Beta Released March 16, 2011

    TwitterSmash Beta Released…

    Twitter is becoming an important marketing tool for online publishers and marketers. But it can be time consuming to keep your profile up to date and it often gets forgotten. But not any more!!! I got News for you. TwitterSmash is here to automate all …

  • control de flota de vehiculos March 16, 2011

    Most automobile rental corporations won’t accept a money deposit…

    Typically, discounted admission charges on area attractions are the most typical and easiest to search out, since many theme parks, museums and other points of interest run specials to draw tourists….

  • DirectAdmin in the Amazon EC2 « JOMYUT.NET March 16, 2011

    […] the reference topic, they use CentOS x64. I have use Ubuntu 10.04 LTS x86 and it work […]

  • escort owen sound March 16, 2011

    This is my problem…

    Amazingly webpage, I like how your website looks! The layout is great!…

  • Running DirectAdmin On Amazon EC2 Linux- Solved! | Web 2.0 Designer March 16, 2011

    […] Read this article: Running DirectAdmin On Amazon EC2 Linux- Solved! […]