Sumon Selim

Homo sapiens by Born. Coder by Heart. Entrepreneur by Passion.

Launching An Amazon EC2 Instance

I am a great fan of cloud hosting as it gives me ease and control to manage my own production environment as per my need. Luckily, Amazon Web Services (AWS) offers AWS Free Tier”  by using which we can get hands-on experience with AWS Cloud Services at no charge for 12 months. So, I took the chance to test drive their services. Today I am going to write about launching and preparing my first instance on Amazon EC2 service where we will host a web application developed using PHP (Laravel 5.1).

First, we will need to login to our AWS Management Console and select EC2. We will see a dashboard like below:

EC2 Management Console

You can see lots of options there. But to launch our first instance, click on the blue “Launch Instance” button. You will then be prompted to choose an AMI to launch your instance. An AMI is a template that contains the software configuration (operating system, application server, and applications) required to launch your instance.

I am going to select Ubuntu Server 14.04 LTS for on our instance and luckily it’s eligible to use with AWS Free Tier.

Choose an Amazon Machine Image (AMI)
Next, we will need to select our instance type. We will choose t1.micro type instance this time as our AMI is eligible to run on this instance and free tier is only eligible for micro instances.  If you are ready to afford some money to get more powerful instance, you can choose any other instance that fits you the best.

Choose Instance Type

On the next step, you can configure instance details as per your need . But I will keep the default configuration for now and move on to the next step.

Then we will need to add storage to our instance. Free tier eligible customers can get up to 30 GB of EBS General Purpose (SSD) or Magnetic storage. For now, I will add an EBS General Purpose (SSD) and allocate 20 GB of space and uncheck the “Delete on Termination” option so that my data remains available even after the termination of the associated instance.

Add Storage to EC2 Instance
Next, we can add tag to our instance. If you are confused about what this is all about, go through this: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html

Then we will need to configure security group  set firewall rules that control the traffic for our instance. For now, I am going to select the existing security group which will allow all traffic to access my instance. But for better security, you may modify these rules to prevent unauthorized access. Then click on “Review and Launch“. All the details of your instance will be shown. If needed you can make necessary changes, otherwise click on the “Launch” button.

Launch an Amazon EC2 Instance

Next, you will be able to create e new key pair which you will need to login to your instance. Give the key pair a name, download the Key Pair (.pem) file and click “Launch Instances“. Please keep in mind that you have to download the private key file (*.pem file) before you can continue. Store it in a secure and accessible location. You will not be able to download the file again after it’s created.

It will take some time to complete the instance launching process. After that, you will see a page with Launch Status of your instance.  Voila! You are ready with your first Amazon EC2 instance now :)

Launch Status of Amazon EC2 Instance

If you visit the “Instances” section now, you will see that your running instance is listed there.  On our next part, we will connect with our newly created instance via SSH and install the necessary software to run a web server.

Note: If you are looking for a paid cloud hosting provider, I would recommend Digital Ocean (affiliate link, will give you 10$ referral credit) which is being used to host this website. and I am pretty much happy with their service.

Increase Your WordPress Maximum File Upload Size Limit

I’m a part-time WordPress developer and use it mostly to develop sites for my clients.  As most of the clients use shared hosting, sometimes I find it difficult to upload/install plugin and themes for the default maximum file upload size limit of the hosting.

Using .htaccess file

The most common solution to this problem is to use a .htaccess file in the root directory and add the following code to it:

This will override the existing values set by the host and you’ll be able to set the value as much as you want. Here, I am increasing the maximum file upload size limit to 32 MB.

Using php.ini file

You can also fix the problem by creating a php.ini file in your directory and add the following code to it:

But some hosting providers might not allow you to override the php.ini settings and .htaccess method can come handy then.

Hope this small piece of information will help you if you face this problem. Feel free to share your method of solving this problem with us.

Actually there’s no victory in life. Only battles. You have to keep fighting – all alone. Nobody will fight for you – actually nobody can. Some will try and quit. But it’s you – who can never quit!

Installing LAMP (PHP 5.6, Apache 2.4, MySQL 5.6) on Elementary OS

I’m a web and mobile application developer by profession and developing on LAMP (Linux, Apache, MySQL and PHP) stack for last couple of years. Now it’s time to get development environment ready on my newly installed elementary OS “Freya”. I will install everything separately instead of using the tasksel command.

At the time of writing this article, I’m installing the latest stable version of all the things I am going to need.

  • PHP 5.6
  • Apache 2.4
  • MySQL 5.6

Installing Apache 2.4

We will add the repository of the latest Apache version to our system by using the following command:

Then run the following two commands to install Apache 2.4:

Installing PHP 5.6

First, we will add the repository of the latest PHP version to our system by using the following command:

Then run the following two commands to install PHP 5.6:

This will install PHP on our system.

Installing MySQL 5.6

We will add the repository of the latest MySQL version to our system by using the following command:

Then run the following two commands to install MySQL 5.6:

This will install MySQL on our system.

You will be asked to set password for the “root” user for the MySQL server during the process.

