===== Installing Ruby on Rails on Debian/Ubuntu ===== In this tutorial you will install Ruby, RubyGems, and Rails on Debian/Ubuntu. ==== Install Ruby from repository ==== $ sudo apt-get install ruby-full build-essential ==== Install Ruby from source ==== Prerequisite packages: $ sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev checkinstall Download ruby sources: $ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz then $ tar xvzf stable-snapshot.tar.gz Compiling and installing $ cd ruby/ $ ./configure $ make $ sudo checkinstall Test installation $ ruby -v show something like: ruby 1.8.7p5000 (2009-02-22) [i686-linux] Test libraries $ ruby -ropenssl -rzlib -rreadline -e "puts :Hello" Will show: Hello {{:getting-started:installation:information.png|}}//Note//: to manage this type of installation you can use aptitude or apt-get. ==== Install RubyGems ==== Download the latest version of RubyGems at the [[http://rubyforge.org/frs/?group_id=126|Rubyforge RubyGems page]]. {{:getting-started:installation:stop.png|}}Rails 2.2.2 requires v1.3.1 or higher. $ cd ~ $ wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz $ tar xzvf rubygems-1.3.7.tgz $ cd rubygems-1.3.7 $ sudo ruby setup.rb $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem {{:getting-started:installation:information.png|}}//Note: It is possible to install RubyGems using apt-get. However, this is not recommended although you can still do it:// $ sudo apt-get install rubygems $ sudo gem install rubygems-update --version=1.3.7 $ sudo gem install rails $ rails --version Rails 2.3.5 {{:getting-started:installation:information.png|}}//Note: Ruby 1.9.1 comes with rubygems. // ==== Install Rails via RubyGems ==== Once RubyGems is installed, use it to install Rails: $ sudo gem install rails ==== Install MySQL DB server (optional) ==== By default, Rails includes the sqlite3 gem and is automatically configured to use it. To use MySQL instead, follow the following steps: $ sudo apt-get install mysql-server mysql-client $ sudo apt-get install libmysql-ruby libmysqlclient-dev $ sudo gem install mysql Rails assumes that the MySQL socket file will be found in /tmp/mysqld.sock. In Debian/Ubuntu, this is not the case. Be sure to change database.yml to reflect the actual location of the socket file: socket: '/var/run/mysqld/mysqld.sock' ==== Test your Rails installation ==== To test your Rails installation, generate a new Rails project: $ rails myrailsapp If you are using MySQL, use the following command: $ rails myrailsapp -d mysql ==== Deployment ==== Many popular web server configurations are available for Linux. Please see: * [[deployment/apache-mongrel|Apache + mongrel]] * [[deployment/apache-passenger|Apache + Passenger]] * [[deployment/nginx-mongrel|Nginx + mongrel]] * [[deployment/nginx-thin|Nginx + thin]]