Pages

Monday, January 28, 2008

Install Ruby on Rails

1) Install Ruby

sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby ruby1.8-dev

2) Install RubyGems via source (recommended):

For me, the below installed the gem executable to /usr/bin/gem1.8. I created a symbolic link so the rest of these commands will work: sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz
tar xzvf rubygems-1.0.1.tgz
cd rubygems-1.0.1
sudo ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem update --system

2)(alternate) Install RubyGems from ubuntu repository and update it (not recommended because apt-get will complain about files changed by gem update --system):

sudo apt-get install rubygems
sudo gem update --system

3) Install Rails and it's dependencies (with RubyGems)

sudo gem install rails -y

Here is a good time to install any gems you may need.

4) Create your first Rails app, as the current user (i.e., no sudo):

$ rails /path/to/new/railsapp

Of course, replace /path/to/new/railsapp with the path to the location where you'd like the source code for your new Rails application to exist. This can be /home/myhome/rails/myapp.


Reference: https://help.ubuntu.com/community/RubyOnRails

Getting strat PostgreSQL 8.2.6

Settings for PostgreSQL in Ubuntu 7.04 (Feisty Fawn)

1. create user
$ su -
# su - postgres
$ createuser husylvan
$ su - husylvan


2. create cluster
$ sudo pg_createcluster -u husylvan -d ~/pgdata 8.2 pgdata

*Configuration files(postgresql.conf, pg_hba.conf, and pg_ident.conf) are in /etc/postgresql/8.2/pgdata/

3. start PostgreSQL server
$ pg_ctlcluster 8.2 pgdata start


4. create database
$ createdb mydb


5. start PostgreSQL interactive terminal
$ psql mydb

* commands introduced by TA are in /usr/lib/postgresql/8.2/bin
** for ruby on rails
$ sudo gem install ruby-postgres -- --with-pgsql-include-dir=/usr/include/postgresql --with-pgsql-lib-dir=/usr/lib/postgresql/8.2/lib


Settings for PostgreSQL in Mac OS

1. download PostgreSQL 8.2.5 for Mac OS
http://www.postgresqlformac.com

2. install server only
double click PostgreSQL.mpkg in Server folder

3. it will be installed in /Library/PostgreSQL8

4. change postgres account password
sudo passwd postgres

5. create my account role in the db
su -m postgres -c 'createuser Hwal'

6. create db using Create Database icon in Applications/PostgreSQL folder

# for ruby on rails
$sudo gem install ruby-postgres -- \
--with-pgsql-include-dir=/Library/PostgreSQL8/include \
--with-pgsql-lib-dir=/Library/PostgreSQL8/lib

## other way (not recommended)
$ initdb -D ~/Documents/ClassDocs/cs186/pgdata
$ pg_ctl -D ~/Documents/ClassDocs/cs186/pgdata start
$ createdb depot_development
$ psql depot_development
% CREATE TABLE countries (
name char(20),
latitude int,
longitude int,
area int,
population int,
gdp int,
gdpYear int);

Tuesday, January 22, 2008

Eclipse Java debugging problem

To install proprietary Java, you must have the Multiverse repository enabled.

Ubuntu 7.04

  • Sun Java6: sun-java6-bin, sun-java6-jre

sudo apt-get install sun-java6-bin sun-java6-jre
Now you need to open Eclipse and specify that the default workspace JRE
should be SUNs JRE. Go to Window - Preferences - Java - Installed JREs
and click add to add SUN JRE.
The JRE home directory is: /usr/lib/jvm/java-6-sun