What
is Ruby?
Ruby is dynamic, open-source, object-oriented, general-purpose,
interpreted programming language. Ruby is designed and developed
by Yukihiro Matsumoto in the year 1993 in Japan. Yukihiro Matsumoto is also known as Matz’s
in the Ruby Community.
Ruby is fully open-source and object-oriented
programming language. Ruby programming language is similar to Python
and Perl languages. Ruby can be used to write Common
Gateway Interface (CGI) Scripts. Ruby has a clean and easy
syntax that allows a new developer to learn very quickly
and easily.
Ruby has a similar syntax to many
other programming languages. Such as C++ and Perl. Ruby
is very much scalable and big programs / Scripts written in it, are easily maintainable.
Everything
is an
object in Ruby programming language. Each and every
code has their properties and actions.Here, properties refer
to variables and actions refer to methods.
In
this tutorial, we will learn how to install Ruby on Linux
and Windows Machines.
Installation
on Linux Machine
In
this tutorial, we will learn to install Ruby on our Linux machine in
two ways:
1.
Install Ruby From The Ubuntu Repository
2.
Install Ruby Using RVM Tool
1.
Install Ruby From The Ubuntu Repository
This method works across all the debian-based linux distributions. Such as Linux Ubuntu, Linux Kubuntu, Kali Linux, Linux Mint, Linux Zorin OS, Linux Elementary OS, Linux Parrot OS, etc. This is the easiest way to install Ruby on a debian-based linux machine.
To install
Ruby from the default Ubuntu Repositories, follow the below steps:
Step
1: Connect
your linux machine via Internet.
Step
2: Open
a new terminal from the linux application menu or by using the
shortcut command ctrl + alt + t.
Step
3: Now, update
your package indexes by using the following command:
$ sudo apt-get update
And
hit the Enter key.
Step
4: Next,
type your sudo password, when prompted. And hit the Enter key.
Step
5: Start
the Ruby installation process by running the following command:
$ sudo apt-get
install ruby-full
Press
y and hit the Enter key to verify the installation.
Step
6: To
check, whether the installation was successful, type in the following command:
$ ruby -v
And
hit the Enter key.
2.
Install Ruby Using RVM Tool
Ruby
Version Manager (RVM)
is a command-line tool, which allows you to easily install, manage
and work with Ruby versions.
To
enable RVM, you will have to install the GPG keys to verify
the installation packages.
Step
1: Install GPG
1. Connect your Linux system via Internet
/ wi-fi.
2. Open a new terminal from the linux
application menu or by using the shortcut command ctrl + alt + t.
3. Start by running the command:
$ sudo apt-get
install gnupg
And
hit the Enter key.
4. Now, type your sudo password,
when prompted. And hit the Enter key.
5. Next, install the keys
gpg --keyserver hkp://pool.sks-keyservers.net
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Step
2: Install RVM Tool
1. Before installing RVM Tool, you
will need to install software prerequisites with the command:
$ sudo apt-get
install software-properties-common
And
hit the Enter key.
2. Next, you will add the
following PPA Repository for Linux Ubuntu:
$ sudo apt-add-repository
-y ppa: rael-gc/rvm
And
hit the Enter key.
3. Now, update your package
indexes by using the following command:
$ sudo apt-get update
And
hit the Enter key.
4. Finally, install the RVM
Tool by using the following command:
$ sudo apt-get -y
install rvm
And
hit the Enter key.
5. At this stage, it is recommended to Restart
your System.
Step
3: Install Ruby
1. After Restart, open a new terminal
from the linux application menu or by using the shortcut command ctrl
+ alt + t.
2. Now, type in the following command to install
Ruby:
$ rvm install 2.5.1
And
hit the Enter key.
3. Make sure the installation was successful
by checking the version of Ruby, you have installed with the
command:
$ ruby -v
And
hit the Enter key.
Installation On Windows Machine
This process uses the latest version from the Ruby Developer Download page. There are multiple options on this page.
If the system is used for developing software, or you aren’t sure which to choose, use a version With Devkit (Developer’s Kit). If you only need to run Ruby applications, use the version Without Devkit.
Step 1: Download the Ruby Installer Tool
Use a web browser
to navigate to the Download page (linked above). Save the file
and remember its location.
Step 2: Run the Ruby Installer
1. Browse to the location of
the RubyInstaller tool, and
double-click.
2. A Setup dialog launches and
displays the License Agreement. Select I accept the License and
Click Next.
3. The installer asks
to adjust the installation location and associated file types.
Leave the defaults selected, unless the system requires differently,
then click Install.
4. The system prompts to select components. Leave the default
settings, and click Next.
5. The Setup dialog runs for several minutes. When finished,
it prompts to “Run ‘ridk install’ to setup MSYS2 and
development toolchain.” Leave this checked and click Finish.
6. A black command-line-style window appears, labeled RubyInstaller2 for Windows. Select the components
to install. Press Enter to install the
default tools.
7. Once it finishes, press Enter again
for the installer to close.
Step 3: Verify the Ruby Installation
If you have any terminal
/ command panel windows open, close them. Open a new terminal / command
panel window, and enter the following:
ruby –v
My book Pracheen Vishva Ki Pramukh Nadi Ghati Sabhaytayein/प्राचीन विश्व की प्रमुख नदी घाटी सभ्यताएं (Hindi Edition) Kindle Edition



0 Comments