Here is a step by step guide for the beginners on how to install RVM on Rackspace Cloud Server running Ubuntu 14.04, PVHVM version for Rails. Ruby is an elegant object-oriented, general-purpose programming language. Ruby has influence of Perl and Lisp – that is about usage of Ruby though.
This Guide To Install RVM on Rackspace Cloud Server is Not For Devops Account
Rackspace Support can install Ruby for all kind of accounts except the Infrastructure managed level. This guide is not intended to mess up your existing managed setup. For the Infrastructure managed level users, the whole server image will be available as premium download from our Premium Membership area along with Video Guide. This is the mother text guide which practically not require to purchase server image unless you need rapid multiple deployments.
You should have a fresh device – spin up a new server instance with current Performance 1 flavor with PVHVMfeature.
---
Install RVM on Rackspace Cloud Server (Ubuntu, PVHVM)
As usually, login to your device (=new server) as root; update and upgrade your device :
1 2 3 | ssh root@IPaddress apt-get update -y && apt-get upgrade # take decision judiciously for upgrade prompt |
As Ruby on Rails does not come as a usable package, we usually use version managers like the Ruby Version Manager ( RVM ). This is true for all Unix like OS.
But you should always check whether Ruby is installed or not by running which ruby
command. If Ruby is not installed, you will not get any output. First we need to install the dependencies :
1 2 3 | apt-get install curl git-core ruby # read documentation here # https://github.com/wayneeseguin/rvm |
Actually if you run this command :
1 | bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) |
The bash script will do the major work. Find .bashrc
file by running locate .bashrc
command an edit it with nano
. You need to edit the .bashrc
file :
1 2 3 4 5 6 7 8 | # use ^ + W to find the following : [ -z "$PS1" ] && return # and replace it with if [[ -n "$PS1" ]]; then # go to the end of file and add this if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi fi # write out with ^ + O and exit with ^ + X |
Run the following commands :
1 2 3 4 5 6 7 8 9 10 11 12 | # load .bashsrc to current environment source ~/.bashrc # get a list of what to install rvm notes # you'll get a huge output like sudo aptitude install build-essential bison openssl # copy and paste and hit Enter / Return key # on post installation, run rvm list known # you will get a list of versions # you might need a specific version rvm install <ver-number>-head rvm --default <ver-number>-head |
Shortcut to Install RVM for Ordinary Usage
While the above is precise, this method can give satisfactory result :
1 2 3 4 | \curl -sSL https://get.rvm.io | bash -s stable --rails source ~/.rvm/scripts/rvm rvm install <ver-number> rvm use <ver-number> |
Adding Nginx, Passenger and an application server
We can install in this way :
1 2 3 4 5 6 7 | # install the dependencies # do not blindly copy # install what you'll need # we have libsqlite3-dev and nodejs for example apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties libxslt1-dev libxml2-dev libmysqlclient-dev libsqlite3-dev nodejs gem install passenger passenger-install-nginx-module |
Here is a script :
1 | https://gist.githubusercontent.com/AbhishekGhosh/afa3bacf2124e803bf73/raw/9b737a42e950581f16ed3074c69f5bcb920f24cb/nginx-ruby-controller-bash-script.sh |
You can work with it :
1 2 3 4 5 6 7 | wget -O init-deb.sh https://gist.githubusercontent.com/AbhishekGhosh/afa3bacf2124e803bf73/raw/9b737a42e950581f16ed3074c69f5bcb920f24cb/nginx-ruby-controller-bash-script.sh # move it mv init-deb.sh /etc/init.d/nginx # make it executable chmod +x /etc/init.d/nginx # apply it /usr/sbin/update-rc.d -f nginx defaults |
Our config file will be here :
1 2 3 4 | locate nginx.conf # copy the output to crosscheck nano /opt/nginx/conf/nginx.conf # edit normally |
Database part is easy :
1 2 3 4 5 6 7 8 9 10 11 12 13 | apt-get install mysql-server mysql-client libmysqlclient-dev # mysql database creation, adding user etc mysql -u root # mysql > # is omitted CREATE DATABASE your-database; CREATE USER 'user-name'@'localhost' IDENTIFIED BY 'your-password'; # may be? GRANT SELECT,DELETE,INSERT,UPDATE ON .* TO 'user-name'@'localhost'; # example with service net GRANT ALL PRIVILEGES ON .* TO 'user-name'@'60.669.769.69'; FLUSH PRIVILEGES; exit |
Final work is to deploy Rails.
Tagged With ruby