Ruby Programming Tutorial - Lesson 01 - Installation of Ruby Environment

in #ruby7 years ago (edited)

logo1.jpg

Hey Friends,

This is the first part of ruby programming Lessons. In this part, we are going to learn,
setting up the Ruby environment for development.

I suggest doing it on linux operating system .. Ubuntu 16.04 is suggested ..
If you are on windows, there is an easier method of installing ruby, that is via
rubyinstaller.

You can find it here :)
https://rubyinstaller.org/downloads/

otherwise if you are on linux operating system, follow this guide, I am sure we are going to have so much fun.

Let us Begin :)

Execute this command in your terminal. we are installing ruby via rbenv .. so first lets get it

git clone https://github.com/rbenv/rbenv.git ~/.rbenv

ruby1.JPG

After cloning rbenv execute these two commands.

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

ruby2.JPG

Next step is sourcing rbenv,
that you can do by typing following command

source ~/.bashrc

after sourcing it, you can check to see if rbenv is installed properly, by doing so.

type rbenv

your output should be similar to as shown below.

ruby3.JPG

Following command will allow us to use "rbenv install" command,
which comes in handy, when installing different versions of ruby programming language.
Sometimes, if we wish to clone a github project and it is build with different version of language.
rbenv install command helps us switching between different versions of ruby programming language,
You will see that it requires only one command to install a different version of ruby. :)

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

Following command allows us to see, what versions of ruby programming language are available.
we can choose any version from the list, and install it easily :)

rbenv install -l

next step is to install the version of ruby programming you want ..
in our case we will install
ruby 2.5.0 which is latest stable.

rbenv install 2.5.0

and if you installed many versions of ruby , you set to choose a default version for your ruby programs
by typing and executing this command.

rbenv global 2.5.0

final step is to verify if everything is installed correctly , we can check that by executing this command,

ruby -v

which returns us the version of ruby which we just installed :)

If you have done everything correctly .. you must be proud of yourself :) because you just installed ruby development environment ... We can now do all the magic we want to do..
240_F_88550760_nmnZaQhKLoquymJg8jlNlvtZHQDjDHWq.jpg

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.ruby-lang.org/en/documentation/installation/

This method is difficult. but if you want to follow it. it can also help you..
if you are on ubuntu 16.04 .. you need to follow my guide which i written above.
or if you are on windows you can also follow what's written above. thanks

Vaya se ve bastante bueno ☻

Help a brother out need some support. Got no steem.

Brother.I am from Bangladesh.May I work with you as your younger brother?I need to know about of best steeming.

Hello, Nice to meet you
I am Korean.
I hope everyone who reads this article is happy.
I'll follow you.
Please follow me. I'd love it.

@resteemator is a new bot casting votes for its followers. Follow @resteemator and vote this comment to increase your chance to be voted in the future!

I follow you

Well Bilal! you are always amazing and do wonderful things, my friend

Hello Bilal! I’m an architect loves using sketch-up which is a software supports ruby plug-ins. I decided to follow your tutorials and upvote. Hope, that’s gonna help me to build my own plugins fır sketch-up

Thanks @gmike , I will continue this series. I hope you can build whatever you want.