blog

Connecting via SSH to Server (Putty)

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. The best known example application is for remote login to computer systems by users.

SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server. Common applications include remote command-line login and remote command execution, but any network service can be secured with SSH. The protocol specification distinguishes between two major versions, referred to as SSH-1 and SSH-2.

Connecting to the server

  • Mac OS User’s have already  SSH terminal by default.
  • Windows based Systems do not come with an SSH client by default.
  • Windows User need to install putty  (Download)
  • Linux User have already  SSH terminal by default.

Login credentials

  • If your Host provider provides PassWord for the login then you don’t need to do  much 🙂
  • if your host provides key’s like .pem or in other format then you need to convert in .ppk format to access your server using putty. (Only Window’s User need to convert there files )

Converting your key to .ppk  format using putty gen

  1. Start PuTTYgen .
  2. Choose Load. By default, PuTTYgen displays files with the extension .ppk.  locate your .pem file by selecting the option to display files of all types.

    PuttyGen
  3. Select your .pem file for the key pair that you specified when you launched your instance, and then choose Open. Choose OK to dismiss the confirmation dialog box.
  4. Choose Save private key  Option and Save your File .  PuTTYgen will display a warning about saving the key without a passphrase. Click on Yes.
  5. Now save your File 🙂 .

    Starting a PuTTY Session

    To start a PuTTY session

    1. Open PuTTY.
    2. In the Category pane, choose Session and complete the following fields:
      1. In the Host Name box, enter user_name@public_dns_name  or user_name@elastic-ip 
      2. you can choose a username from below list  if you are confused 🙂 .
        • For an Amazon Linux AMI, the user name is ec2-user.
        • For a RHEL AMI, the user name is ec2-user or root.
        • For an Ubuntu AMI, the user name is ubuntu or root.
        • For a Centos AMI, the user name is centos.
        • For a Fedora AMI, the user name is ec2-user.
        • For SUSE, the user name is ec2-user or root.
        • Otherwise, if ec2-user and root don’t work, check with the AMI provider.
      3. Under Connection type, select SSH.
      4. Ensure that Port is 22.
      Putty
    3. In the Category pane, expand Connection, expand SSH, and then choose Auth. Complete the following:
      1. Choose Browse.
      2. Select the .ppk file that you generated for your key pair, and then choose Open.
      3. Choose Session in the Category tree, enter a name for the session in Saved Sessions, and then choose Save.
      4. Choose Open to start the PuTTY session.
    4. If this is the first time you have connected to this instance, PuTTY displays a security alert dialog box that asks whether you trust the host you are connecting to.
    5. (Optional) Verify that the fingerprint in the security alert dialog box matches the fingerprint that you previously obtained in step 1. If these fingerprints don’t match, someone might be attempting a “man-in-the-middle” attack. If they match, continue to the next step.
    6. Choose Yes. A window opens and you are connected to your instance.

      Woo!!  we are connected 🙂

     

Install WordPress In AWS

Step 1: Create an AWS Account

First  of all  you need to login to  your AWS account , if you don’t  have one then create one now from here .

AWS offer’s one year Free Tiew ,  mean’s you can host your small  website for free on a dedicated server 🙂  .

 

Step 2: Create an Instance

Before Creating a New Instance you need to  think about your website , for a normal  website free tier config will  be fine other wise you need to go  for m1.small or up 

To create a new instance, access the AWS Management Console and click the EC2 tab:

  • Choose an AMI in the classic instance wizard: I chose the Basic 32-bit Amazon Linux AMI.
  • Instance details: Select the Instance Type you want to use. i’m going for t2.micro . 
  • In Next  Step  Leave as it is 🙂  .
  • IN STEP  4 :-  STROAGE SETTING’S ,  CHANGE FROM 8GB TO  30GB (TILL 30GB IT’S FREE 🙂
  • IN STEP  5:-  TAG’S (LEAVE IT AS IT IS )
  • IN SETP 6 :- SECURITY  GROUPS ( OPEN ALL  THE HTTP , HTTPS FOR ANY WHERE ).
  • IN NEXT  STEP  :_  Check  each  and every  thing and click on launch  .
  • Create a new key pair. Enter a name for your key pair . (you can choose any  name but keep  this file safe )
  • Select the quick start security group.
  • Launch your instance.
  • Click on left side menu on Elastic IP under Network and security  .
  • Create a new IP address and associate it with your running instance .

 

Install WordPress in AWS

Now you have to  access your server using SSH . Windows’s user’s need to  download putty  and MAC user’s can use there terminal  .

If you are going to  use putty  then convert  your pem file to  ppk using puttygen .

Step 3: Installing the Apache Web Server

type :- sudo  su 

To install the Apache Web Server, type:
yum install httpd

Start the Apache Web Server:
service httpd start

Try Testing Your Website using your Public DNA or your elastic Ip  address .   http://ec2-**-**-***.compute-1.amazonaws.com

Step 4: Install PHP

To install PHP, type:
yum install php php-mysql

Restart the Apache Web Server:
service httpd restart

Create a page to test your PHP installation:
cd /var/www/html
vi test.php

  1. Type i to start the insert mode
  2. Type <?php phpinfo() ?>
  3. now press Esc button to  exit the insert mode .
  4. Type :wq to write the file and quit vi

Open a browser and access test.php to test your PHP installation: http://ec2-**-**-**-***.compute-1.amazonaws.com/test.php (Use your actual public DNS name).

Step 5: Install MySQL

To install MySQL, type:
yum install mysql-server

Start MySQL:
service mysqld start

Create your “wordpressblog” database:
mysqladmin -uroot create wordpressblog

Secure your database:
mysql_secure_Installation

Answer the wizard questions as follows:

  1. Enter current password for root: Press return for none
  2. Change Root Password: Y
  3. New Password: Enter your new password
  4. Remove anonymous user: Y
  5. Disallow root login remotely: Y
  6. Remove test database and access to it: Y
  7. Reload privilege tables now: Y

Step 6: Install WordPress

To install WordPress, type:

cd /var/www/html
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gzcd

This will uncompress WordPress in its own “wordpress” directory. I like having WordPress in a separate directory, but would rather rename it to “blog”:

mv wordpress blog

Create the WordPress wp-config.php file:

cd blog
mv wp-config-sample.php wp-config.php
vi wp-config.php
chmod 777 wp-config.php

Open You Public  DNS or your elastic IP address and config your WordPress .

After successful  install  don’t forget  to  change your file permission 

chmod 440 wp-config.php

 

Step 7: Map your Domain Name

you can even use your public DNS or elastic IP , but if you want to use your domain name then , follow these step’s :-

  1. Login to your domain access where you can manage your DNS .(KEEP THE DEFAULT NAME SERVER’S )
  2. Add a new A record or cname record .
  3. if you  are going to add A record then use your elastic Ip  as a host .  example     @     1200   your elastic IP  
  4. if you  are adding cname then use your public  DNS as a host

              @    1200  ec2-**-**-**-***.compute-1.amazonaws.com

 

 

Woo!! your WordPress Install in AWS is ready  :).  Enjoy 🙂