วันพฤหัสบดีที่ 27 มีนาคม พ.ศ. 2557

Setting up LAMP on Amazon EC2, Free Ubuntu Linux instance.

    Amazon Web Service provide cloud IaaS as EC2 (Amazon Elastic Compute Cloud) and more services for free 1 year (with limited computing power) and affordable price after that. It good enough to create a website for content management system (CMS) like WordPress, Drupal for the small and critical budget company. This article will show you how to create environment for hosting WordPress website with Amazon EC2 on top of Ubuntu Linux and LAMP stack, step by step. This may requires a bit of Linux skill but it great time learn.

Creating an Amazon AWS account.

  • Sign up for an Amazon AWS account here: http://aws.amazon.com/
    Looking for signup button on top of the page and click to sign up.
  • Provide the usable email address and select "I am a new user." the click the "Sign in using our secure server" button then type you name email address again and password and click "Continue".
  • Fill more information and click "create account and continue" button.
  • Enter you payment Information (A Credit Card is required).
  • Waiting the phone call (automatic system) and press the code as shown on screen for verification.
  • Now you get the Amazon AWS account.
  • Amazon provide a lot of service but we will use EC2. Goto http://aws.amazon.com/ec2/ to subscribe EC2 by click "create Free account" button on the right panel and follow the process.
  • Go to https://portal.aws.amazon.com/gp/aws/manageYourAccount you will see the signed-up services as below:
      

Creating cloud a Linux instance.

  • Now you can go to cloud console to manage your cloud instance at https://console.aws.amazon.com/console/home you will see a lot of service as below but just click EC2.
  • Select your closest region from the top right menu as below. This will be effect your user experience directly, so choose carefully (in my case form Thailand, Singapore is an excellent option).
  • Click "Launch instance" button from the center of the page.
  • Choose machine image, select free tier only to prevent to the costly mistake and select Ubuntu Server 12.04 LTS for the image. free, easy and more community support.
  • Choose an Instance Type, choose default.
  • Go to Step 6 to Configure Security Group. add new rule as below to allow web access (Port 80, 443).
  • Now you can review and launch your instance but you must create key to remote access as below. Select create new key, name and download it (keep it carefully) the click "Launch Instances" button.
  • Wait for it ready a minute and go to EC2 management console. click the running instances.
  • You will see the instance, find the Public IP column, will use it to connect and install software.

Connecting  to an cloud instance.

     Now you will need to connect to the new cloud instance in order to manage, you need to know how to connect via tool with the key, show as below.
  • Download the ssh client software, I basically use Putty, fast, lightweight and free to control cloud instance.
  • Generate private key by using PUTTYGEN.EXE in Putty directory. Click load button, select All Files to show your download key pair. open it then it will show like below.
  • Save private key to a file by click "Save private key" button, Reply "Yes" when it ask save without password, Name the file.
  • Create Putty connection session, open PUTTY.EXE, type the Pubic IP from EC2 console in the Hostname field like ubuntu@54.254.198.XXX
  • Configure private key authentication by go to Auth section like below and choose the saved private key from PUTTYGEN.EXE previous step by click browse button.

  • Save the session and click Open to start secure shell remote console.
  • Now you can use command line to install software and administrate you cloud instance like a Linux rig.

Install LAMP software

    Now we got the blank Linux instance but you need to install a LAMP bundle to get WordPress run such as Apache2 webserver, Mysql, PHP5 and also PHPMyAdmin tool to manage Mysql database.


  • Update software list by command: sudo apt-get update
  • Update the exist software by: sudo apt-get update
  • Install LAMP by : sudo apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 php5-common php5-mysql phpmyadmin
  • Now you can check your installation by go to your web-browser and type http:/// you will see "It works".

Conclusion

     Free Ubuntu cloud instance from Amazon is totally good for free. But tiny computation power will make you get a bad time when try to do more job. But for education propose it will be an excellent choice. More platform is available to extend your skills. Have some fun.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น