Friday, 17 October 2014

Rails and Mysql Set up on ubuntu Server

Ruby + Rails + Mysql + RVM + Gemset + Apache

Steps to set up server

On Ubuntu Image

Reference Link

1. Install curl first

sudo apt-get install curl

2. Install rvm

\curl -L | bash -s stable

3. Path to load rvm (Given in comments after installation of )

source ~/.rvm/scripts/rvm
source ~/.profile

4. Requirements related to rvm

rvm requirements

5. Check version of rubies present on cloud

rvm list known

6. Install specific version

rvm install 1.9.3

7. Create gemset for particular rvm

rvm gemset create demo

8. Use gemset

rvm gemset use demo 

9. If you want to build a application from scratch than install gem rails.

gem install rails -v 3.2.14

10. Otherwise enter into the application and run

rvm use 1.9.3-p374@demo

Installing Mysql steps

Make sure your package management tools are up-to-date. Also make sure you install all the latest software available.

sudo apt-get update

sudo apt-get dist-upgrade

Install the MySQL server and client packages:

sudo apt-get install mysql-server mysql-client

You need to set a root password

sudo mysqladmin -u root -h localhost password 'mypassword'

sudo mysqladmin -u root -h myhostname password 'mypassword'

For Ruby dependencies install

sudo apt-get install libmysql-ruby

You can now access your MySQL server like this:

mysql -u root -p

Installing Apache has never been easier using apt-get.

First, I updated the repositories.

sudo apt-get update

Then fixed the locales.

sudo locale-gen en_US en_US.UTF-8 en_CA.UTF-8

sudo dpkg-reconfigure locales

And finally installed all the basic packages I thought I'd need.

sudo apt-get install apache2 curl git build-essential zlibc zlib1g-dev zlib1g libcurl4-openssl-dev libssl-dev libopenssl-ruby apache2-prefork-dev libapr1-dev libaprutil1-dev libreadline6 libreadline6-dev