Monday, November 23, 2015

PostgreSQL installation on AWS Linux server

Steps to install PostgreSQL in Linux server
Prerequisites

    You will need to have access to a superuser, or sudo account, so you can install the PostgreSQL database software

Installation

First, update apt-get library

     $ sudo apt-get update

Then install PostgreSQL and its development libraries

     $ sudo apt-get install postgresql postgresql-contrib libpq-dev

PostgreSQL is now installed  

Create PostgreSQL User

To create new user run the below command with your own user name

     $ sudo -u postgres createuser -s <pg-username>

If you want to set a password for the database user, enter the PostgreSQL console with this command

$ sudo -u postgres psql

Enter the following command in PostgreSQL prompt to set the password for the user that you created before

postgres=# \password pguser

MySQL installation on AWS Linux server

Steps to install MySQL in Linux server
Prerequisites

You will need to have access to a superuser, or sudo account, so you can install the MySQL database software
Installation

First, update apt-get library

     $ sudo apt-get update

Then install MySQL and its development libraries

      $ sudo apt-get install mysql-server mysql-client libmysqlclient-dev

During the installation, your server will ask you to select and confirm a password for the MySQL "root" user. MySQL is now installed

Secure MySQL server

Run some additional commands to get our MySQL environment set up securely

First we need to tell MySQL to create its database directory structure where it will store its information

      $ sudo mysql_install_db

Afterwards, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system

      $ sudo mysql_secure_installation

Access MySQL server

To Access the MySQL shell

      $ mysql -u root -p

After entering the MySQL root password into the prompt you can able to access MySQL server prompt.

Installing RVM in deployment Server

1) Update all latest packages
  • sudo apt-get update

2) Update gpg Keypair
  • gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
If its failed then run the below command
  • command curl -sSL https://rvm.io/mpapis.asc | gpg --import -

3) Install RVM
  • curl -sSL https://get.rvm.io | bash -s stable

4) Load RVM
  • source ~/.rvm/scripts/rvm

5) Install RVM dependancies
  • rvm requirements

6) Install required dependancies
  • rvmsudo /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion