Sunday, 16 April 2017

Step by Step Guide to install WordPress on AWS

AWS and WordPress

Over the last few days, I have shared information on Amazon Web Services (AWS) which is giving 1-year free cloud hosting, for a trial. In today's post, I'm linking all the resources in one place and providing you with the step-by-step guide for installing WordPress on AWS.

Step 1: Getting started with Amazon Web Services (AWS)–Create an EC2 Instance
Step 2: Connect to EC2 Instance
Step 3: Install WordPress on AWS

Just follow these above steps and in little, to no time you will be running your own WordPress blog that too for free.

Have you tried installing WordPress on AWS? What new things you discover, do share your experience with us in the comment section below.

Get JPG to PDF Converter License key for Free

JPG to PDF Convertor-1
JPG To PDF Converter that quickly converts multiple images into a single PDF document and supports more than 20 image format.

Looking for a license key to register JPG To PDF Converter for free which cost $29.95 then you are at right place. Long way back they organised 30 days Giveaway Promotion, which no longer active but the registration key is still working. All you need to do is:
1. Download JPG to PDF Converter
JPG to PDF free giveaway2. Install it and go to About-> click on register and enter the registration code given below
       License Key/Registration code:- 4867JWVI3C3F5D9
JPG to PDF Convetor license register
JPG to PDF Convertor

Giveaway Page

This post on JPG to PDF Converter giveaway originally published on 22.02.2011.

Merge, Split, Encrypt, Decrypt, add watermark to PDF

PDFill PDF Tools
PDFill PDF Tools is a free app allows you to do all kind of operations you want to do with your PDF files like Merge, Split, Reorder, Encrypt, Decrypt, Rotate, Crop, Reformat, Header, Footer, Watermark, Images to PDF, PDF to Images, Form Fields Delete/Flatten/List, PostScript to PDF, PDF Information, Scan to PDF, and Create Transparent Image options.
PDFill PDF Tools Features:-
  • Merge- Merge two or more PDF files into a single PDF file.
  • Split or Reorder-Extract pages from a PDF file into a new file.  Reorder the page sequence into a new file.
  • Encrypt and Decrypt with Security Options
  • Rotate and Crop-Rotate a PDF page by 0, 90, 180 and 270 degree. Crop a page to modify its layout of Print or View by specifying its margins.
  • Header and Footer-Add Headers and Footers to present information, such as date, time, page numbers, or the title of the document, in the top or bottom margins of a document.
  • Watermark -Add Stylized Text Stamp or using image file (bmp, jpg, gif, png, tiff, and wmf).
  • Convert Images to PDF and PDF to images-Convert images (bmp, jpg, gif, png, tiff, and wmf) into a PDF file with layout options vice-versa.
  • PDF Form Fields: Delete, Flatten, List-Delete, Flatten or List the PDF Form Fields inside a PDF file.
  • Convert PostScript(PS) File into PDF -Covert PS files into PDF files so Adobe Reader can read them.
  • Add Information-Add information (title, author, subject, keywords, created, creator, producer, version) to PDF documents.
  • Free Scanner-Scan your paper form or photo as an image file (PNG, JPG, BMP, TIF, GIF) or a PDF file.
  • Create Transparent Image-Create a transparent image with options to adjust transparency options
This tool is completely free for personal as well as commercial use and best thing is NO Watermarks and ads. Now, what you’re waiting for?
Note:- This app will download Ghost Script and Java on your machine, if you don’t have it.
Download PDFill PDF Tool (Freeware, Windows Only)


Saturday, 15 April 2017

Install WordPress on AWS EC2 Instance

WordPress and AWS
After successful completion of first and second step i.e. creating an EC2 instanceand connecting to EC2 instance in AWS using PuTTY and Terminal respectively. Further moving ahead, it is time to install Apache, PHP, MySQL to run WordPress on an EC2 instance. If you are not familiar with command line / Linux commands just run these commands in same order.

NOTE: This instruction is for Amazon Linux and will not work if you are trying different machine image like Ubuntu or Windows Server.

Connect to your instance via PuTTY  (Windows) / Terminal (Mac OS) / Bash (Linux OS)

Just to make sure everything is up to date
sudo yum -y update

If you want, you may directly switch from ‘ec2-user’ user to root using sudo su command.

Install multiple software packages:
sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd

Start Apache Server:
sudo service httpd start

Create a page to check your PHP installation

a) vi test.php
b) Type i to start the insert mode
c) Type <?php phpinfo() ?>
d) Hit escape button and type :wq, now hit enter to exit
e) Open a browser and http://ec2-xxx-xxx-xxx-xxx.us-west-1.compute.amazonaws.com/test.php (use you public IP DNS followed by /test.php)

If you see a phpinfo page then you are good to move forward, otherwise you may want to start over.

Delete the test.php file as it is for the information only and you definitely don’t want to give away sensitive information about your server:

rm -f /var/www/html/test.php

Secure Start SQL service

Start MySQL service and run secure installation
sudo service mysqld start
sudo mysql_secure_installation

MySQL_Secure_installation
When prompted, enter a password for the root account. By default, the root account does not have a password set, so press Enter.

Type Y to set a password, and enter a secure password twice
1) Remove anonymous users? [Y/n] Y
2) Disallow root login remotely? [Y/n] Y
3) Remove test database and access to it? [Y/n] Y
4) Reload privilege tables now? [Y/n] Y

Restart MySQL to pick up the changes:
sudo service mysqld restart

Login into MySQL and Create a database for WordPress

Log in to the MySQL server as the root user and enter your MySQL root password when prompted
mysql -u root –p

Create a user name and password for your MySQL database.
CREATE USER 'aksgeek'@'localhost' IDENTIFIED BY 'aksgeekpassword';
Replace ‘aksgeek’ with your WordPress username and ‘aksgeekpassword’ with your strong password.


Create a database for WordPress:

 Create_database_for_wordpress


CREATE DATABASE `wordpressdb`;

(you can create a database with any name)

GRANT ALL PRIVILEGES ON `wordpressdb`.* TO "aksgeek"@"localhost";

FLUSH PRIVILEGES;
exit

Install WordPress
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cd wordpress/
mv wp-config-sample.php wp-config.php
nano wp-config.php

 edit_wp-config
Start editing wp-config.php. (user arrow keys to move around)

define('DB_NAME', 'wordpressdb');
define('DB_USER', 'aksgeek');
define('DB_PASSWORD', 'aksgeekpassword');
define('DB_HOST', 'localhost');

Visit https://api.wordpress.org/secret-key/1.1/salt/ to randomly generate a set of key values that you can copy and paste into your wp-config.php file.
Ctrl + X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write [DOS Format]: wp-config.php  hit Enter.

Move your WordPress installation to root or in subdirectory / folder

You may want to run your WordPress blog from root like your_public_dns.amazonaws.com/)  then
mv * /var/www/html/

Or

