Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

Install vmware tools on ubuntu

Install vmware tools tar file on ubuntu from http://www.howtogeek.com/howto/ubuntu/install-vmware-tools-on-ubuntu-edgy-eft/
The first thing that is important is that you will need to know is
that you have to install the compilation utilities, which aren't
installed by default. Run these commands to get you started:

sudo apt-get install build-essential
sudo apt-get install linux-headers-`uname -r`


Now you'll want to navigate to the VM \ Install VMware Tools menu:

cp /cdrom/*.gz /tmp/
cd /tmp
tar xvzf VM*.gz
cd vmware*
sudo ./vmware-install.pl

Setting up Ruby On Rails with PostgreSQL on Mac OS X 10.4.9

This is a modified version of the Ruby on Rails Tutorial (TutorialStepOne, TutorialStepOnePostgresql, ...).

Log in to an admin user account and, if necessary, fix your command search path in $HOME/.bash_profile, $HOME/.bash_login or $HOME/.profile to include "/usr/local" and "/usr/local/sbin" (cf. Using /usr/local > Set The Path; echo $PATH | tr ":" "\n"). If there are no such files, just create them: touch $HOME/.bash_login && touch $HOME/.bashrc (ls -a | grep \.bash).

To avoid RubyGems loading issues it's no bad idea to add export RUBYOPT=rubygems to your $HOME/.bash_login file as well.

If you want your system path changes to take effect not only for you you can modify the global system path settings in the systemwide initialization files /private/etc/profile and /private/etc/bashrc accordingly.

To fix the paths of installed manual pages add the lines "MANPATH /usr/local/share/man" and "MANPATH /usr/local/man" to sudo nano +45 /usr/share/misc/man.conf (man -w | tr ":" "\n").


(USE THE FOLLOWING AT YOUR OWN RISK!)


REQUIREMENTS:

I. Xcode


II. PostgreSQL Database Server

Install this PostgreSQL Database Server package.

# test after installation
which psql     # /usr/local/bin/psql
psql --version     # psql (PostgreSQL) 8.2.3, contains support for command-line editing


Alternative installation: Getting PostgreSQL running for Rails on a Mac


III. Ruby 1.8.6, Ruby On Rails 1.2.3 & Mongrel 1.0.1

Building Ruby, Rails, Subversion, Mongrel, and MySQL on Mac OS X

To install both Mongrel & Mongrel Cluster use: sudo gem install -y mongrel mongrel_cluster (cf. Using Mongrel Cluster).

# test after installation
ruby -v     # ruby 1.8.6
rails -v     # Rails 1.2.3
gem list     # ... mongrel (1.0.1) ...



IV. ruby-postgres 0.7.1
sudo gem install -y ruby-postgres



As an alternative you may try Ruby on rails installer script for Mac OSX or choose to install via MacPorts as described in Installing Ruby on Rails and PostgreSQL on OS X, Second Edition or Installing Rails on Mac OS X Tiger (10.4.8). However, you then may have to change your system paths mentioned above accordingly.


1. create a database server


# first create a directory called PostgreSQL-db on your Desktop
mkdir -p $HOME/Desktop/PostgreSQL-db

# create a new db server called railsdb
/usr/local/bin/initdb -E UTF8 -D $HOME/Desktop/PostgreSQL-db/railsdb

# START DB SERVER
dir="$HOME/Desktop/PostgreSQL-db"; /usr/local/bin/pg_ctl -D $dir/railsdb -l $dir/railsdb/postgres.log start

# STOP DB SERVER
#dir="$HOME/Desktop/PostgreSQL-db"; /usr/local/bin/pg_ctl -D $dir/railsdb -l $dir/railsdb/postgres.log stop -m smart

# check
cat $HOME/Desktop/PostgreSQL-db/railsdb/pg_hba.conf

   ...
   # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

   # "local" is for Unix domain socket connections only
   local   all         all                               trust
   # IPv4 local connections:
   host    all         all         127.0.0.1/32          trust
   # IPv6 local connections:
   host    all         all         ::1/128               trust



2. create PostgreSQL database


createdb `whoami`_development
#dropdb `whoami`_development

createdb `whoami`_test
#dropdb `whoami`_test

#createdb `whoami`_production
#dropdb `whoami`_production



3. set up your Rails project


cd $HOME/Desktop/RubyOnRails-projects
rails -d postgresql `whoami`
cd `whoami`



4. edit /config/database.yml


open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/config/database.yml

# just uncomment the following line
#encoding: UTF8 



5. make Rails & PostgreSQL work together


cd $HOME/Desktop/RubyOnRails-projects/`whoami`

ruby script/generate migration People

# edit /db/migrate/001_people.rb
# cf. http://wiki.rubyonrails.org/rails/pages/TutorialStepOneMigrations

open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/db/migrate/001_people.rb

 class People < ActiveRecord::Migration

    def self.up
      create_table :people do |table|
      # note that "id" is added implicitly, by default
        table.column :name, :string
        table.column :street1, :string
        table.column :street2, :string
        table.column :city, :string
        table.column :state, :string
        table.column :zip, :string
     end
    end

    def self.down
      drop_table :people 
    end
  end



rake db:migrate

ruby script/generate model Person  

#open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/app/models/person.rb  # file will be explained below

ruby script/console

>> ...
        entry = Person.new
        entry.name = "Name" 
        entry.street1 = "123 Somwhere" 
        entry.street2 = "" 
        entry.city = "Smallville" 
        entry.state = "KS" 
        entry.zip = "123456" 
        entry.save
        exit


# check newly created db table

psql `whoami`_development
SELECT * FROM people;
\q


# test
rake      # ... 0 failures, 0 errors

# create new controller
ruby script/generate controller People list view new edit


# edit /app/controllers/people_controller.rb
open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/app/controllers/people_controller.rb

  def view
   @person = Person.find(1)
  end



# edit /app/views/people/view.rhtml
open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/app/views/people/view.rhtml

# copy & paste & uncomment the following lines

#<html>
#  <body>
#    <h1>People#view</h1>
#    <p>This page will display one person.</p>
#    <p>
#    <%= @person.name %><br />
#    <%= @person.street1 %><br />
#    <%= @person.street2 %><br />
#    <%= @person.city %><br />
#    <%= @person.state %><br />
#    <%= @person.zip %><br />
#    </p>
#  </body>
#</html>


# the file /app/models/person.rb explained (see above)
# open -e $HOME/Desktop/RubyOnRails-projects/`whoami`/app/models/person.rb

# class Person < ActiveRecord::Base
# end

# How does this know to map to the people table we created? ActiveRecord pluralizes the class name and looks for that 
# table in the database. This doesn’t just mean adding an ’s’. Irregular plural forms are also handled, so Rails knows 
# that the plural of ‘person’ is ‘people’. The rules for how it does this are described in the documentation
# (see http://wiki.rubyonrails.org/rails/pages/TutorialStepSix).

# test
rake

# start your Rails app
cd $HOME/Desktop/RubyOnRails-projects/`whoami`

ruby script/server
#ruby script/server --environment=development

# open a second shell window and go to ...  
open -a Safari http://localhost:3000/people/view


DB2 Manual Installation on Linux

Install

* Login as root.
* Create groups:
o groupadd -g 999 db2iadm1
o groupadd -g 998 db2fadm1
o groupadd -g 997 dasadm1

* Create users for each group:
o useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1
o useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
o useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1

* Set password for each users created:
o passwd db2inst1
o passwd db2fenc1
o passwd dasusr1

* cd to installation file directory:
o Example: /tmp/db2/exp/disk1

* Run installation script:
o ./db2_install.sh

Post Install

* Login as root.
* Install license (example):
o /opt/ibm/db2/V9.1/adm/db2licm –a /tmp/db2/exp/disk1/db2/license/db2exp_uw.lic

Create the DB2 Administration Server (DAS)

* Login as root.
* Create DAS with dasusr1
o /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1

* Login as dasuser1
o Start the DAS: db2admin start

* Optional: to enable autostarting of the DAS upon reboot
o /opt/ibm/db2/V9.1/instance/dascrt/dasauto –on

Create DB2 instance

* Login as root.
* Create instance with users db2fenc1 and db2inst1:
o /opt/ibm/db2/V9.1/instance/db2icrt -a server -u db2fenc1 db2inst1
* Optional: enable autostarting of the db2inst1 instance
o /opt/ibm/db2/V9.1/instance/db2iauto –on db2inst1

Update environment variables

* Example:
* Login as db2inst1
* edit .bash_profile
o vi /home/db2inst1/.bash_profile
o insert the following line at the end of the file – “. /home/db2inst1/sqllib/db2profile”

* Do the same for dasusr1, using its corresponding directory.

Database service

* Login as root:
* Add new service entry:
o vi etc/services
o insert this line “DB2_TMINST 50000/tcp” at the end of the file

Verification

* Login as db2inst1
* List installed DB2 products and features: db2ls
* Display the default instance: db2 get instance
o Result: The current database manager instance is: db2inst1
* Start the database instance: db2start
o Result: SQL1063N DB2START processing was successful.
* Stop the database instance: db2stop
o Result: SQL1064N DB2STOP processing was successful.

Quickly download the PEAR libraries

To get a headstart for your website you can use the PEAR libraries. The following script downloads a couple of the most handy libraries, and also adds some symbolic links to the newly downloaded files.

#!/bin/bash
pear config-create $HOME $HOME/.pearrc
pear config-set php_dir $HOME/pear/lib

pear install -a PEAR

pear channel-update pear.php.net
pear install -a DB Mail
pear install -o Auth Auth_SASL Cache_Lite File
pear install -o HTML_QuickForm HTML_TreeMenu
pear install -o HTTP HTTP_Request
pear install -o Mail_Mime
pear install -o Log Pager
pear install -o Translation2-beta XML_Serializer-beta

ln -s ~/pear/pear ~/bin/pear
ln -s ~/pear/peardev ~/bin/peardev
ln -s ~/pear/pecl ~/bin/pecl
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS