Ruby-on-Rails

Linux Subsystem Rails – off the ground

So I really fucked up the installation of this the first 2 or 4 times that I attempted to install this. The last time I attempted to do this I remember installing RVM (Ruby Version Manager) through apt and I was off and going. This did not work out so well this time. I was plagued by gem install failures curl failures and some serious fuckery. So instead of continuing down the same shitty path I turned to google for guidance.

After some google-fu I was able to find another way to get this off the ground. Here are the steps I had to take to get this up and running

sudo -s
apt update
apt install make gcc
apt-add-repository ppa:brightbox/ruby-ng
apt update
apt install ruby2.3 ruby2.3-dev ruby-switch
ruby-switch --set ruby2.3
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
apt install sqlite3 libsqlite3-dev
apt install zlibc zlib1g-dev libxml2 libxml2-dev libxslt1.1 libxslt1-dev
gem install nokogiri -- --use-system-libraries
gem install bundler
gem install rails --pre  #this took forever so don't be alarmed if it seems hung

Time to test!

#to test the install create an application
# I'm going to create a directory to put all of my rails apps in
mkdir /home/lucas/railsapps
cd /home/lucas/railsapps

#next you need to exit root or you'll be plagued by permissions issues
#to create a new application type this
rails new testapp

#Next step is testing teh new app
cd testapp
rails server # this command starts the server, however, this actually failed for me with an error for Inotify 
#I had to comment out the 2nd to last line in /home/lucas/rails/testapp/config/environments/development.rb
#it started with  'config.file_watcher'
#do this and start the application again
#then open your browser and go to http://localhost:3000 you should get a nice web-page saying it was successfully installed