Skip to content

Instantly share code, notes, and snippets.

@hfase01
Last active January 2, 2021 14:48
Show Gist options
  • Save hfase01/3444584 to your computer and use it in GitHub Desktop.
Save hfase01/3444584 to your computer and use it in GitHub Desktop.
Installs ruby 1.9.3 from source instead of package or RVM.
#!/bin/sh
#########
## This script simply installs Ruby 1.9+ from source,
## eliminating the need for RVM or strange packaged versions.
##
## To run this script right from GitHub use the following command.
## **RUN THIS AS ROOT**
##
## ~$ curl https://gist.github.com/hfase01/3444584/raw/ruby.sh | sh
##########
## Options
# Set your Ruby version here, must be >1.9.
RUBY=ruby-1.9.3-p194
## Work
# Set verbose, so you can see what is going on.
set -o verbose
# Install dependant files for Ruby.
sudo apt install -fy build-essential openssl curl git-core zlib1g \
zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \
ncurses-dev automake libtool bison subversion pkg-config \
### libreadline6 libreadline6-dev
# Install packages so Ruby can use MySql or Postgresql DB, that way bundle install without error. ;)
sudo apt install -fy libmysql-ruby libmysqlclient-dev postgresql libpq-dev
# Clean things up with apt
sudo apt update
sudo apt upgrade -fy
sudo apt autoclean -fy
sudo apt autoremove -fy
sudo apt clean -fy
# The jewels bro, make them bling.
wget http://ftp.ruby-lang.org/pub/ruby/1.9/$RUBY.tar.gz
tar xfvz $RUBY.tar.gz
cd $RUBY
./configure
make
sudo make install
# Check for old busted rubygem versions.
if [ "$(gem --version)" -lt "1.8.23" ]; then
curl http://ftp.us.debian.org/debian/pool/main/r/rubygems/rubygems_1.8.24-1_all.deb -O rubygems.deb \
&& sudo dpkg -i rubygems.deb
fi
# Get ready to bundle!
sudo gem install bundler --no-ri --no-rdoc
exit 0
@hfase01
Copy link
Author

hfase01 commented Aug 28, 2012

I am setting up some VM's that I only need one Ruby on (and the ability to run as a Root service) so I decided to put this together. If those packages are fine for almost all Ubuntu Distributions I will try to do a condition for RPM based distro's instead. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment