Need Ruby on Ubuntu 18.04 in Windows Subsystem for Linux

2 minute read

Recently, I decided to unregister my existing Ubuntu 16.04 on Windows Subsystem for Linux (WSL) and start over again because I wanted to try upgrading it to Ubuntu 18.04 for this Getting Ubuntu distro environment on Windows for DevOps blog post.

After I have upgraded to Ubuntu 18.04, I tried to follow those steps again to obtain Ruby 2.4 to work with Jeykll from my previous Working with Ruby and Jekyll on Windows for GitHub Pages blog post and stumble on this Ruby installation issue.

Problem with Ruby 2.4 installation on Ubuntu 18.04

In this section, I will show you what is the issue that I have encountered with my Ubuntu 18.04 on Windows Subsystem for Linux (WSL).

To start off, I will display my Ubuntu version on WSL using the lsb_release -a bash command.

1
2
# Display Ubuntu version
lsb_release -a

If you have upgraded your Ubuntu on WSL to 18.04 version, you should obtain the following output below.

1
2
3
4
5
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

Next, I will follow the same command that I have used to install Ruby on Ubuntu 16.04 on WSL with the apt-get install bash command.

1
2
# Installing Ruby 2.4 on Ubuntu 18.04
sudo apt-get install ruby2.4 ruby2.4-dev build-essential dh-autoreconf

Once you executed the Ruby 2.4 package installation, you will obtain the following installation error message output like below.

1
2
3
4
5
6
7
8
9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby2.4
E: Couldn't find any package by glob 'ruby2.4'
E: Couldn't find any package by regex 'ruby2.4'
E: Unable to locate package ruby2.4-dev
E: Couldn't find any package by glob 'ruby2.4-dev'
E: Couldn't find any package by regex 'ruby2.4-dev'

Top


Remediating Ruby installation issue on Ubuntu 18.04

To remediate this Ruby installation issue on Ubuntu 18.04, you will need to install Ruby 2.5 instead.

1
2
3
# Installing Ruby 2.5 on Ubuntu 18.04
sudo apt-get update
sudo apt-get install ruby2.5 ruby2.5-dev build-essential dh-autoreconf

Top


Conclusion

What actually went wrong?

Well, there is nothing wrong with your Windows Subsystem for Linux (WSL). The actual problem is because Ruby 2.4 package is not available for Ubuntu 18.04 bionic and Ruby 2.5 is the recommended package instead.

To check if the package you are looking for is available for your Ubuntu version, visit the Ubuntu Packages Search site and search the package name.

If you find that this information useful, feel free to bookmark this or share it with your colleagues and friends.


Top


Reference


Top



Top