All posts by Hrach

Creating an SSL Certificate – Apache & CentOS 6

By | Tutorials | No Comments

About SSL Certificates

SSL certificates are used to encrypt data between a computer and the specified server – in turn creating a secure connection.  SSL certificates can either be self-signed or issued by a trusted CA.  The reason why all major sites do not use self-signed certificates is because all browsers will recognise the site to be using a self-signed (and untrusted) certificate and display a warning page whereas when using a certificate signed by a trusted CA, the browser will, in most cases, recognise it and allow you to proceed to the site.  In this tutorial, we will be using self-signed certificates as they are free to make/issue.


Before starting to follow this guide, there are a few requirements creating and installing an SSL certificate.

  • A Dedicated Server or VPS running CentOS 6 or later with Apache installed
  • At least 512MB RAM
  • Root Privileges

Once you acquire everything that is required, you may start following this guide. (This guide has only been tested on CentOS 6)

Step One – Installing Mod SSL

To install Mod SSL, please use the command:

yum install mod_ssl

Step Two – Creating a Storage Area

We now need to create a directory to store our server key and certificate:

mkdir /etc/httpd/ssl

Step Three – Creating our Self Signed Certificate

Using the command below, we can generate our own self-signed certificate.  A you can see below, you are able to change the value “365” to something longer if you would like your certificate to remain valid for much longer (in days).

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt

The command will ask for user input, such as your organizations country.  The most important line is the Common Name – this is essentially the domain name that you would like to secure or the site’s IP.

Step Four – Set up the SSL Certificate

Now we have all of the required components of the finished certificate. The next thing to do is to set up the virtual hosts file to display our newly made certificate.

Open up the SSL Config file:

nano /etc/httpd/conf.d/ssl.conf

Find the section that begins with <VirtualHost _default_:443>.  Uncomment the DocumentRoot and ServerName line and replace with your domain name or server IP address (it should be the same as the common name on the certificate if you do not want to get any errors):


You should also find the following three lines, and make sure that they match the extensions below:

SSLEngine on
SSLCertificateFile /etc/httpd/ssl/apache.crt
SSLCertificateKeyFile /etc/httpd/ssl/apache.key

Your Virtual Hosts file has now been correctly configured and set up – time for the last step!

Step Five – Restarting Apache

Time to restart Apache:

/etc/init.d/httpd restart

That’s all that there was to it – your SSL has been installed and there’s nothing else left for you to do other than to check your site out at https://yourdomain.tld/

How To Install LAMP On CentOS 6

By | Tutorials | No Comments

What is LAMP?

LAMP is a combination of multiple open source software used to run a web server.  If you already do not know, LAMP is an acronym that stands for Linux, Apache, MySQL and PHP.  In this guide, we will be guiding you through the steps required to install Apache, MySQL and PHP since the linux part is taken care of by running CentOS as the Virtual Private Server’s OS.


Before starting to follow this guide, there are a few requirements to install the LAMP stack.

  • A Dedicated Server or VPS
  • At least 512MB RAM
  • Root Privileges

Once you acquire everything that is required, you may start following this guide.

Step One – Installing Apache (LAMP)

Apache is free and open source software which is currently used on many servers around the world.

To install Apache, open up your favourite SSH Client (PuTTY) and type in the following:

sudo yum install httpd

After it installs, start Apache to run on your server:

sudo service httpd start

That’s all there is to installing Apache.  If you want to make sure that it is up and running, using your browser, navigate to your site by using your server’s IP address (  You should be greeted with an Apache web page.

I forgot my IP address, what can I do?

If you’ve forgotten your server’s IP address or would like to find out what it is, there is a very easy solution.  In your SSH client, just enter the command:

ifconfig eth0 | grep inet | awk '{ print $2 }'

Step 2 – Installing MySQL (LAMP)

MySQL is an industry standard database management system used mainly for hosting.  To install MySQL, enter the commands:

sudo yum install mysql-server
sudo service mysqld start

During the installation process, you  must answer yes to the permission requests that MySQL asks, allowing MySQL to install.  After the installation of MySQL, you can set a root MySQL password with the command:

sudo /usr/bin/mysql_secure_installation

The prompt after entering the command will ask you for your current MySQL root password which by default should be nothing, so press enter.  The prompt will ask you whether or not you want to set a password.  To set a password, enter Y and input your new password as instructed.

Step 3 – Installing PHP (LAMP)

PHP is an open source web scripting language that is widely used to build dynamic webpages.  To install PHP, type in this command:

sudo yum install php php-mysql

Answer yes to the PHP prompt to allow it to be installed.

Step 4 – PHP Modules (LAMP)

PHP has a variety of modules and libraries that can be added to your server very easily.  Modules in PHP allow you to extend the usability of PHP.  You can check to see all the libraries available to install by running the command:

yum search php-

This will display a list of modules that are available to install.  If you decide to install a module, you can type in:

sudo yum install name of the module

Before finishing, we should make sure that the processes are all run at start-up, therefore enter the command:

sudo chkconfig httpd on
sudo chkconfig mysqld on

Congratulations!  You now have a LAMP stack, installed on your server!