Many of us still support old software for several reasons. This is my case as my major project is still running on Ruby 1.8.7, from 2008, and on Ruby on Rails 2.3.18, from 2013. While its update to modern versions of Ruby and Rails is in progress, I still have to be able to configure a proper development environment for it as it is. If this is your case, this post is for you.
In this tutorial I will show you a few tips on configuring a WSL-based development environment, without containerization, for old Ruby software. The operating system of choice is Ubuntu Server 18.04 LTS (Ubuntu Server 20.04 LTS does not have the required version of libssl).
First, let’s configure the environment variables necessary to make MySQL and Rails think they are in a full Linux desktop:
echo "export RUNLEVEL=2" >> /etc/profile echo "export LC_ALL=C.UTF-8" >> /etc/profile echo "export LANG=en_US.UTF-8" >> /etc/profile echo "export LANGUAGE=en_US.UTF-8" >> /etc/profile echo "export HOST=localhost" >> /etc/profile source /etc/profile
Now, let’s install the packages necessary for running MySQL and RVM:
apt-add-repository -y ppa:rael-gc/rvm && apt-get update apt-get upgrade -y --no-install-recommends software-properties-common curl dkms build-essential linux-headers-generic git zip unzip gnupg2 libxml2-dev libxslt-dev mysql-server mysql-client libmysqlclient-dev rvm
Ok, so far so good. Now, let’s finish RVM’s installation and install Ruby 1.8.7 and Ruby on Rails 2.3.18:
source /etc/profile.d/rvm.sh echo "gem: --no-ri --no-rdoc" > ~/.gemrc rvm install ruby-1.8.7-p374 rvm use ruby-1.8.7-p374 gem update --system 1.4.2 rvm use @global && gem uninstall rake gem install rake -v=0.8.7 sudo apt-get install -y --no-install-recommends mysql-client libmysqlclient-dev gem install mysql gem install rails -v=2.3.18
Yes, the MySQL’s client was installed again. That’s because when we ran “rvm install ruby-1.8.7-p374”, RVM downgraded the current (newer) libssl to the older one Ruby 1.8.7 is compatible. This removed the MySQL’s client because it depends on the newer version of libssl. After installing Ruby, we reinstalled the MySQL’s client and, therefore, the newer version of libssl. I know this is not optimal, but, at least in my case, is enough for a simple development environment.
This is it! You should have a working WSL-based development environment with MySQL, Ruby 1.8.7 and Ruby on Rails 2.3.18.