By Rupert
Posts tagged debian
Rails Note #13: RubyonRails + Oracle on Linux (i386 / x64)
Dec 11th
In summary, install Oracle Instant Client and try to run sqlplus. If sqlplus connects to the oracle sid then go ahead and install the rails adapters for oracle. What is important to note here, is to install the oracle-instantclient for the architecture of your machine.. I have tested this on Debian Lenny (i386) and CentOS5 (x64)
1. Download from http://www.oracle.com/technology/software/tech/oci/instantclient/
a. oracle-instantclient-basic-10.2.0.4-1.i386
b. oracle-instantclient-devel-10.2.0.4-1.i386
c. oracle-instantclient-sqlplus-10.2.0.4-1.i386
2. Unzip everything to /opt/oracle/instantclient . You should have something like the ff:
[root@csapp1 instantclient]# ls -la total 102704 drwxr-xr-x 3 root root 4096 Dec 10 21:54 . drwxr-xr-x 3 root root 4096 Dec 10 22:03 .. -rw-r--r-- 1 root root 228 Dec 10 21:52 BASIC_README -r--r--r-- 1 root root 1609607 Dec 10 21:52 classes12.jar -rwxr-xr-x 1 root root 67542 Dec 10 21:52 genezi -r--r--r-- 1 root root 1525 Dec 10 21:52 glogin.sql lrwxrwxrwx 1 root root 17 Dec 10 21:54 libclntsh.so -> libclntsh.so.10.1 -rwxr-xr-x 1 root root 21038613 Dec 10 21:52 libclntsh.so.10.1 -r-xr-xr-x 1 root root 3796601 Dec 10 21:52 libnnz10.so -rwxr-xr-x 1 root root 1664116 Dec 10 21:52 libocci.so.10.1 -rwxr-xr-x 1 root root 72674185 Dec 10 21:52 libociei.so -r-xr-xr-x 1 root root 138033 Dec 10 21:52 libocijdbc10.so -r-xr-xr-x 1 root root 1435561 Dec 10 21:52 libsqlplusic.so -r-xr-xr-x 1 root root 997409 Dec 10 21:52 libsqlplus.so -r--r--r-- 1 root root 1555682 Dec 10 21:52 ojdbc14.jar drwxr-xr-x 4 root root 4096 Dec 10 21:52 sdk -r-xr-xr-x 1 root root 7773 Dec 10 21:52 sqlplus -rw-r--r-- 1 root root 232 Dec 10 21:52 SQLPLUS_README -rw-r--r-- 1 root root 516 Dec 10 21:53 tnsnames.ora [root@csapp1 instantclient]#
3. Make a symbolic link for libclntsh.so.10.1 as shown above.
4. Create the Oracle Environment variables
export ORACLE_HOME=/opt/oracle/instantclient export TNS_ADMIN=$ORACLE_HOME export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH export DYLD_LIBRARY_PATH=$ORACLE_HOME export PATH=$PATH:$ORACLE_HOME
5. At this point, you should have oracle-instantclient properly installed. You can test by running sqlplus.
[root@csapp1 instantclient]# sqlplus SQL*Plus: Release 10.2.0.4.0 - Production on Thu Dec 11 11:47:40 2008 Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
NOTE: Sometimes you will get a SEGMENTATION FAULT. If so, try to open a new shell with the environment variables loaded and do an sqlplus in a directory which is not /opt/oracle/instantclient.
6. Install the oracle adapter for rails
7. gem install ruby-oci8
8. gem install oracle_enhanced-adapter –source=”http://gems.rubyonrails.org/”
activerecord-oracle-adapter (1.0.0.9250)
activerecord-oracle_enhanced-adapter (1.1.8)
NOTE: Try to look for the latest gems, the source above is at the time of this writing so it might change.
9. Test using irb
[root@csapp1 instantclient]# irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'oci8' => true irb(main):003:0>
Rails Note #4: Deploying a Rails Application in a Subdirectory
Nov 7th
There are many ways to deploy RoR applications. I have googled all over the place and so far the easiest setup that I could find that would suit my needs (existing Apache2 + ColdFusion + TileCache) would be to use
1. Apache PROXY
2. Mongrel
CentOS Installation Instructions
1. Make sure Apache has mod_proxy
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-mpm=prefork --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-httpd --enable-proxy-ajp --enable-proxy-balancer --enable-cgi
1. Apache Proxy
<VirtualHost *:80>
ServerName test
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /localdumplings http://localhost:3000/localdumplings
ProxyPassReverse /localdumplings http://localhost:3000/localdumplings
#ProxyPass /localdumplings/ http://localhost:3000/
#ProxyPassReverse /localdumplings/ http://localhost:3000/
</VirtualHost>2. Starting mongrel on a subdir
mongrel_rails start –prefix=/localdumplings
Debian Installation Instructions
1. Install libapache2-mod-proxy-html is easier…
sudo apt-get install libapache2-mod-proxy-html
2. Enable modules to load in apache2
sudo a2enmod proxy sudo a2enmod proxy_balancer sudo a2enmod proxy_http sudo a2enmod rewrite sudo /etc/init.d/apache2 stop sudo /etc/init.d/apache2 start
3. Add the application in /etc/apache2/mods-available/proxy.conf
<IfModule mod_proxy.c>
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests Off
<Proxy *>
AddDefaultCharset off
Order deny,allow
Allow from all
#Allow from .example.com
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyPass /localdumplings http://localhost:3000/localdumplings
ProxyPassReverse /localdumplings http://localhost:3000/localdumplings
ProxyVia On
</IfModule>Starting a mongrel_rails on boot
Slicehost ( http://articles.slicehost.com/2007/9/21/debian-etch-apache-vhosts-rails-and-mongrels ) has a very good article regarding this.
mongrel_rails start -d -e production -p 8001 -P log/mongrel8001.pid -l log/mongrel.log
Chinese Debian Repository
Nov 7th
Its been a long time I have not updated debian. Now, debian.cn99.com is not working. However, there is a new mirror in town.. www.anheng.com.cn.
Post Install Apache2.x, ColdFusion 8
May 28th
After binding Apache2.x and ColdFusion 8, I find it very useful to follow the post-install instructions below:
1. Copying ColdFusion Admin directory to /wwwroot (webroot)
# ln -s /var/www /wwwroot # cp -Rf /opt/coldfusion8/wwwroot/CFIDE /wwwroot/ # rm /wwwroot/index.html # cd /wwwroot # ln -s CFIDE cfide
2. Adding index.cfm to DirectoryIndex.
# vim /etc/apache2/mods-available/dir.conf
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm index.cfm3. Restart apache
/etc/init.d/apache2 stop /etc/init.d/apache2 start
4. Browse Admin page for the first time
Installing Postgresql, Postgis, pgRouting on Debian
May 25th
Operating System: Debian sid
Versions:
- postgres 8.3.1
- postgis 1.3.3
- pgRouting1.02
1. Install base system and ssh
#vi /etc/apt/sources.list to include deb http://debian.cn99.com/debian etch main deb-src http://debian.cn99.com/debian etch main #apt-get update #apt-get upgrade libc6
2. Install the required packages for postgres8.3 and postgis1.3.3
#apt-get install sudo nmap telnet
#apt-get install python2.5 python2.5-dev python-setuptools
#apt-get install g++
#apt-get install build-essential cmake ibboost-graph-dev
#apt-get install libreadline5 libreadline5-dev
#apt-get install zlib-bin zlib1g-dev
#apt-get install libkrb5-dev
#apt-get install libcurl3
#apt-get install libssl-dev
#apt-get install postgresql-8.3
#apt-get install postgresql-8.3-postgis
#apt-get install postgresql-server-dev-8.3
3. Installing pgRouting
# tar -zxvf pgRouting-1.02.tgz # cmake . # make # make install
Comments