Most of you want to install it in a subdirectory or folder (for example, your_public_dns.amazonaws.com/blog, then
mkdir /var/www/html/blog
mv * /var/www/html/blog

To allow WordPress to use permalinks
sudo nano /etc/httpd/conf/httpd.conf

<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

Find the section that starts with <Directory "/var/www/html"> and change the AllowOverride None line to AllowOverride All.

To ensure that the httpd and mysqld services start at every system boot
sudo chkconfig httpd on
sudo chkconfig mysqld on

Open a web browser and enter the URL of your WordPress blog, you should see the WordPress installation screen

Example for root installation:  http://ec2-xx-xxx-xxx-xxx-us-west-1.compute.amazonaws.com

or

for subdirectory / folder (blog): http://ec2-xx-xxx-xxx-xxx-us-west-1.compute.amazonaws.com/blog.

Wordpress_installation_finished

Enter your site name, username, password and email address and hit submit.



Congratulations!! You are running WordPress blog on Amazon Web Services (AWS) EC2 instance.



Troubleshooting

Having trouble updating and downloading themes/plugin in WordPress blog as it is asking for FTP credentials then run this command:
sudo chown -R apache:apache /var/www/html

Friday, 14 April 2017

How to Connect to EC2 Instance using PuTTY and Terminal

1_connect to instanceIn our last post, we learned how to create EC2 instance in AWS. After successfully launching our EC2 Linux instance, today we will connect to our instance so we can install and run WordPress. There are two methods via which we can connect to our Amazon EC2 Linux instance:
  1. A standalone SSH Client
  2. A Java SSH client directly from my browser (Java required)
2_standaloneinstance
Later seems easy to connect as most of the computer have java installed, let's get started and see how to connect our EC2 instance directly from browser.
First check whether you have java installed or your browser supports java or not?
chrome not supportted
All of you have encountered with error/problem while connecting to your instance in Chrome browser as the Chrome browser version 42 and above disabled the standard way their browser supports plugin.
firefox_java not supported
Now it’s Firefox turn: While trying on Mozilla Firefox 64-bit, I got a message saying it is 64-bit and will not run java. Another failed attempt.
win10_edge_java not supported
Our Last hope?: Using Microsoft Edge browser didn’t help either as it doesn’t have support plugin. My bad!
Old is Gold!? While checking for java on internet explorer (IE11), a pop-up window appeared mentioning “the page you are viewing uses java”. Finally a positive response, now it’s time to connect our instance  by
  1. Sign-in to AWS console –> EC2 dashboard-> running instance-> select running instance –> click on Connect button
  2. Select “A Java SSH client directly from my browser (Java required)”
  3. Your username will be mentioned by default as “ec2-user”. Now enter the location of private key path (which you have downloaded in step 7 of creating ec2 instance) C:\folder\location\private_key.pem and select save key location
  4. Now click on “Launch SSH client” button .
IE not connecting


Wait! Nothing happened, the same pop-up appeared and didn’t connect. Looks like IE 11 on 64bit Windows 10 won’t work.

firefox-32bit limited support for plugin

This time around installing and running on  32-bit Firefox, I have had encountered with a different message (gladly) but – Limited support for the plugin, therefore will not run java.  There are other browser options like opera, safari which I didn’t try and leaving up to you to try it using above steps and leave a comment below whether they worked for you or not.

It’s time to go with the first option of connecting instance via standalone SSH client:

Connect to Amazon EC2 Linux Instance using PuTTY

For Windows user
  1. Download PuTTY, PuTTYgen

    PuTTYgen

  2. Open PuTTYgen –> click “Load” button –>  Windows explorer will open browse to the .pem file location (private key that you have downloaded while creating EC2 instance) and select “All Files (*.*)” otherwise you won’t be able to see your .pem –> click “open”

    PuTTYgen_2

  3. Select “save private key”. PuTTYgen warning window appear to ask you to save this key without a passphrase key? If you want to then you may choose otherwise it’s not necessary. In short press “yes” and save the .ppk file.

    PuTTY Alert


    PuTTY_hostname

  4. Now start PuTTY and enter hostname username@public_dns_name. e.g. ec2-user@52.xx.xxx.xxx48 or ec2-user@ec2-xx-xxx-xxx-xxx.us-west-1.compute.amazonaws.com
    (The username may vary depending on which AMI you have installed. You may find this information in example when you click Connect button in console) –> Connection type SSH and port 22

    PuTTY_auth


  5. In Category pane, expand connection, then expand SSH, click on Auth –> Browse your .ppk and click Open.

    PuTTY Alert-auth

  6. If you connect for the first time, PuTTY display security alert –> choose “Yes”.

    puTTY_login_success
  7. Connected!


For Mac OSX/Linux User:


EC2 Connect via Terminal
  1. Open Terminal

  2. Locate your private key (.pem) key. (In my case, private key is in download folder)

    cd ~/Downloads

  3. Your key must not be publicly viewable for SSH to work. Use this command:

    chmod 400 your_privatekey.pem

    or

    chmod 400 /location/private_key.pem

  4. Now connect to your instance using below command:

    ssh -i "your_privatekey_name.pem" ec2-user@ec2-52-xx-xxx-xxx.us-west-1.compute.amazonaws.com You will see message like this:
    The authenticity of host xxx:xxx:xx:xx:xx can't be established.
    RSA key fingerprint is xx:xx:xx:xx:x:xx:xx:xx:xx:xx:xx:xx:xx:xx
    Are you sure you want to continue connecting (yes/no)?


  5. Type Yes and enter

  6. Now you are successfully connected your EC2 Linux instance using Terminal.
On next, we will see how to install WordPress in AWS.