How To Install A Ruby 1.8 Stack on Ubuntu 8.10 From Scratch

Tháng Hai 28, 2009

Source: http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html

Want to install Ruby, RubyGems, and a collection of common gems on Ubuntu 8.10 (Intrepid Ibex) in just a few minutes? Here’s the skinny.

If you want, you could use something like Passenger-Stack to do the legwork for you, but I prefer doing manual installations so I know the full score. There are several “how to install Ruby on Ubuntu Intrepid” guides out there but none of them got it totally right for me. I’ve just used these instructions twice in a row so I know they work. Another bonus is you get ImageMagick and rmagick installed which some people get really frustrated with..

Note: These instructions assume you’re running as root for convenience. You can alternatively sudo every line or just run sudo bash until you’re done.

Install the system level basics

apt-get update
apt-get -y install build-essential zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev sqlite3 libsqlite3-dev locate git-core
apt-get -y install curl wget

Install ImageMagick (for rmagick)

apt-get -y install libmagick9-dev

Install Ruby 1.8 (MRI)

apt-get -y install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby
ln -s /usr/bin/ruby1.8 /usr/bin/ruby
ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
ln -s /usr/bin/irb1.8 /usr/bin/irb
ln -s /usr/bin/ri1.8 /usr/bin/ri

Note: Some advise not to use the packaged version of Ruby on Ubuntu due to its performance. I’m not worried about this. If you are, replace this section with a download of the Ruby source code (http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz) and untar, ./configure, make and make install it by hand. You’re on your own with that though.

Install RubyGems (from source)

curl http://de.mirror.rubyforge.org/rubygems/rubygems-1.3.1.tgz | tar -xzv
cd rubygems-1.3.1 && ruby setup.rb install
cd .. && rm -rf rubygems-1.3.1
ln -s /usr/bin/gem1.8 /usr/local/bin/gem
gem sources -a http://gems.github.com # add Github as a gem source, you won't regret it

Install a set of starter Ruby gems

gem install rake nokogiri hpricot builder cheat daemons json uuid rmagick sqlite3-ruby fastthread rack

What next?

By this point you now have Ruby installed with RubyGems, a collection of gems (including rmagick) and you can branch off where you want. If you want to develop a Sinatra app, install the sinatra gem and you’re away. If you want to install Rails, gem install rails. And so forth.

If you want to install Apache with Passenger for hosting your apps, however, read on..

Optional: Install Apache and Passenger

echo "deb http://apt.brightbox.net hardy main" > /etc/apt/sources.list.d/brightbox.list
wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -
apt-get update
apt-get -y install libapache2-mod-passenger

Note: Brightbox’s Passenger package is officially for Ubuntu 8.04 (Hardy) but it works fine on Intrepid in my experience.

If you need PHP5 as well:

apt-get -y install php5 libapache2-mod-php5 php5-mysql
/etc/init.d/apache2 restart

Optional: Need a very, very basic firewall?

apt-get -y install ufw
ufw allow to 0.0.0.0/0 port 80
ufw allow to 0.0.0.0/0 port 22 # (or whichever port you use for ssh)
ufw allow to 0.0.0.0/0 port 25 # (if you need mail in)
ufw enable

Note: You’re installing the firewall, not me, so don’t complain if you get locked out because of the firewall or something :) Ensure you have the correct ports and/or a console access to your server just in case (such as Linode supplies).

Một phản hồi to “How To Install A Ruby 1.8 Stack on Ubuntu 8.10 From Scratch”

  1. Mike said

    Just passing by.Btw, your website have great content!

    _________________________________
    Making Money $150 An Hour

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: