A crash report analysis tool

Installing CrashFix in Amazon AWS Cloud for Free - a Tutorial

If you want to use CrashFix, but do not have a web server yet, this tutorial is for you. In this tutorial, I will show how to install CrashFix in the Amazon Web Services Cloud for free.

Amazon Web Services (AWS) is a cloud platform providing scalable and reliable web hosting services. Cloud computing is the delivery of computing and storage capacity as a service to a community of end-recipients. With AWS, you can easily set up a web server and access it in a few minutes. For new users, Amazon provides a free usage tier: you are able to run a web server for one year absolutely for free.

So, with AWS free usage tier you have:

  • virtual Linux server (613 MB of memory and 32-bit and 64-bit platform support);
  • 30 GB of storage;
  • 15 GB of traffic per month;
  • a dedicated external IP address.

And all this you can register and prepare for work in half an hour, if you have a credit card that Amazon accepts (Amazon will charge $2 during registration) and a phone (Amazon may request your identity verification).

Creating Amazon Web Services Account

To create new AWS account, you need to open Amazon Web Services page in your browser and click the Sign Up button. The Sign In or Create an AWS Account page appears (shown in the figure below):

AWS Create Account

You need to enter your E-mail address, select I am a new user option and click the Sign in using our secure server button. Then you have to pass through several registration steps: account creation, payment method choice, identity verification and confirmation.

When you are ready with registration, sign into your AWS account, click the My Account/Console button and select AWS Management Console from drop-down menu. AWS Management Console page appears (shown in the figure below):

AWS Management Console

The AWS Management Console displays the products currently accessible by you. You are interested in EC2 product (Elastic Compute Cloud, shortly EC2), because EC2 allows to run a virtual Linux server. In terms of AWS, such a virtual server is also called an EC2 Instance.

Launching EC2 Linux Instance

Click EC2 icon in your AWS Management Console window. EC2 Console page appear. The page has a side bar menu where you can find several sections like INSTANCES, IMAGES, ELASTIC BLOCK STORE, NETWORK & SECURITY.

In order to securely connect to you virtual server through SSH protocol, you need to create a key pair. To do this, in the EC2 Console side bar menu, under NETWORK & SECURITY section, click the Key Pairs link.

AWS Key Pairs

On the appeared page, click the Create Key Pair button and enter the name for your new key pair (for example, enter 'crashfix') and press the Create button. When your key pair has been generated, you are offered to download the key as a PEM file. Save the file to some folder - you will need it later.

On the EC2 Console side bar menu, under INSTANCES section, click the Instances link, and on page appeared, click Launch Instance. The Create New Instance page appears (shown in the figure below).

AWS Create New Instance

On the appeared page, click Quick Launch Wizard option. Then enter a name for the instance, for example, enter 'CrashFix'.

Under the Choose a Key Pair section, select Select Existing option and choose the key pair name you have just created.

Under the Choose a Launch Configuration section, you can choose a Linux distribution to run. In this tutorial, I choose Amazon Linux AMI, 64-bit.

Click the Continue button. On the next page, you need to edit instance details. To do this, click the Edit details button. On the page appeared, select the Instance Details section and set check to Termination protection check box.

Click the Save Details button and then click the Launch button to launch the instance. Now you should be able to see your instance on the Instances page (see the figure below).

AWS Instances List

Next, you need to assign an IP address to the EC2 instance. To do this, click the Elastic IPs link in the side bar menu (under NETWORK & SECURITY section). On the appeared page, click Allocate New Address button. In the appeared window, click the Allocate button. The new IP address is now displayed in the list of Elastic IPs.

AWS Elastic IPs

You must immediately assign the created IP address to your instance. To do this, click the check box to the left of your IP address and click the Associate Address button above the IP address list. In the appeared window, select the instance name and click the Yes, Associate button.

Finally, you need to configure the security group rules (firewall) for the EC2 instance. The rules define what ports will be open for inbound access. On the EC2 Console page, click the Security Groups link (under the NETWORK & SECURITY section). By default, your EC2 instance is assigned quicklaunch-1 security group, which allows access through SSH (port 22). You also need to add a rule allowing to access port 80 (HTTP). To do this, enter 80 into Port range field and click the Add Rule button. Then click the Apply Rule Changes button below.

AWS Security Rules

Connecting to EC2 Instance through SSH

Next we want to connect to the virtual server we've just created. In this tutorial, I will use PuTTY - a free implementation of Telnet and SSH for Windows and Unix platforms.

Download PuTTY archive from this link: http://the.earth.li/~sgtatham/putty/latest/x86/putty.zip. Then unzip it to some folder.

You need to import the key pair you have downloaded earlier as a PEM file. To do this, run PUTTYGEN.EXE from PuTTY distribution. PuTTY Key Generator window appears. In this window, click the Load button and choose your PEM file to load your existing key pair. Next enter some password to protect your key (see the image below). Remember the password, because it will be needed later.

Finally, click the Save private key button to save your password-protected key as a PPK file.

Now you are ready to connect to your EC2 instance. Run PUTTY.EXE from PuTTY distribution. The PuTTY Configuration window appears. In that window, select the SSH->Auth category from the side bar menu and enter the path to your PPK file into the Private key for connection field (see the figure below).

Select Window->Translation category from side bar menu and select UTF-8 encoding from drop-down list (see the figure below for example):

Select Session category from side bar menu. Into the Host name (or IP address) field, enter the IP address you assigned to your EC2 instance. In the Saved sessions field, enter 'crashfix' and press Save button. Now the information you entered is saved, so you don't have to enter it each time you connect.

Now double-click the crashfix item in the list of saved session. Terminal window appears. You need to enter 'ec2-user' as your login and press Enter. Then enter the password that you used when creating the PPK file and press Enter again. If everything is OK, you should be able to see the prompt like in the figure below:

Installing CrashFix

Next we want to install CrashFix. In this tutorial, I will follow the instructions listed in the Installation page of CrashFix documentation.

Installing Apache HTTP Server, PHP and MySQL

First, update the system:

sudo yum update

Hint: You do not have to type all commands manually, instead you can copy and paste them. Select the command and copy it into the clipboard (CTRL+C), then click your mouse's right button over the PuTTY terminal window to insert the text.

Install Apache HTTP Server and PHP:

sudo yum install httpd

sudo yum install php php-gd php-dom

Add Apache HTTP Server to autorun and start it:

sudo chkconfig --level 235 httpd on

sudo service httpd start

Install MySQL database:

sudo yum install mysql-server 

sudo yum install mysql

sudo yum install php-mysql

Add MySQL server to autostart and start the server:

sudo chkconfig --level 235 mysqld on

sudo service mysqld start

Connect to the MySQL server as root user:

mysql -u root -p

When prompted for password, just press Enter.

Change password for root user:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<your_password>');

Create a new database schema that will store CrashFix tables:

CREATE SCHEMA crashfix;

Create another database user named crashfix that will be used by CrashFix web application for connecting to database:

GRANT ALL PRIVILEGES ON crashfix.* TO 'crashfix'@'localhost' IDENTIFIED BY '<your_password>';

Remember the password, you will need it later.

Exit the MySQL prompt:

quit

Installing CrashFix Web Application

Create directory for downloads:

mkdir ~/downloads

cd ~/downloads

Download CrashFix web application archive:

wget http://crashfixsoftware.com/index.php/download/file/crashfix-webapp-1.0.3.tar.gz

Note: Please also check our Download page to ensure you are installing the latest version of CrashFix. If the Download page contains a newer version, than please modify the version number in the download link above.

Unpack the archive and move the files to web server's document root directory:

tar xzvf crashfix-webapp-1.0.3.tar.gz

sudo mv crashfix /var/www/html

Edit the CrashFix config file (in this tutorial, I will use my favorite Midnight Commander editor):

sudo yum install mc

sudo mcedit /var/www/html/crashfix/protected/config/user_params.ini

In the config file, we have to edit db_password parameter (specify the password that you entered for crashfix user of MySQL database). When ready, press ESC twice to save changes and exit from Midnight Commander.

Set file and directory permissions:

sudo chmod -R 755 /var/www/html/crashfix

sudo chown -R apache:apache /var/www/html/crashfix

Download, unpack and install ionCube PHP Loader files:

cd ~/downloads

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

tar xzvf ioncube_loaders_lin_x86-64.tar.gz

sudo mv ioncube/* /usr/lib64/php/modules

Edit PHP config file:

sudo mcedit /etc/php.ini

Modify the following parameters:

date.timezone = UTC

upload_max_filesize=1024MB

post_max_size=1024MB

Add the following line to the end of the config file:

zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.3.so

Save changes to the php.ini file and exit the editor.

Restart Apache:

sudo service httpd restart

Initialize CrashFix database

sudo php /var/www/html/crashfix/protected/yiic.php migrate

Now check your installation by entering the CrashFix web application's entry script address in your web browser's navigation bar: http://<your_ip_address>/crashfix/index.php. If everything is OK, you should be able to see a page like in figure below:

CrashFix Login Page

Installing CrashFix Service

Download CrashFix service RPM package:

cd ~/downloads

wget http://crashfixsoftware.com/index.php/download/file/crashfix-service-1.0.3-Linux-amd64.rpm

Note: Please also check our Download page to ensure you are installing the latest version of CrashFix. If the Download page contains a newer version, than please modify the version number in the download link above.

Install it resolving dependencies:

sudo yum install crashfix-service-1.0.3-Linux-amd64.rpm

Edit the config file /etc/crashfix/crashfixd.conf:

sudo mcedit /etc/crashfix/crashfixd.conf

Prepare hardware info file (this may take a few minutes):

/usr/bin/crashfix_hwinfo ~

Next, you need to transfer the hardware info file to your local machine (to request a CrashFix evaluation license). In this tutorial, I will do this using WinSCP program (download link).

Download and install WinSCP. In WinSCP Login window, enter the IP address of your EC2 instance, your user name ('ec2-user'), your password and path to PPK file (see the figure below for example).

WinSCP Login Window

Then press Login button. A two-pane Midnight Commander-like window appears that allows you to copy the hardware.info file from the EC2 instance's file system to your local file system. To do that, in your WinSCP window, choose /home/ec2-user directory in the right pane, inside of that directory select hardware.info file, then press F5 to copy the file to your local machine (displayed in the left pane).

Now you are ready to request an evaluation license from CrashFix website. Open the https://crashfixsoftware.com/index.php/download/evaluation page in your browser. The Get Evaluation License page appears. Here you need to enter your name, E-mail address and pick the hardware.info file you've just downloaded. Then click the Request License button.

An E-mail message will be sent to your E-mail address in a few minutes providing the link for downloading the evaluation license. Download the license to your local machine and then transfer the license file to the EC2 instance with WinSCP. To do that, in your WinSCP window, select crashfix.lic file in the left pane, select /home/ec2-user directory in the right pane, then switch back to the left pane and press F5 to copy the file to your EC2 instance.

In your PuTTY terminal window, move the license file to its correct location:

sudo mv ~/crashfix.lic /usr/share/crashfix/licenses

Edit CrashFix service's config file:

sudo mcedit /etc/crashfix/crashfixd.conf

Change the WEB_ROOT_DIR parameter to point to your CrashFix web application directory:

WEB_ROOT_DIR = /var/www/html/crashfix

Change the WEBMASTER_EMAIL parameter (this will be the E-mail address that will receive notifications from CrashFix service):

WEBMASTER_EMAIL = ec2-user@localhost

Note: You may want to set the E-mail address above to your own E-mail address.

Add CrashFix service to autostart:

sudo chkconfig --level 235 crashfixd on

Start the CrashFix service:

sudo service crashfixd start

Congratulations! You are ready with installation. And now you can log into your CrashFix server as user root (password 'rootpwd'). For additional information, please refer to the First Login page.