Installing Ruby on Rails Environment on Ubuntu
I have recently joined a bootcamp for Ruby on Rails and thought it might be a good idea to share what I believe to be a decent startup guide on how you should setup your server. By no means is this the “best” configuration around, but it’s just an easy step by step guide I’m making based on the tutorials/books I’ve read on setting up the server.
For this, I used the free Amazon Web Service’s Ubuntu 12.04.3 LTS 64bit Server.
Once you have logged in successfully via SSH, just follow these steps to get you started on getting an environment that can safely run your Ruby on Rails application.Note: If you are not sure how to access your server via SSH, follow the guide by Amazon here.
Where it says “Run”, all you need to do is copy the text that is in bold¬†and paste it into the command line. I suggest copy and paste as you might make mistakes with spacing.
Updating the Server
- Run sudo apt-get update
- Run sudo apt-get dist-upgrade
- Run curl -L https://get.rvm.io | bash -s
- Run source /home/ubuntu/.rvm/scripts/rvm
- Run rvm get stable
- Run rvm requirements
- Run sudo apt-get install libyaml-dev
This process may take sometime to compile, so be patient.
- Run rvm install 2.0.0 –with-openssl-dir=$HOME/.rvm/usr
- Run rvm use 2.0.0
- Run gem update –system 2.1.9
- This is the latest version I am using as of the time I am writing this.¬†
If you are wanting to use Ruby 1.9.3 instead, change the 2.0.0 to 1.9.3 wherever it occurs.
Disable RDoc and Ri (Optional Step)
When installing gems, by default RubyGems generates two different kinds of documentation (called ri and rdoc), but many Ruby and Rails developers find that the time to build them isn‚Äôt worth the benefit. (Many programmers rely on online documentation instead of the native ri and rdoc documents.).
– Michael Hartl
Note that this step is optional – you don’t have to do it if you don’t want to, but I find that installing gems and many of the features for Ruby run much faster without RDoc and Ri.
- Run nano ~/.gemrc
- Type the following lines:
- install: –no-rdoc –no-ri
- update: –no-rdoc –no-ri
- Press Ctrl+X and then press Y and hit Return/Enter
- Run gem install rails –version 4.0.1
Install Additional Packages
- Run¬†sudo apt-get install libxslt-dev libxml2-dev libsqlite3-dev libmysqlclient-dev nodejs git
Now as I said, I do not expect this guide to be the best one available. But for someone who is starting out on RoR and wanting to have a server up and running on a linux server, this would definitely come in handy.
Please let me know if you have any suggestions or tips to improve this.