Last active
January 2, 2021 14:48
-
-
Save hfase01/3444584 to your computer and use it in GitHub Desktop.
Installs ruby 1.9.3 from source instead of package or RVM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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
I still use RVM myself (comes in handy when I want to use JRuby or RBX), but this is pretty nice. Looks like it should also work with older versions of Ubuntu, at least as far back as Lucid (maybe even older than that).