Voila! Our development environment is ready now :)

If you visit http://localhost now, you will see the Apache2 Ubuntu Default Page.

Apache2 Ubuntu Default Page

Now let’s write some PHP code to check if everything is working properly. Let’s create a PHP file named info.php on the default document root folder of Apache web server which is /var/www/html and add the following code to the file:

Save the file. Then visit the file on your browser: http://localhost/info.php

You should get an output like this:

LAMP on elementary OS Freya

 

You may need to install some other PHP extensions and libraries according to your need manually. I will cover this in future. Feel free to comment if you have any queries.

Customizing Terminal with Guake, oh-my-zsh and screenFetch on Elementary OS Freya

As I stated previously that I am a great elementary OS fan and installed the latest beta of elementary OS titled “Freya” few days ago. Now, it’s time to customize it and making it ready as my primary development environment. The first thing I am going to customize is my terminal because I am not that much fan of the default bash terminal.

First, I am going to install Guake to change the appearance behavior of my terminal. I really liked the drop-down approach of Guake which helps me to work without any flaw with so many things within the workspace.  I can just press the “F12” key to toggle the visibility of my terminal after installing Guake. There are couple of others handy customization options available too.

So, let’s install Guake. First we may update our system by running the following command on the terminal:

Then run the following command to install Guake:

There may be some others dependencies that need to be installed. If needed, you may install those.

After installing Guake, you may run it from the terminal by just running “guake” on the terminal or from the Applications menu.

You can customize the preferences according to your need by right clicking on the Guake terminal and clicking on the Preferences option.

properties Preferences for Guake Terminal

To use it instead of your default Terminal, you will need to add it on the Startup Applications so that every time you run your system you can use Guake immediately by just pressing “F12″. You may also change it according to your need.

To add Guake on the Startup Applications, go to your “System Settings” and select “Applications“. Then click on the “Startup” tab. Click on the “+” icon placed at the bottom left of the screen and select “Guake Terminal” from there.

Add Guake Terminal on Startup

From now, every time you start your system, Guake will run automatically.

Next, I am going to install oh-my-zsh as I like it very much. But first, I need some other things to install first such as curl, git, vim and zsh.

To install them run the following:

Then we can use the automatic installer to install oh-my-zsh on our system easily.

After installation, we just need to set oh-my-zsh as the default terminal from our Guake terminal. To do that open the Preferences option and just set “/bin/zsh” as the default interpreter.

Re-start the terminal now. And we will be ready to go :)

oh-my-zsh terminal with guake

At last, I will add screenFetch to add some system/theme information in terminal. For elementary OS, run the following commands on terminal:

Thanks to memoryleakx for his screenFetch special version for elementary OS.

At last, we have to add the following line to the end of our .zshrc file:

Here’s the final look of my terminal:

guake, oh-my-zsh and screenfetch on freyaLet me know what you think of it!

Fixing Date and Time Visibility Problem on elementary OS Freya Beta

I am a hardcore elementary OS lover and was using Luna for a long time. But couldn’t wait more for the new version of elementary OS Freya and decided to move onto it. So installed Freya Beta 1 64 bit on my HP ProBook 4420s as my primary OS replacing Luna 32 bit.

The Problem: But I found that time and date is missing on the top bar (wingpanel).

Date and Time problem on Freya Beta 1The solution:

After googling, I found out that the solution is to add a single line of information on the /etc/environment file.

I’m a terminal lover. So, I typed the following command on the terminal to edit the file. Remeber, you will need administration access to edit the file.

And the result was:
Editing the /etc/environment fileAll I need to do was to add the following line on it and save it.

You can set your locale (e.g. bn_BD.UTF-8) too as a value.

After a restart the problem was fixed and date and time was visible on the wingpanel.

Date and time visibility problem fixed on Freya Beta 1Alternatively if you are not comfortable editing on the terminal, run the following command on the terminal.

This command will open the /etc/ folder on the Files browser and then you can edit the environment file using your default text editor.

If gksu is not installed, you can install it by using the following command:

Basically gksu is a graphical front-end for sudo that allows graphical command to be run without the need to run an X terminal emulator and using su directly. It’s effectively just a GTK+ skin for the superuser commands.

In search of happiness…

Hi, I am Muhammad Sumon Molla Selim (mostly known as Sumon Selim) from Dhaka, Bangladesh. I’m a coder by <3.  Love to write codes mostly using PHP and Laravel. I will talk more about this later. But let’s move on to something else – myself, my life.

I was going through much hardship in last few years – mostly mentally. But now I have decided to move on. I’m sacrificing all my dream and hope. Instead I will live from now only to fulfill my responsibilities – responsibility towards my family, responsibility towards humanity!

I’ll write regularly from now to tell stories about my Life, Thoughts, Experience and my Coding journey.

While I start my journey, here are some lines I would love to mention:

In my search for freedom
And peace of mind
I’ve left the memories behind
Want to start a new life
But it seems to be rather absurd
When I know the truth
Is that I always think of you…

© 2015 Sumon Selim

Theme by Anders NorenUp ↑