WHMCS Installation

The below documentation is for a set-up where WHMCS (including MySQL) runs in a single Docker container, hosted on a virtual machine running on a G8 operator node.

Below following steps are discussed:

  • Step 1: Setup a Docker machine
  • Step 2: Get the Docker container with WHMCS up and running
  • Step 3: Configure the MySQL database in the Docker container
  • Step 4: Complete the WHMCS installation wizard
  • Step 5: Post intstallation actions

Step 1: Setup a Docker machine

For setting-up a Docker machine on a G8 node, follow the steps as documented in our Boot Camp Notes.

Step 2: Get the Docker container with WHMCS up and running

For this we use a Dockerfile that is available from following GitHub repository: https://github.com/0-complexity/whmcs-dockerfile

Clone this repository into a directory on your personal computer.

This will basically give following files:

  • Dockerfile

    ```shell FROM bailey86/ubuntu1404-lamp

install ionCube

RUN apt-get update -qq && apt-get install -y wget php5-mysql php5-gd unzip RUN wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O /tmp/ioncube_loaders_lin_x86-64.tar.gz RUN tar -C /tmp -xzf /tmp/ioncube_loaders_lin_x86-64.tar.gz RUN cp /tmp/ioncube/ioncube_loader_lin_5.5.so /usr/lib/php5/20121212/

RUN cp /tmp/ioncube/ioncube_loader_lin_5.6.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226

RUN rm -rf /tmp/ioncube /tmp/ioncube_loaders_lin_x86-64.tar.gz

COPY 00-ioncube.ini /usr/local/etc/php/conf.d/

COPY 00-ioncube.ini /etc/php5/apache2/conf.d/

Get the WHMCS PHP files on the web server

RUN wget -P /tmp/ ftp://pub:[email protected]/whmcs.zip

copy the content of whmcs into /var/www/html/

RUN cd /tmp/ && unzip /tmp/whmcs.zip RUN cp -r /tmp/whmcs/whmcs/* /var/www/html/ RUN chmod a+w /var/www/html/configuration.php

```
  • 00-ioncube.ini

      zend_extension = /usr/lib/php5/20121212/ioncube_loader_lin_5.5.so
    

There is also third file, docker-compose.yml but it is not used for this single-container setup.

To build the docker image that will be used:

```shell
docker build -t whmcs .
```

With the -t option we tag the image with the name 'whmcs'.

Note

 You will get the following error if you try to use the above script with a remote Docker machine:
 ```
 Step 7 : COPY ../whmcs /var/www/html
 INFO[0005] ../whmcs: no such file or directory
 ```

 Solution is to change the Dockerfile so that the WHMCS files are downloaded from a FTP site instead of copied.

Now you can start a container with this image:

```shell
docker run -p 8000:80 -p 8022:22 -p 443:443 --name whmcs whmcs
```

With the two -p options we map the container ports 22 and 443 to ports 8022 and 443 on the Docker machine. See step 4 in order to expose them on a public IP address.

You will see following output:

```shell
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
=> Done!
=> Waiting for confirmation of MySQL service startup
=> Creating MySQL admin user with random password
=> Done!
========================================================================
You can now connect to this MySQL Server using:

    mysql -uadmin -pr2E3BdVX73Cu -h<host> -P<port>

Please remember to change the above password as soon as possible!
MySQL user 'root' has no password but only allows local connections
========================================================================
```

With this we have the password in order to access MySQL. Make sure you taken note of it for use in the next step.

Press CTRL+C to stop the container, start it again using the start command:

```shell
docker start whmcs
```

Start an interactive session with the running container:

```shell
docker exec -it whmcs /bin/bash
```

Optionally, create the following new PHP script with vi:

```shell
cd var/www/html
vi info.php
```

In vi enter following implemenation:

```php
<?php
phpinfo();
?>
```

This scripts can be useful when running into problems during setup.

Step 3: Configure the MySQL database in the Docker container

If not already the case, start an interactive session with the running container:

```shell
docker exec -it whmcs /bin/bash
```

Or alternativelly, connect from you local machine:

```shell
mysql -uadmin -pr2E3BdVX73Cu -h<host> -P8022
```

Use mysql to create the whmcs_db database and user that has all priveliges to this database:

```shell
mysql -uadmin -pr2E3BdVX73Cu
mysql> create database whmcs_db;
mysql> create user 'whmcs_user' identified by 'password';
mysql> grant all privileges on whmcs_db.* to 'whmcs_user';
mysql> flush privileges;
mysql> quit
```

Step 4: Complete the WHMCS installation wizard

For the setup as documented here we use a Docker machine running on be-scale-1: https://be-scale-1.demo.greenitglobe.com/CBGrid/Virtual%20Machine?id=278

Here's the port forwardings we've configured:

  • Now to install WHMCS, go to http://85.255.197.104:80/install/install.php
  • Some files in /var/www/html/ may need specific permissions to satisfy the installation requirements
  • You will be asked to add the license key and the database information as set up in step 2:

  • Then you will be asked to setup the adminstrator account

Step 5: Post installation actions

Once the installation is complete, you will be invited to delete the /var/www/html/install instalation directory:

Remove the installation folder

```shell
rm -r /var/www/html/install
```

Set the default page to index.php

This can be achieved by editing apache2.conf:

```shell
cd /etc/apache2
vi apache2.conf
```

Add following entry:

```xml
<Directory /myapp>
DirectoryIndex index.php
</Directory>
```

Next

Next you will want to install the Fusion template we use in the Moehaha.com WHMCS reference implementation.

results matching ""

    No results matching ""