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.
First thing we need to do is update the server.
- Run sudo apt-get update
- Run sudo apt-get dist-upgrade
Note: You may be prompted with “Do you want to continue [Y/n]? – Press Y and hit enter
Now we are going to install RVM – a command-line tool which allows you to easily install, manage and work with Ruby.
- 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.
Now we are going to install Ruby using RVM. Depending on which version you are wanting to install, modify the command as such.
- 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.
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
Now we’re going to install Rails 4.0.1 which is quite a simple step.Â If you didn’t follow the optional step of disabling RDoc and Ri, this could take some time.
- Run gem install rails –version 4.0.1
- RunÂ sudo apt-get install libxslt-dev libxml2-dev libsqlite3-dev libmysqlclient-dev nodejs git
This basically installs the additional libraries, along with NodeJS and 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.
Majority of this article was based off this guide: Learn Web Development with the Ruby on Rails Tutorial