[Sorry I hit send by mistake in previous email]
Welcome to Ruby on Rails. I am alost got started last week. I setup my
development box on ArchLinux and two days back on OSX. Generally
whenever I started with new language or framework, I prefer to check the
official docs as it is mostly the accurate one (which is you are already
doing). For example:
- For RoR 4:
- For RoR 5 Best:
I agree with you if sometimes you find official docs does not have
details, usually because the writer already been doing this for a while
some small details becomes second habit for him/her. Please find my
On Saturday, February 20, 2016 at 3:33:34 PM UTC+1, krfg wrote:
Having finished the Michael H. Rails tutorial, which uses Cloud9 as
development environment, I would like to redo it configuring my machine
(Ubuntu 14.04 LTS) as a local development environment.
Thats awesome, doing it yourself is the best way to learn about
new. I respect c9 and all those other SaaS/PaaS services however
configuring locally for learning is the best way. Sometimes you get
frustrated when configuring something for the first time, I remember
happens to me every-time, for example two months ago when I was trying
install Gentoo from scratch.
I am determined to use Atom + Terminal, and I would really appreciate
some help in determining what remains of all the necessary software to be
installed in my computer, because the tutorial is not much helpful in this
Atom is cool tool to start with and I guess you found your way in
installing it. GUI Terminal is of course already installed (most of the
Before Rails I decided to study some Ruby.
In the official Ruby web page
Bitnami RubyStack is recommended as a complete development environment for
Rails. Since I planned to study Ruby for Rails, I installed Bitnami
RubyStack: would you recommend to keep it? Or, as I suspect, it would be
better to install each component separately?
I personally would install each component separately for learning and
because most of time such fat installers install things that you will
be using at least when you are getting started.
The official Rails web page used to provide a link
http://guides.railsgirls.com/install#setup-for-linux for those
interested in how to install the Ruby on Rails development environment:
would that be a recommendable solution?
I checked this link, for ubuntu it is using a rails-install-ubuntu.sh
is just a shell script the automate running multiple commands. Again
it yourself is better for learning, you can read the script and try to
understand what each command does before executing that command
not like to find myself into trouble.
It depends on what do you want to achieve. If you are just installing
things to learn about RoR, then definitely go with SQLite as it is
to setup and satisfy the needs. If you are planning to build a
production-ready application then the choice of database matters:
- SQLite: suitable for storing small things, could be
or small apps where each user data is stored in separate SQLite file.
Mostly you want to avoid SQLite for concurrence access for write due
locking will become a problem.
- Relational database like PostgreSQL or MySQL for bigger projects
where you are looking for a trustworthy database than can serve even
scale of Facebook.
- NoSQL databases where you application model is less relational
you will have to program the relation in the code) or the user
performance is really critical, although I could argue that you can
achieve comparable results with relational databases (of-course by
some more advanced techniques, or just extra hardware)
In short, if you are just learning go with SQLite.
- RVM: will I need RVM for switching between Ruby versions? The
RailsApps project recommends it. For the tutorial, it was more determinant
the possibility to choose the Rails version than that of Ruby.
It is good to start with some version manager, because in many cases the
default .deb package that you get from apt-get is not always the latest
version due to 14.04 is considered a stable LTS version of ubuntu. I
personally tried rvm & rbenv, I found it rbenv nicer, although it is
matter of taste.
Bundler: is it installed with Ruby of will I need to install it
Node.js: the RailsApps project says that “for development on
I am not sure why do you need Node.js here. If you are planning to do
ReactJS or AngularJS (Single-Page-App) then anyway the regular rails way
may not be the best, you will need to tweak things. For example in Rails
rails-api code got merged with the official release
http://edgeguides.rubyonrails.org/api_app.html so that you can drop
‘view’ part of your rails app and rely on ReactJS (for example) to give
the view. However if you are getting started with Rails, I suggest to
with the default setup without the complexity of those awesome front-end
frameworks because they are really a different story that you will need
learn at some point.
- Web server: what local web server would you suggest? WEBrick?
Apache? The tutorial uses WEBrick.
For development purposes, WEBrick (Rails 4) or Puma (Rails 5) is good
enough. For production deployment you will need another solution like U
https://unicorn.bogomips.org/nicorn https://unicorn.bogomips.org/ or
The idea is you need a web server that works well with the Rack web
which is a concept used by other languages as well like Python
https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface and Perl
https://en.wikipedia.org/wiki/PSGI. Sometimes also you add in front of
that an nginx http://nginx.org/ server. I will not go though more
as I guess is more about to deploy production setup.
In short for development locally and getting started stick with the
rails server WEBrick (Rails 4) or Puma (Rails 5)
- Git: Git is already installed with Ubuntu. Will that be enough?
Would you recommend anything else?
Finally, I suppose I will need to find documentation on how to configure
all these applications: do you have any suggestion about that?
Many thanks in advance
To test setup on ubuntu 14.04 64 LTS
https://vagrantcloud.com/ubuntu/boxes/trusty64. I installed a vanilla
vagrant https://www.vagrantup.com/downloads.html box. Here the
typed to get rails running:
1. Setup your locale,* I assume the locales already working for you,
can skip this step*
$ echo ‘LC_CTYPE=“en_US.UTF-8”’ | sudo tee -a /etc/default/locale
2. Check if ruby installed
$ ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
As I mentioned before, the default ruby version is not the latest, so we
could use version manager to get a latest version. You can also do that
other way by importing edge packages for a personal package archive
however using a version manager is more cool and easier. Although on
production I believe you will need to use proper .deb package not a
3. Check if git installed
$ git --version
The program ‘git’ is currently not installed. To run ‘git’ please ask
administrator to install the package ‘git’
4. Note that installing git from apt-get have the same problem as
installing ruby because 14.04 LTS package repository only has stable
To install latest git version, you can compile from source code, or
a good ppa with latest git packages. I will go with ppa git-core
$ sudo apt-add-repository -y ppa:git-core/ppa
5. Update apt local index
$ sudo apt-get update
6. Install git
$ sudo apt-get install -y git
7. Check git version again
$ git --version
git version 2.7.1
8. Installing rbenv, you can go via ppa path
https://launchpad.net/ubuntu/+source/rbenv but it is not update to
so I will go with compile from source.
I will assume you have make and gcc installed, otherwise run sudo
install -y build-essential
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src
$ echo ‘export PATH="$HOME/.rbenv/bin:$PATH"’ >> ~/.bash_profile &&
$ ~/.rbenv/bin/rbenv init
$ echo ‘eval “$(rbenv init -)”’ >> ~/.bash_profile && source
Sorry I hit send by mistake. Once rbenv installed, you need the
plugin to tell rbenv how to build ruby version.
$ git clone https://github.com/rbenv/ruby-build.git
9. Now install ruby, first we need to make sure you have the tools to
build the source code:
$ sudo apt-get install -y build-essential libssl-dev libreadline-dev
$ rbenv install 2.3.0
$ rbenv global 2.3.0 #Set this version globally
$ hash -r # to clear shell cache
$ rbenv version
2.3.0 (set by /home/vagrant/.rbenv/version)
$ ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
$ gem env
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY:
- USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/2.3.0
10. Install Rails, I will go with Rails 5 beta
$ gem install rails --pre
$ rails --version
11. Bundler, it does not come with default ruby installation:
$ gem install bundler
$ bundler --version
Bundler version 1.11.2
12. Install sqlite, note that you need libsqlite-dev to be able to
sqlit3 gem later while creating new rails app
$ sudo apt-get install -y sqlite3 libsqlite3-dev
$ sqlite3 -version
3.8.2 2013-12-06 14:53:30 27392118af4c38c5203a04b8013e1afdb1cebd0d
13. Create a project as in the manual
$ rails new blog
14. Start the server
$ cd blog && bin/rails server
`rescue in block (2 levels) in require’: There was an
error while trying to load the gem ‘uglifier’.
I was wrong previously, it seems we need nodejs to be able to execute
nodejs via nvm https://github.com/creationix/nvm
15. Install node version manager
$ curl -o-
$ source ~/.bashrc #assuming it writes things to bashrc
$ nvm --version
16. Install node itself
$ nvm install 5.6.0
$ node --version
17. Try again to start rails server
$ bin/rails server
=> Booting Puma
=> Rails 5.0.0.beta2 application starting in development on
rails server -h for more startup options
=> Ctrl-C to shutdown server