Monday, March 9, 2015

Install Ruby on Ubuntu server

image

Summary
Use the following commands
sudo apt-get update
 sudo apt-get install ruby
The following demonstration was done on a Ubuntu server 14.04 accessed via Putty
image
Here are the commands and steps used to install Ruby on a Ubuntu server or Ubuntu via command line.
sudo apt-get update
Next step is to install Ruby
sudo apt-get install ruby
Now lets make a directory for Ruby Code
Mkdir rubyCode
The next step is to use Vim. If the machine has no Vim, enter the install command below
sudo apt-get install vim
Now use vim with the command below which creates a new .rb file
vim helloWorld.rb
Hold your typing vim. Follow these steps to write the hello world ruby app
image
Press the 'I' keyboard key
Type 'puts "Hello World in Ruby" '
 
Press the escape keyboard key
Type ':wq'
image
Now you should be back to the command line. Test the code with the following command
 ruby helloWorld.rb
image
You should see the text "Hello World in Ruby"
image
There you have it. Ruby is installed in the Ubuntu machine. You can learn more on Ruby on some tutorial sites like http://rubylearning.com/satishtalim/tutorial.html.
As for Vim, you can also learn about it online an example site is this page https://www.linux.com/learn/tutorials/228600-vim-101-a-beginners-guide-to-vim

Reference https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm