Setup Ruby on Rails in Debian 7
1. Update the source list
Assumed that ruby & gem are not installed. Need to install rvm first.
Before that, rvm require some packages which are not available on the default debian repo. Thus update the apt
list first
Remember to switch to root user
1 | $ su - |
Edit the list file
1 | vi /etc/apt/sources.list |
Make sure all these are inside
1 | deb http://security.debian.org/ wheezy/updates main |
Then run a command (to prevent GPG error)
1 | $ gpg --keyserver pgpkeys.mit.edu --recv-key ED444FF07D8D0BF6 |
Then update the apt
1 | $ apt-get update |
2. Install necessary programs
First you need curl
1 | $ apt-get install curl |
3. Add yourself to sudoers
This is because later the rvm script will need sudo
1 | $ adduser username sudo |
4. Install rvm
Make sure this is run by yourself (not root)
1 | gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 |
Install latest ruby
1 | $ rvm install current |
5. Rails app
1 | $ rails new yourapp |
Execute it
1 | bin/rails server |
Now you can open up your browser, and type in localhost:3000
6. Test by other peers (optional)
Example if the project is run inside VM (I’m using VMWare Fusion), then
1 | $ bin/rails server -b 192.168.1.xx |
Later on, in your host OS’s browser, type in 192.168.1.xx:3000
References: