Nikita Kazakov
Nikita Kazakov
3 min read

Tags

It’s hard enough to learn a new programming language by itself and it’s miserable when you run into avoidable system errors.

I learned the hard way. Folks on Reddit faced similar issues.

After installing ports of Ruby for windows and working through tutorials, I ran into system errors that don’t show up with Ruby on MacOS or Linux.

Don’t make the same mistake as I did.

I want to keep Windows and still run Ruby / Ruby on Rails. The solution was to setup a virtual machine using VirtualBox.

I’ll show you how to do this.

Install VirtualBox

VirtualBox lets allows you to emulate Linux machines. Download and install it on your Windows system.

Download Linux Image

Why bother setting up a Linux machine from scratch when you can download a ready-to-go Linux system for Virtualbox.

I’m using Xubuntu 18.10 Cosmic from osboxes.org.

</figure>

Decompress the file (I use WinRAR). The image is over 5GB.  I create a folder for it and place it here.

</figure>

Setup VirtualBox

Open VirtualBox and click NEW.

</figure>

Select the folder where you placed the image file. Give the virtual machine a name.

</figure>

I prefer to set 2GB (2048MB) of RAM.

</figure>

Let’s use our existing virtual hard disk.  Add it. Click Choose.

![](https://paper-attachments.dropbox.com/s_B4F8639630B0FBC36DFABA0ACADCD708C18AE4C40D59D285D20FE9A240094838_1559598894814_2019-06-03_15-52-04.jpg)

Click Create.

</figure>

VirtualBox Settings

Let’s go to settings to make sure this machine uses 3D acceleration for better performance.

</figure>

Change the following:

  • Video Memory: 128MB
  • Enable 3D Acceleration

</figure>

Now start the machine.

</figure>

The system password is osboxes.org

Xubuntu asks if you want to upgrade to a newer version.  I don’t see a reason to upgrade. Notice that you don’t have a full screen. Let’s take care of that by installing Guest Additions.

Installing Guest Additions

Right click anywhere on the desktop and Open Terminal Here. Make sure you have an internet connection because we’ll be downloading packages.

</figure>

Don’t get intimidated by the command line screen.  We won’t be here too long.  We’ll need to update packages.
Run:

sudo apt-get update

Password is osboxes.org

</figure>

As you type the password, you’ll notice nothing is happening.  That’s normal.  Although you don’t see anything, the machine is receiving input.

Select Devices => Insert Guest Additions CD Image

</figure>

The CD image should automatically mount and a folder will come up. Drag autorun.sh on to the black terminal screen and hit ENTER to run it.

</figure>

It will ask you for the password again.  Also, say yes to removing an existing version of Virtual Additions.

</figure>

You should be able to maximize the screen and voila, it’s full screen!

Xubuntu has the taskbar on top. The user interface is fairly similar to windows.

</figure>

Allow clipboard sharing

I like to copy and paste commands from my host computer to my virtualbox machine. Let’s enable that.

Go to your VirtualBox settings.  General => Advanced.

  • Shared Clipboard: Bidirectional
  • Drag’n’Drop: Host To Guest

</figure>

Reboot the machine for effects to take place.

</figure>

Install git

Let’s install git first so that we can then clone applications from git. Open your terminal and run:

sudo apt-get install git

Install ASDF-VM Version Management

Using a version manager is critical if you plan on running different projects from GitHub. A project might not be compatible with the version of Ruby you have installed.

We need a way to switch between versions of Ruby without installing and uninstalling them every time.

See here on how to setup ASDF-VM version manager and then go to the next step.

Installing RubyMine and setting up a ruby environment

You’re going to need a text editor to write Ruby.  Although there are many options I prefer using a dedicated Ruby IDE such as RubyMine because it comes with debugging and autocomplete. Both are critical when learning a programming language.

Follow these steps to finish setting up RubyMine with a Ruby Environment

You now have a Linux environment that’s running in VirtualBox that also runs Ruby code. Happy developing.