#Install Ubuntu with Rails on your developement machine Need to get Rails (4.0.0) running on your ubuntu pc, or are you tired of making rails applications in windows? Follow my guide below to get your own ubuntu developement pc running.
##installing Linux
Download Ubuntu desktop from www.ubuntu.com and install this to a computer.
- Install the correct version (x86 or x64)
- Make sure the / size is at least 10gb
- Make sure the swamp size is at least as big as your RAM memory.
- Make sure to make your desktop envirnoment cozy, You'll be seeing it for a long time after this.
##Get ubuntu ready for ruby
- Update your linux distro by opening a terminal and typing
sudo apt-get update
followed bysudo apt-get upgrade
- Install sublime text 3 from the software center. add package controll to it and get the haml, sass, emmet, colorpicker and sftp plugin's running in it.
- Install chrome from the Chrome Site. Having 2 browsers is better then one.
##Install Rails In this tutorial rails will be installed using RVM. I as writer of this document recommend this because it will allow you to switch between ruby versions and update your environment on the fly.
###Get stuff ready
Start installing rails by opening a terminal and updating the software lists in Ubuntu. this is done easily by the following command sudo apt-get upgrade
installed your own rvm, ruby or rails? remove it! rvm can be uninstalled using the command
rvm implode.
when the software lists are up to date you install Curl. This will allow us to make the envirnoment and download the sources. give the terminal the following command
sudo apt-get install curl
###RVM when Curl is installed, were going to install the Ruby Version Manager. This will allow us to install and run different versions of Ruby.
Download and install RVM using the command below.
curl -L get.rvm.io | bash -s stable --auto
This will install RVM to our account only. This is very cool, since other users will not be able to mess with your environment (unless they break into your user account).
after installing RVM you will need to reload the bash_profile. This is your consoles envirnoment (colors, commands and stuff). Do this using the command below
. ~/.bash_profile
Does your terminal have issues with loading the bash environment in a new terminal window (rvm commands are not working)?
- type
gedit ~/.bashrc
- A text editor will load with a file add
. ~/.bash_profile
on a new line at the bottom of the document.
when the bash profile is loaded try to get rvm's version number by executing the command:
rvm -v
You should get a version number if everything is working. If not, Google the error or contact me.
RVM needs all kinds of requirements to work properly. Check if you have everything on your computer by executing
rvm requirements
In some cases the terminal will ask you to install stuff (using sudo apt-get
) but in most cases it will ask you for your password and install stuff on it's own. rvm requirements will install or ask you to install Git. follow the instructions of the Git install when you meet them.
###Ruby after our big RVM install in which we establish the pilers for ruby to work. we are going to focus on getting Ruby running.
The first thing we do is telling RVM to get ruby 2.0.0 (or higher) the command below should fix this for you.
rvm install 2.0.0
Now is the perfect moment for that nice sandwich in your fridge and the occasional cup of tea/coffee, since this will take some time.
Before we can use ruby 2.0.0 we need to set it as our default Ruby version. This neat command below wil fix that for you.
rvm use 2.0.0
Now we need to test if ruby is listening to the commands we give it and the verion number is correct. The command below should give you the ruby version number + a p... number (patch) + a date.
ruby -v
Let's make ruby 2.0.0 the default ruby for our user and all services on our user account. use the command below (with the p... number from your ruby -v
):
rvm --default use 2.0.0-p247
whenever a new terminal is opened for our user this ruby version is listening to commands.
###Rails before we get in to this, let's just give ourselves a big high five! we managed to install Ubuntu, RVM and Ruby! Feeling like an expert already?
Let's move on. We are going to need rails of course. give the terminal the following command:
gem install rails -v 4.0.0
This command is going to install rails and depending gem's. notice, you are not using any form of admin rights in the installation of Gem's. This because Ruby is only available on your user account and not system wide.
To run your server you will most likely need to pull your Sass, Coffeescript, Haml and turbolinks trough compilers and pipelines... You will need a Java based compiler in this case. Let's use Node.JS for this. run all lines below in your terminal to install Node.JS
sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs
are you going to use postgres on your developement projects?
sudo apt-get install postgresql
Are you going to use mysql2 on your developers side?
sudo apt-get install libmysqlclient-dev
##Fancy Terminals are you going to use Git and would you like to fancy your terminal up a bit? Follow my guide on the perfect git console.