rod mclaughlinHow to Install Rails on Ubuntu (17 dec 08)
Are We Having Fun Yet?
Dec 17, 2008 The instructions at Ruby on Rails don't work (www.rubyonrails.org/down).
This is what I had to do. Your mileage may vary. First get Ubuntu Linux from releases.ubuntu.com. At the top of the monitor after installing and logging in to Ubuntu, you will see Applications. Click on that, then select Accessories...Terminal. In the terminal, type these commands:
sudo apt-get install ruby (enter password and answer Y to all questions) sudo apt-get install mysql-client-5.0 Then go to rubyforge.org/frs/?group_id=126 tar xvfz rubygems-xxx.tgz cd rubygems-xxx sudo apt-get install rdoc sudo ruby setup.rb Again, the instructions are wrong. Just doing 'ruby setup.rb' won't work. sudo mv /usr/bin/gem1.8 /usr/bin/gem cd .. sudo gem install rails --include-dependencies sudo apt-get install sqlite3 sudo apt-get install ruby1.8-dev sudo apt-get install libmysql-ruby1.8 sudo apt-get install libmysqlclient15-dev (that's a number fifteen in the middle) sudo gem install mysql sudo apt-get install mysql-server It will ask for a MySQL password it should use for user 'root'. It's a good idea to enter one, rather than just hitting enter, like I did.
sudo apt-get install build-essential Ubuntu then asked me to insert the Ubuntu CD! Luckily, I still had it. I thought only Windows did that!
sudo gem install mongrel sudo apt-get install sqlite3 swig libsqlite3-ruby libsqlite3-dev A hat-tip to blog.rubypdf.com/2006/10/20/install-ruby-on-rails-lighttpdsqlite3-and-mongrel-under-ubuntu/ sudo gem install sqlite3-ruby sudo apt-get install openssl sudo apt-get install libssl-dev sudo apt-get install libopenssl-ruby sudo apt-get install libssl0.9.8 Now I recommend going to fairleads.blogspot.com/ for detailed instructions on how to create a simple Rails app. The old Agile Web Development with Rails 2nd edition is out of date, and Rails 2 is incompatible with it. By the time you read this, the 3rd edition may be out. Ready? The next bit is more fun than the previous bit... rails example cd example rake db:create:all script/generate scaffold Movie title:string rake db:migrate script/server & (The & makes the Ruby web server run in the background so you can carry on using the terminal). Now point your browser at localhost:3000/movies and you should be able to click on 'New movie' to create a new movie in the database. Currently, Rails uses SQLITE for development. You probably want a grown-up database as well, so you might want to try MySQL. mysql -u root (enter password) mysql> create database movies_development; mysql> create database movies_test; mysql> create database movies_production; mysql> quit; Now edit the file database.yml in the config folder in your Rails app to look like this
login: &login adapter: mysql username: root password: host: localhost
<<: *login database: movies_development
<<: *login database: movies_test
<<: *login database: movies_production
fg then CONTROL-Cto stop the Rails server, restart it, and create the database in MySQL script/server & rake db:create:all rake db:migrate Got to localhost:3000/movies again and see if you can create a movie using MySQL. It sucks, doesn't it? Rails should be a lot easier to install than this. Like Perl modules. It should be possible to get up and running in Rails without being a sysadmin. Ruby's own package-management system, GEM, is pretty good, but Linux packages are a cluster. This page will get out of date pretty quickly (Ubuntu has already overtaken me) but I'm not going to maintain an install script for numerous versions of Ubuntu, let alone other operating systems. Somewhere out there there must be a geek who likes doing this kind of thing... Back
|