It's assumed you use RVM with Ruby 1.9.2
luan@luan-Latitude-D430:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
luan@luan-Latitude-D430:~$ rvm 1.9.2 --passenger
NOTE: If you are using Passenger 3 you no longer need the passenger_ruby,
use the wrapper script for your ruby instead (see 'rvm wrapper')
luan@luan-Latitude-D430:~$ rvm 1.9.2
luan@luan-Latitude-D430:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
luan@luan-Latitude-D430:~$ gem install passenger
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions. This could take a while...
Fetching: daemon_controller-0.2.6.gem (100%)
Fetching: spruz-0.2.5.gem (100%)
Fetching: file-tail-1.0.5.gem (100%)
Fetching: passenger-3.0.5.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-0.2.6
Successfully installed spruz-0.2.5
Successfully installed file-tail-1.0.5
Successfully installed passenger-3.0.5
5 gems installed
Installing ri documentation for fastthread-1.0.7...
Installing ri documentation for daemon_controller-0.2.6...
Installing ri documentation for spruz-0.2.5...
Installing ri documentation for file-tail-1.0.5...
Installing ri documentation for passenger-3.0.5...
Installing RDoc documentation for fastthread-1.0.7...
Installing RDoc documentation for daemon_controller-0.2.6...
Installing RDoc documentation for spruz-0.2.5...
Installing RDoc documentation for file-tail-1.0.5...
Installing RDoc documentation for passenger-3.0.5...
luan@luan-Latitude-D430:~$
luan@luan-Latitude-D430:~$rvmsudo passenger-install-nginx-module
http://github.com/jnstq/rails-nginx-passenger-ubuntu
luan@luan-Latitude-D430:~$cd
luan@luan-Latitude-D430:~$git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
luan@luan-Latitude-D430:~$sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
luan@luan-Latitude-D430:~$sudo chown root:root /etc/init.d/nginx
To do next:
luan@luan-Latitude-D430:~$ cd to-your-rails-app-folder
luan@luan-Latitude-D430:~$bundle install
luan@luan-Latitude-D430:~$rake db:setup RAILS_ENV=production
luan@luan-Latitude-D430:~$sudo /etc/init.d/nginx restart
Tuesday, March 22, 2011
Saturday, March 12, 2011
Install chromium on Linux Mint 10
1. open terminal
2. sudo add-apt-repository ppa:chromium-daily/stable
3. sudo apt-get update
4. sudo apt-get install chromium-browser
2. sudo add-apt-repository ppa:chromium-daily/stable
3. sudo apt-get update
4. sudo apt-get install chromium-browser
Tuesday, March 1, 2011
Install Git on Ubuntu 10.10
I am working on a project, and I would like to have a repository to keep my code.
After looking around cvs, svn and git, I finally would like to try out git.
You can read more about git. It's a free online book
http://progit.org/
Sever Install
server
$sudo apt-get install git-core
$sudo apt-get install gitolite
$sudo apt-get install git-daemon-run
Add a user to the server.
In order for you to access into the server without enter the password, you need to setup ssh key authentication.
Here is an example on how to generate ssh key. If you already have ssh key authentication, you may skip this step.
client
$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gituser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gituser/.ssh/id_rsa.
Your public key has been saved in /home/gituser/.ssh/id_rsa.pub.
The key fingerprint is:
61:bf:f5:2d:f6:ed:cd:10:b7:0c:be:5d:4d:8f:a3:0d gituser@client
When you are done, copy this key into the server. From your client, scp into your server as below.
client
$scp /home/gituser/.ssh/id_rsa.pub user@gitserver:/tmp/gituser.pub
Now you need to go back to the gitserver and add this key to git:
server
$chmod 666 /tmp/gituser.pub
$su gitolite
$gl-setup /tmp/gituser.pub
You have added a user to the git server.
Client configuration
You may config your git in the configuration. I encourage you to read chapter 1 and chapter 2 from http://progit.org/
client
$git config --global user.name "firstname lastname"
$git config --global user.email email@email.com
Adding a repository to your new git server
Now we may setup a test repository.
For us to do this, we need first check out the gitolite-admin repository from the git server
and edit the configuration file and then check it back in.
client
$git clone gitolite@server:gitolite-admin
$cd gitolite-admin/
$vi conf/gitolite.conf
This file should already contain a couple of repositories:
client
repo gitolite-admin
RW+ = gituser
repo testing
RW+ = @all
You may add a new project into the file. I copy the "testing" and paste to new line and modify as below:
client
repo mytest
RW+ = gituser
Save that file, and we can then commit it back to the server:
client
$git commit -m "Added mytest repo" conf/gitolite.conf
$git push
You should see output like the following, this creates the repository on the git server:
client
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 398 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
Already on 'master'
creating mytest...
Initialized empty Git repository in /var/lib/gitolite/repositories/mytest.git/
To gitolite@gitserver:gitolite-admin
610d463..98a9226 master -> master
Now that we have a new repository, we can clone it to our local client system and add files to it:
client
$cd
$git clone gitolite@gitserver:mytest
$cd mytest
$echo “This is a test” > readme.txt
$git add .
$git commit -m "Initial checkin of readme.txt"
$git push origin master
To test it, you can go ahead a delete entire direcotry, and clone it back.
Here are some good references:
1. http://help.github.com/git-cheat-sheets/
2. http://www-cs-students.stanford.edu/~blynn/gitmagic/
After looking around cvs, svn and git, I finally would like to try out git.
You can read more about git. It's a free online book
http://progit.org/
Sever Install
server
$sudo apt-get install git-core
$sudo apt-get install gitolite
$sudo apt-get install git-daemon-run
Add a user to the server.
In order for you to access into the server without enter the password, you need to setup ssh key authentication.
Here is an example on how to generate ssh key. If you already have ssh key authentication, you may skip this step.
client
$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gituser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gituser/.ssh/id_rsa.
Your public key has been saved in /home/gituser/.ssh/id_rsa.pub.
The key fingerprint is:
61:bf:f5:2d:f6:ed:cd:10:b7:0c:be:5d:4d:8f:a3:0d gituser@client
When you are done, copy this key into the server. From your client, scp into your server as below.
client
$scp /home/gituser/.ssh/id_rsa.pub user@gitserver:/tmp/gituser.pub
Now you need to go back to the gitserver and add this key to git:
server
$chmod 666 /tmp/gituser.pub
$su gitolite
$gl-setup /tmp/gituser.pub
You have added a user to the git server.
Client configuration
You may config your git in the configuration. I encourage you to read chapter 1 and chapter 2 from http://progit.org/
client
$git config --global user.name "firstname lastname"
$git config --global user.email email@email.com
Adding a repository to your new git server
Now we may setup a test repository.
For us to do this, we need first check out the gitolite-admin repository from the git server
and edit the configuration file and then check it back in.
client
$git clone gitolite@server:gitolite-admin
$cd gitolite-admin/
$vi conf/gitolite.conf
This file should already contain a couple of repositories:
client
repo gitolite-admin
RW+ = gituser
repo testing
RW+ = @all
You may add a new project into the file. I copy the "testing" and paste to new line and modify as below:
client
repo mytest
RW+ = gituser
Save that file, and we can then commit it back to the server:
client
$git commit -m "Added mytest repo" conf/gitolite.conf
$git push
You should see output like the following, this creates the repository on the git server:
client
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 398 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
Already on 'master'
creating mytest...
Initialized empty Git repository in /var/lib/gitolite/repositories/mytest.git/
To gitolite@gitserver:gitolite-admin
610d463..98a9226 master -> master
Now that we have a new repository, we can clone it to our local client system and add files to it:
client
$cd
$git clone gitolite@gitserver:mytest
$cd mytest
$echo “This is a test” > readme.txt
$git add .
$git commit -m "Initial checkin of readme.txt"
$git push origin master
To test it, you can go ahead a delete entire direcotry, and clone it back.
Here are some good references:
1. http://help.github.com/git-cheat-sheets/
2. http://www-cs-students.stanford.edu/~blynn/gitmagic/
Sunday, February 6, 2011
crontab doesn't work with ruby rvm
I am using RVM ruby, and crontab doesn't work properly.
crontab doesn't look at .bashrc or .bash_profile. Therefore, we have to add this into
sudo vi /etc/profile. Just source whatever in profile.
luan@luan-laptop:/etc$ head profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
# luan added here
source /home/luan/.bash_profile
# end luan added
if [ -d /etc/profile.d ]; then
crontab doesn't look at .bashrc or .bash_profile. Therefore, we have to add this into
sudo vi /etc/profile. Just source whatever in profile.
luan@luan-laptop:/etc$ head profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
# luan added here
source /home/luan/.bash_profile
# end luan added
if [ -d /etc/profile.d ]; then
Thursday, January 27, 2011
SSH without enter password
Step 1 of 2 : On local machine: Generate Authentication Keys
$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/luan/.ssh/id_rsa):
Accept the default choice. Hit enter.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Hit enter twice. A passphrase encrypts your private key so that no one can see it. However, you should NOT encrypt your private key if you want a password-less login.
The key fingerprint is:
5e:26:52:34:a1:22:18:68:11:11:7d:8d:c6:d5:4b:bf luan@luan.com
What just happened?
On your local server you just created 2 files in your ~/.ssh directory.
cd ~/.ssh
ls -l
-rw------- 1 luan luan 1675 2011-01-27 17:27 id_rsa
-rw-r--r-- 1 luan luan 411 2011-01-27 17:27 id_rsa.pub
id_rsa contains your private key. id_rsa.pub contains your public key.
Step 2 of 2 : On remote machine: authorize password less login
Login to remote machine
$ssh hostname -l username
The authenticity of host 'luan.com (XXX.XXX.XXX.XX)' can't be established.
RSA key fingerprint is 44.2b:93:ce:1b:1b:99:3a:6d:91:d1:50:aa:0d:87:40.
Are you sure you want to continue connecting (yes/no)?
Type yes and hit enter.
Warning: Permanently added 'luan.com,XXX.XXX.XXX.XX' (RSA) to the list of known hosts.
username@luan.com's password:
Enter your password, and hit enter.
Create a .ssh directory on the remote machine and create a .authorized_keys file in that directory. You need to copy the entire contents of your local machine’s ‘id_rsa.pub’ and paste it in the .authorized_keys file on the remote server.
$mkdir -p .ssh
$chmod 700 .ssh
$cd .ssh
$touch authorized_keys
$chmod 600 authorized_keys
$vi authorized_keys
# copy-paste the entire contents of your local machine's ~/.ssh/id_rsa.pub file in authorized_keys
# logout
exit
Important: Make sure you have the right permissions for .ssh directory and authorized_keys file, as shown in chmod command above otherwise SSH will not honor your authorized_keys.
You should now be able to login to the remote server without typing your password.
# type this command from your local machine
$ssh hostname -l username
SSH should log you in without password! Now, you can also scp or rsync (over ssh) without having to enter your password.
$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/luan/.ssh/id_rsa):
Accept the default choice. Hit enter.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Hit enter twice. A passphrase encrypts your private key so that no one can see it. However, you should NOT encrypt your private key if you want a password-less login.
The key fingerprint is:
5e:26:52:34:a1:22:18:68:11:11:7d:8d:c6:d5:4b:bf luan@luan.com
What just happened?
On your local server you just created 2 files in your ~/.ssh directory.
cd ~/.ssh
ls -l
-rw------- 1 luan luan 1675 2011-01-27 17:27 id_rsa
-rw-r--r-- 1 luan luan 411 2011-01-27 17:27 id_rsa.pub
id_rsa contains your private key. id_rsa.pub contains your public key.
Step 2 of 2 : On remote machine: authorize password less login
Login to remote machine
$ssh hostname -l username
The authenticity of host 'luan.com (XXX.XXX.XXX.XX)' can't be established.
RSA key fingerprint is 44.2b:93:ce:1b:1b:99:3a:6d:91:d1:50:aa:0d:87:40.
Are you sure you want to continue connecting (yes/no)?
Type yes and hit enter.
Warning: Permanently added 'luan.com,XXX.XXX.XXX.XX' (RSA) to the list of known hosts.
username@luan.com's password:
Enter your password, and hit enter.
Create a .ssh directory on the remote machine and create a .authorized_keys file in that directory. You need to copy the entire contents of your local machine’s ‘id_rsa.pub’ and paste it in the .authorized_keys file on the remote server.
$mkdir -p .ssh
$chmod 700 .ssh
$cd .ssh
$touch authorized_keys
$chmod 600 authorized_keys
$vi authorized_keys
# copy-paste the entire contents of your local machine's ~/.ssh/id_rsa.pub file in authorized_keys
# logout
exit
Important: Make sure you have the right permissions for .ssh directory and authorized_keys file, as shown in chmod command above otherwise SSH will not honor your authorized_keys.
You should now be able to login to the remote server without typing your password.
# type this command from your local machine
$ssh hostname -l username
SSH should log you in without password! Now, you can also scp or rsync (over ssh) without having to enter your password.
Install Postgresql 9.0 on Ubuntu 10.10
Install Postgresql 9.0 Ubuntu
sudo apt-get install python-software-propertie
s
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.0 libpq-dev
sudo -u postgres psql
Once logged in to the SQL interface, set a password for the postgres role:
ALTER ROLE postgres WITH ENCRYPTED PASSWORD 'mypassword';
You need this password to connect to the PostgreSQL server remotely with the postgres role, as described below.
To exit the PostgreSQL shell, type:
\q
sudo apt-get install python-software-propertie
s
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.0 libpq-dev
sudo -u postgres psql
Once logged in to the SQL interface, set a password for the postgres role:
ALTER ROLE postgres WITH ENCRYPTED PASSWORD 'mypassword';
You need this password to connect to the PostgreSQL server remotely with the postgres role, as described below.
To exit the PostgreSQL shell, type:
\q
Saturday, July 31, 2010
Install RVM system wide on Ubuntu Server
1: Install git if you don't already have it
$ sudo apt-get install git-core
2: Download RVM
$ sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )
This creates /usr/local/rvm and the group 'rvm'
3: Add each user to group rvm
$ sudo usermod -aG rvm ubuntu
4: Add startup lines to each user's .profile
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'
5: Add this line to /etc/rvmrc (may not be necessary)
$ echo "export rvm_path=/usr/local/rvm" > /etc/rvmrc
6: Use rvm as a user - best to logout/login first to make sure you get all the paths etc setup
$ rvm list
$ rvm package install zlib ( I needed this to get install to work )
$ rvm install 1.9.2 --with-zlib-dir=/usr/local/rvm/usr
To set default ruby version
$rvm --default use 1.9.2
$ sudo apt-get install git-core
2: Download RVM
$ sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )
This creates /usr/local/rvm and the group 'rvm'
3: Add each user to group rvm
$ sudo usermod -aG rvm ubuntu
4: Add startup lines to each user's .profile
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'
5: Add this line to /etc/rvmrc (may not be necessary)
$ echo "export rvm_path=/usr/local/rvm" > /etc/rvmrc
6: Use rvm as a user - best to logout/login first to make sure you get all the paths etc setup
$ rvm list
$ rvm package install zlib ( I needed this to get install to work )
$ rvm install 1.9.2 --with-zlib-dir=/usr/local/rvm/usr
To set default ruby version
$rvm --default use 1.9.2
Thursday, July 22, 2010
RVM with Ubuntu 10.4
1. install ruby lib:
sudo apt-get install curl git-core bison build-essential zlib1g-dev libssl-dev libreadline6-dev libxml2-dev autoconf libxslt1-dev libpq-dev postgresql
2. install rvm
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
3. extra check
mkdir -p ~/.rvm/src/ && cdm ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
4. add this line very end of your profile(.bash_profile)
# this is for rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
5. to install ruby 1.9.1
rvm install 1.9.1 ; rvm 1.9.1
sudo apt-get install curl git-core bison build-essential zlib1g-dev libssl-dev libreadline6-dev libxml2-dev autoconf libxslt1-dev libpq-dev postgresql
2. install rvm
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
3. extra check
mkdir -p ~/.rvm/src/ && cdm ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
4. add this line very end of your profile(.bash_profile)
# this is for rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
5. to install ruby 1.9.1
rvm install 1.9.1 ; rvm 1.9.1
Wednesday, April 21, 2010
Install ruby-oci8 on Ubuntu
gzip -dc ruby-oci8-2.0.4.tar.gz | tar xvf -
cd ruby-oci8-2.0.4
make
make install
* When I issue command: sudo make install
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo make install
ruby -w setup.rb install
make: ruby: Command not found
make: *** [install] Error 127
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
Permission denied - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8.rb
Try 'ruby setup.rb --help' for detailed usage.
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo ruby -w setup.rb install
sudo: ruby: command not found
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo /opt/ruby/bin/ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
---> lib/dbd
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
install OCI8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
<--- lib/dbd
---> lib/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding.yml /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding-init.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install object.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install bindtype.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install datetime.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install metadata.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install compat.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oracle_version.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
<--- lib/oci8
<--- lib
---> ext
---> ext/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
install oci8lib_191.so /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
<--- ext/oci8
<--- ext
----------------------------------------------------------------------------------
I can't install ruby-oci8 on Ubuntu 104 using:
sudo gem install ruby-oci8
luan@luan-laptop:~/app/software/ruby/dev$ sudo /opt/ruby/bin/gem install ruby-oci8
[sudo] password for luan:
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
/opt/ruby-1.9.1-p376/bin/ruby extconf.rb
checking for load library path...
LD_LIBRARY_PATH is not set.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/ruby-1.9.1-p376/bin/ruby
--with-instant-client
--without-instant-client
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home': RuntimeError (RuntimeError)
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
from extconf.rb:18:in `'
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
The 'sudo' command unset some environment variables for security reasons.
Pass required varialbes as follows
sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/ruby/bin/gem install ruby-oci8
or
sudo env ORACLE_HOME=$ORACLE_HOME /opt/ruby/bin/gem install ruby-oci8
Backtrace:
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
extconf.rb:18:in `'
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html
Gem files will remain installed in /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4 for inspection.
Results logged to /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/gem_make.out
cd ruby-oci8-2.0.4
make
make install
* When I issue command: sudo make install
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo make install
ruby -w setup.rb install
make: ruby: Command not found
make: *** [install] Error 127
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
Permission denied - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8.rb
Try 'ruby setup.rb --help' for detailed usage.
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo ruby -w setup.rb install
sudo: ruby: command not found
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo /opt/ruby/bin/ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
---> lib/dbd
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
install OCI8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
<--- lib/dbd
---> lib/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding.yml /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding-init.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install object.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install bindtype.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install datetime.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install metadata.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install compat.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oracle_version.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
<--- lib/oci8
<--- lib
---> ext
---> ext/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
install oci8lib_191.so /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
<--- ext/oci8
<--- ext
----------------------------------------------------------------------------------
I can't install ruby-oci8 on Ubuntu 104 using:
sudo gem install ruby-oci8
luan@luan-laptop:~/app/software/ruby/dev$ sudo /opt/ruby/bin/gem install ruby-oci8
[sudo] password for luan:
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
/opt/ruby-1.9.1-p376/bin/ruby extconf.rb
checking for load library path...
LD_LIBRARY_PATH is not set.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/ruby-1.9.1-p376/bin/ruby
--with-instant-client
--without-instant-client
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home': RuntimeError (RuntimeError)
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
from extconf.rb:18:in `
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
The 'sudo' command unset some environment variables for security reasons.
Pass required varialbes as follows
sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/ruby/bin/gem install ruby-oci8
or
sudo env ORACLE_HOME=$ORACLE_HOME /opt/ruby/bin/gem install ruby-oci8
Backtrace:
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
extconf.rb:18:in `
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html
Gem files will remain installed in /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4 for inspection.
Results logged to /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/gem_make.out
Tuesday, April 20, 2010
Install Oracle 11g R2 on Ubuntu 10.4
I follow the steps from
http://www.pythian.com/news/1355/installing-oracle-11gr1-on-ubuntu-810-intrepid-ibex/
I have to make some adjustments for my Ubuntu 10.4 64 bits, so here are steps:
luan@luan-laptop:~$ sudo su -
[sudo] password for luan:
root@luan-laptop:~# apt-get install gcc make binutils gawk x11-utils rpm alien ksh lsb-rpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
(... long list ...)
Suggested packages:
(... another long list ...)
The following NEW packages will be installed:
(... even longer list ...)
0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.3MB of archives.
After this operation, 93.0MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://us.archive.ubuntu.com lucid/main gawk 1:3.1.6.dfsg-0ubuntu1 [500kB]
Get:2 http://us.archive.ubuntu.com lucid/main libdrm2 2.3.1-0build1 [260kB]
(...)
Setting up build-essential (11.4) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@luan-laptop:~#
root@luan-laptop:~# apt-get install libaio1 lesstif2 libmotif3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libxp6
The following NEW packages will be installed:
lesstif2 libaio1 libmotif3 libxp6
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1941kB of archives.
After this operation, 4772kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://us.archive.ubuntu.com lucid/main libxp6 1:1.0.0.xsf1-2 [16.7kB]
Get:2 http://us.archive.ubuntu.com licid/multiverse libmotif3 2.2.3-2 [1283kB]
root@luan-laptop:~# cd /bin
root@luan-laptop:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2010-20-04 21:33 /bin/sh -> dash
root@luan-laptop:/bin# ln -sf /bin/bash /bin/sh
root@luan-laptop:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2010-20-04 22:34 /bin/sh -> bash
root@luan-laptop:/bin#
Now create some users:
root@luan-laptop:/bin# cd
root@luan-laptop:~# pwd
/root
root@luan-laptop:~# addgroup oinstall
Adding group `oinstall' (GID 1001) ...
Done.
root@luan-laptop:~# addgroup dba
Adding group `dba' (GID 1002) ...
Done.
root@luan-laptop:~# addgroup nobody
Adding group `nobody' (GID 1003) ...
Done.
root@luan-laptop:~# usermod -g nobody nobody
root@luan-laptop:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root@luan-laptop:~# mkdir /home/oracle
root@luan-laptop:~# chown -R oracle:dba /home/oracle
root@luan-laptop:~# ln -s /usr/bin/awk /bin/awk
root@luan-laptop:~# ln -s /usr/bin/rpm /bin/rpm
root@luan-laptop:~# ln -s /usr/bin/basename /bin/basename
root@luan-laptop:~# mkdir /etc/rc.d
root@luan-laptop:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
root@luan-laptop:~# mkdir -p /u01/app/oracle
root@luan-laptop:~# chown -R oracle:dba /u01
root@luan-laptop:~#
Copy the unpacked Oracle 11gR1 to the box we’re working on:
luan@luan-laptop:~$ sudo su -
root@luan-laptop:~# mv /home/download/database /media/database
root@luan-laptop:~# chown -R oracle:oinstall /media/database
root@luan-laptop:~#
Now change some system-wide configuration files, starting with /etc/sysctl.conf:
root@luan-laptop:~# cd /etc
root@luan-laptop:/etc# cp sysctl.conf sysctl.conf.original
Edit it, adding the following lines to the bottom of the file:
fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
Then, let’s modify /etc/security/limits.conf:
root@luan-laptop:/etc# cd /etc/security/
root@luan-laptop:/etc/security# cp limits.conf limits.conf.original
Add the following lines to the bottom of the file:
oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535
The last one, for now, is /etc/pam.d/login:
root@luan-laptop:/etc/security# cd /etc/pam.d
root@luan-laptop:/etc/pam.d# cp login login.original
Edit login, adding to it:
session required /lib/security/pam_limits.so
session required pam_limits.so
Here is how to get display working on my laptop.
oracle@luan-laptop:~$ exit
logout
root@luan-laptop:~# DISPLAY=:0; export DISPLAY; xhost +;
access control disabled, clients can connect from any host
root@luan-laptop:~# su - oracle
oracle@luan-laptop:~$ DISPLAY=:0 ; export DISPLAY
oracle@luan-laptop:~$ xclock
oracle@luan-laptop:~$
oracle@luan-laptop:~$ cd /media/database
oracle@luan-laptop:/media/database$ ./runInstaller -ignoreSysPrereqs
Now the windows installation screen will appear. You should be able to follow the default installation.
....
This is a startup script:
root@luan-laptop:/# cat /etc/init.d/oracledb
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
root@luan-laptop:/#
root@luan-laptop:/# chmod a+x /etc/init.d/oracledb
root@luan-laptop:/# update-rc.d oracledb defaults 99
update-rc.d: warning: /etc/init.d/oracledb missing LSB information
update-rc.d: see
Adding system startup for /etc/init.d/oracledb ...
/etc/rc0.d/K99oracledb -> ../init.d/oracledb
/etc/rc1.d/K99oracledb -> ../init.d/oracledb
/etc/rc6.d/K99oracledb -> ../init.d/oracledb
/etc/rc2.d/S99oracledb -> ../init.d/oracledb
/etc/rc3.d/S99oracledb -> ../init.d/oracledb
/etc/rc4.d/S99oracledb -> ../init.d/oracledb
/etc/rc5.d/S99oracledb -> ../init.d/oracledb
To startup database:
oracle@luan-laptop:~$ . oraenv
ORACLE_SID = [oracle] ? testdb
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
oracle@luan-laptop:~$
oracle@luan-laptop:~$
oracle@luan-laptop:~$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 21 09:39:17 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1269366784 bytes
Fixed Size 2212976 bytes
Variable Size 822086544 bytes
Database Buffers 436207616 bytes
Redo Buffers 8859648 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL>
------
How to start Oracle Enterprise Manager
oracle@luan-laptop:~$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://luan-laptop:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ............. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/luan-laptop_testdb/sysman/log
oracle@luan-laptop:~$
http://www.pythian.com/news/1355/installing-oracle-11gr1-on-ubuntu-810-intrepid-ibex/
I have to make some adjustments for my Ubuntu 10.4 64 bits, so here are steps:
luan@luan-laptop:~$ sudo su -
[sudo] password for luan:
root@luan-laptop:~# apt-get install gcc make binutils gawk x11-utils rpm alien ksh lsb-rpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
(... long list ...)
Suggested packages:
(... another long list ...)
The following NEW packages will be installed:
(... even longer list ...)
0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.3MB of archives.
After this operation, 93.0MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://us.archive.ubuntu.com lucid/main gawk 1:3.1.6.dfsg-0ubuntu1 [500kB]
Get:2 http://us.archive.ubuntu.com lucid/main libdrm2 2.3.1-0build1 [260kB]
(...)
Setting up build-essential (11.4) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@luan-laptop:~#
root@luan-laptop:~# apt-get install libaio1 lesstif2 libmotif3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libxp6
The following NEW packages will be installed:
lesstif2 libaio1 libmotif3 libxp6
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1941kB of archives.
After this operation, 4772kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://us.archive.ubuntu.com lucid/main libxp6 1:1.0.0.xsf1-2 [16.7kB]
Get:2 http://us.archive.ubuntu.com licid/multiverse libmotif3 2.2.3-2 [1283kB]
root@luan-laptop:~# cd /bin
root@luan-laptop:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2010-20-04 21:33 /bin/sh -> dash
root@luan-laptop:/bin# ln -sf /bin/bash /bin/sh
root@luan-laptop:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2010-20-04 22:34 /bin/sh -> bash
root@luan-laptop:/bin#
Now create some users:
root@luan-laptop:/bin# cd
root@luan-laptop:~# pwd
/root
root@luan-laptop:~# addgroup oinstall
Adding group `oinstall' (GID 1001) ...
Done.
root@luan-laptop:~# addgroup dba
Adding group `dba' (GID 1002) ...
Done.
root@luan-laptop:~# addgroup nobody
Adding group `nobody' (GID 1003) ...
Done.
root@luan-laptop:~# usermod -g nobody nobody
root@luan-laptop:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root@luan-laptop:~# mkdir /home/oracle
root@luan-laptop:~# chown -R oracle:dba /home/oracle
root@luan-laptop:~# ln -s /usr/bin/awk /bin/awk
root@luan-laptop:~# ln -s /usr/bin/rpm /bin/rpm
root@luan-laptop:~# ln -s /usr/bin/basename /bin/basename
root@luan-laptop:~# mkdir /etc/rc.d
root@luan-laptop:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
root@luan-laptop:~# mkdir -p /u01/app/oracle
root@luan-laptop:~# chown -R oracle:dba /u01
root@luan-laptop:~#
Copy the unpacked Oracle 11gR1 to the box we’re working on:
luan@luan-laptop:~$ sudo su -
root@luan-laptop:~# mv /home/download/database /media/database
root@luan-laptop:~# chown -R oracle:oinstall /media/database
root@luan-laptop:~#
Now change some system-wide configuration files, starting with /etc/sysctl.conf:
root@luan-laptop:~# cd /etc
root@luan-laptop:/etc# cp sysctl.conf sysctl.conf.original
Edit it, adding the following lines to the bottom of the file:
fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
Then, let’s modify /etc/security/limits.conf:
root@luan-laptop:/etc# cd /etc/security/
root@luan-laptop:/etc/security# cp limits.conf limits.conf.original
Add the following lines to the bottom of the file:
oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535
The last one, for now, is /etc/pam.d/login:
root@luan-laptop:/etc/security# cd /etc/pam.d
root@luan-laptop:/etc/pam.d# cp login login.original
Edit login, adding to it:
session required /lib/security/pam_limits.so
session required pam_limits.so
Here is how to get display working on my laptop.
oracle@luan-laptop:~$ exit
logout
root@luan-laptop:~# DISPLAY=:0; export DISPLAY; xhost +;
access control disabled, clients can connect from any host
root@luan-laptop:~# su - oracle
oracle@luan-laptop:~$ DISPLAY=:0 ; export DISPLAY
oracle@luan-laptop:~$ xclock
oracle@luan-laptop:~$
oracle@luan-laptop:~$ cd /media/database
oracle@luan-laptop:/media/database$ ./runInstaller -ignoreSysPrereqs
Now the windows installation screen will appear. You should be able to follow the default installation.
....
This is a startup script:
root@luan-laptop:/# cat /etc/init.d/oracledb
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
root@luan-laptop:/#
root@luan-laptop:/# chmod a+x /etc/init.d/oracledb
root@luan-laptop:/# update-rc.d oracledb defaults 99
update-rc.d: warning: /etc/init.d/oracledb missing LSB information
update-rc.d: see
Adding system startup for /etc/init.d/oracledb ...
/etc/rc0.d/K99oracledb -> ../init.d/oracledb
/etc/rc1.d/K99oracledb -> ../init.d/oracledb
/etc/rc6.d/K99oracledb -> ../init.d/oracledb
/etc/rc2.d/S99oracledb -> ../init.d/oracledb
/etc/rc3.d/S99oracledb -> ../init.d/oracledb
/etc/rc4.d/S99oracledb -> ../init.d/oracledb
/etc/rc5.d/S99oracledb -> ../init.d/oracledb
To startup database:
oracle@luan-laptop:~$ . oraenv
ORACLE_SID = [oracle] ? testdb
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
oracle@luan-laptop:~$
oracle@luan-laptop:~$
oracle@luan-laptop:~$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 21 09:39:17 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1269366784 bytes
Fixed Size 2212976 bytes
Variable Size 822086544 bytes
Database Buffers 436207616 bytes
Redo Buffers 8859648 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL>
------
How to start Oracle Enterprise Manager
oracle@luan-laptop:~$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://luan-laptop:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ............. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/luan-laptop_testdb/sysman/log
oracle@luan-laptop:~$
Monday, April 19, 2010
Install sys-proctable in Ubuntu 10.04 64 bits
luan@luan-laptop:~$ sudo /opt/ruby/bin/gem install sys-proctable --platform x86-64-linux
Successfully installed sys-proctable-0.9.0-x86-linux
1 gem installed
Installing ri documentation for sys-proctable-0.9.0-x86-linux...
Updating class cache with 3248 classes...
Installing RDoc documentation for sys-proctable-0.9.0-x86-linux...
Successfully installed sys-proctable-0.9.0-x86-linux
1 gem installed
Installing ri documentation for sys-proctable-0.9.0-x86-linux...
Updating class cache with 3248 classes...
Installing RDoc documentation for sys-proctable-0.9.0-x86-linux...
Thursday, March 25, 2010
Install sqlite3-ruby on Ubuntu 10.4 (for using with sequel)
I got this error while trying install sqlite on Ubuntu 10.4
/opt/ruby-1.9.1-p376/bin/ruby extconf.rb install sqlite3-ruby ruby=/opt/ruby-1.9.1-p376/bin/ruby
checking for fdatasync() in -lrt... yes
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
1. Install sqlite3
luan@luan-laptop:~$ sudo apt-get install sqlite3
2. Install libsqlite3-dev
luan@luan-laptop:~$ sudo apt-get install libsqlite3-dev
3. Install sqlite3-ruby for using with sequel
luan@luan-laptop:~$ sudo gem install sqlite3-ruby
/opt/ruby-1.9.1-p376/bin/ruby extconf.rb install sqlite3-ruby ruby=/opt/ruby-1.9.1-p376/bin/ruby
checking for fdatasync() in -lrt... yes
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
1. Install sqlite3
luan@luan-laptop:~$ sudo apt-get install sqlite3
2. Install libsqlite3-dev
luan@luan-laptop:~$ sudo apt-get install libsqlite3-dev
3. Install sqlite3-ruby for using with sequel
luan@luan-laptop:~$ sudo gem install sqlite3-ruby
Monday, February 22, 2010
Can't find tokyocabinet native extention
luan@luan-laptop:~/app/software/ruby/tokyo_projects$ ruby hash_db.rb
hash_db.rb:1:in `require': libtokyocabinet.so.9: cannot open shared object file: No such file or directory - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/tokyocabinet.so (LoadError)
from hash_db.rb:1:in `'
he solution was to modify the LD_LIBRARY_PATH to include /usr/local/lib or to where the ruby lib is located.
Modified:
sudo vi .bashrc
#~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
hash_db.rb:1:in `require': libtokyocabinet.so.9: cannot open shared object file: No such file or directory - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/tokyocabinet.so (LoadError)
from hash_db.rb:1:in `
he solution was to modify the LD_LIBRARY_PATH to include /usr/local/lib or to where the ruby lib is located.
Modified:
sudo vi .bashrc
#~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Tuesday, February 9, 2010
install ruby 1.9.1 script
http://gist.github.com/59130
#!/bin/sh
PATCH=376
mkdir -p /usr/local/src && cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p$PATCH.tar.bz2
tar -xjvf ruby-1.9.1-p$PATCH.tar.bz2
cd ruby-1.9.1-p$PATCH
./configure --prefix=/usr --program-suffix=19 --enable-shared
make && make install
#!/bin/sh
PATCH=376
mkdir -p /usr/local/src && cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p$PATCH.tar.bz2
tar -xjvf ruby-1.9.1-p$PATCH.tar.bz2
cd ruby-1.9.1-p$PATCH
./configure --prefix=/usr --program-suffix=19 --enable-shared
make && make install
install ruby 1.9.1p376 on Ubuntu 9.10
First, remove any ruby version on the system:
sudo apt-get remove --purge ruby1.8 ruby1.9
-- package build dependencies (ruby)
sudo apt-get build-dep ruby1.9
-- get ruby 1.9 source
-- if you can't get it, try to download from
-- http://www.ruby-lang.org/en/
wget -c ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
-- extract ruby source using tar
tar -xvzf ruby-1.9.1-p376.tar.gz
-- go to extracted ruby code dir
cd ruby-1.9.1-p376/
-- execute configure
./configure --prefix=/opt/ruby-1.9.1-p376 --enable-shared
-- execute make command
make
-- install process
sudo make install
Then I add the following line to the bottom of $HOME/.bash_profile
luan@luan-desktop:~$ cat .bash_profile
export OC4J_HOME=/opt/oc4j
export JAVA_HOME=/opt/java
export ECLIPSE_HOME=/opt/eclipse
export GROOVY_HOME=/opt/groovy
export GRAILS_HOME=/opt/grails
export TNS_ADMIN=/opt/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export RUBY_HOME=/opt/ruby
export NLS_LANG=AMERICAN_AMERICA.UTF8
export PATH=$ORACLE_HOME/bin:$RUBY_HOME/bin:$JAVA_HOME/bin:$OC4J_HOME/bin:$ECLIPSE_HOME:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$PATH
export AWT_TOOLKIT=MToolkit
Create a link:
luan@luan-desktop:/opt$ ln -s /opt/ruby-1.9.1-p0 /opt/ruby
luan@luan-desktop:/$ cd
luan@luan-desktop:/$ source .bash_profile
luan@luan-desktop:/$ ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
If you are using ruby gem, you need to type:
sudo /opt/ruby/bin/gem
sudo apt-get remove --purge ruby1.8 ruby1.9
-- package build dependencies (ruby)
sudo apt-get build-dep ruby1.9
-- get ruby 1.9 source
-- if you can't get it, try to download from
-- http://www.ruby-lang.org/en/
wget -c ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
-- extract ruby source using tar
tar -xvzf ruby-1.9.1-p376.tar.gz
-- go to extracted ruby code dir
cd ruby-1.9.1-p376/
-- execute configure
./configure --prefix=/opt/ruby-1.9.1-p376 --enable-shared
-- execute make command
make
-- install process
sudo make install
Then I add the following line to the bottom of $HOME/.bash_profile
luan@luan-desktop:~$ cat .bash_profile
export OC4J_HOME=/opt/oc4j
export JAVA_HOME=/opt/java
export ECLIPSE_HOME=/opt/eclipse
export GROOVY_HOME=/opt/groovy
export GRAILS_HOME=/opt/grails
export TNS_ADMIN=/opt/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export RUBY_HOME=/opt/ruby
export NLS_LANG=AMERICAN_AMERICA.UTF8
export PATH=$ORACLE_HOME/bin:$RUBY_HOME/bin:$JAVA_HOME/bin:$OC4J_HOME/bin:$ECLIPSE_HOME:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$PATH
export AWT_TOOLKIT=MToolkit
Create a link:
luan@luan-desktop:/opt$ ln -s /opt/ruby-1.9.1-p0 /opt/ruby
luan@luan-desktop:/$ cd
luan@luan-desktop:/$ source .bash_profile
luan@luan-desktop:/$ ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
If you are using ruby gem, you need to type:
sudo /opt/ruby/bin/gem
Thursday, May 28, 2009
FTP with backslash in username or passwd
If you have a backslash in username or passwd, you need to do a special character to escape backslash.
For example: ftp\username
export ftpusername='ftp\\username'
If you put a double quote around export ftpusername, it doesn't work. Or if you try to add "/" like "ftp/\username" doesn't work either. Imagine how syntax could get your way.
For example: ftp\username
export ftpusername='ftp\\username'
If you put a double quote around export ftpusername, it doesn't work. Or if you try to add "/" like "ftp/\username" doesn't work either. Imagine how syntax could get your way.
Saturday, May 9, 2009
Ubuntu useful commands
To install .deb package.
sudo dpkg -i package_file.deb
When using vi editor in Awn gnome-terminal, ESC does not work, but Ctrl+[. It's hard to use vi in Awn, but it's still work.
-- searching virtualbox in the system
sudo aptitude search virtualbox
-- install virtual box
sudo apt-get virtualbox-ose
-- get new updates
sudo apt-get update
-- install updates
sudo apt-get upgrade
-- How to change files/folders ownership
sudo chown username /location_of_files_or_folders
-- If you want to change ownership of all containing files and folders recursively, use the -R option like this:
sudo chown -R username /location_of_files_or_folders
-- How to change files/folders group ownership
sudo chgrp groupname /location_of_files_or_folders
-- If you want to change group ownership of all containing files and folders recursively, use the -R option like this:
sudo chgrp -R username /location_of_files_or_folders
sudo dpkg -i package_file.deb
When using vi editor in Awn gnome-terminal, ESC does not work, but Ctrl+[. It's hard to use vi in Awn, but it's still work.
-- searching virtualbox in the system
sudo aptitude search virtualbox
-- install virtual box
sudo apt-get virtualbox-ose
-- get new updates
sudo apt-get update
-- install updates
sudo apt-get upgrade
-- How to change files/folders ownership
sudo chown username /location_of_files_or_folders
-- If you want to change ownership of all containing files and folders recursively, use the -R option like this:
sudo chown -R username /location_of_files_or_folders
-- How to change files/folders group ownership
sudo chgrp groupname /location_of_files_or_folders
-- If you want to change group ownership of all containing files and folders recursively, use the -R option like this:
sudo chgrp -R username /location_of_files_or_folders
yakuake drop-down terminal emulator
This is my favorite terminal emulator.
Yakuake is a drop-down terminal emulator based on KDE Konsole technology.
http://yakuake.kde.org/
You can install on Ubuntu:
sudo apt-get install yakuake
Yakuake is a drop-down terminal emulator based on KDE Konsole technology.
http://yakuake.kde.org/
You can install on Ubuntu:
sudo apt-get install yakuake
VPN client on Ubuntu 9.04
VPN client on Ubuntu 9.04 is getting easier:
1. sudo apt-get install network-manager-pptp
2. click network-manager icon in panel-->VPN connections-->Configure VPN…
3. click Add button to add your vpn.server.com, username and passwd
1. sudo apt-get install network-manager-pptp
2. click network-manager icon in panel-->VPN connections-->Configure VPN…
3. click Add button to add your vpn.server.com, username and passwd
Friday, April 24, 2009
Generate Power Ball numbers
1 |
|
Subscribe to:
Posts (Atom)