Archive

Posts Tagged ‘centos’

Rails Note #4: Deploying a Rails Application in a Subdirectory

November 7th, 2008 rupert No comments

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
Categories: rails Tags: , ,

How to make Oracle start on boot

September 22nd, 2008 rupert No comments

1. Login as root and edit /etc/oratab to reflect “Y”

orcl:/opt/oracle/product/11.1.0/db_1:Y

2. oracle startup script:

#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script
 
# Source function library.
 
. /etc/rc.d/init.d/functions
 
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/product/11.1.0/db_1"
 
case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac

3. Oracle EMCTL

#!/bin/bash
#
# oraemctl Starting and stopping Oracle Enterprise Manager Database Control.
# Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Enterprise Manager DB Control startup script
 
# Source function library.
 
. /etc/rc.d/init.d/functions
 
ORACLE_OWNER="oracle"
ORACLE_HOME="/opt/oracle/product/11.1.0/db_1"
 
case "$1" in
start)
echo -n $"Starting Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle EM DB Console:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac

4. chkconfig –add /etc/init.d/oracle
5. chkconfig –add /etc/init.d/oraemctl

Categories: oracle Tags: ,

Installing Oracle11g x64 on CentOS5

July 26th, 2008 rupert No comments

FOR EDITING.. This is just a couple of notes from my Oracle testing a few weeks back that I forgot to post..

A. Installing

1. Check for rpm packages:

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21 elfutils-libelf libaio-devel libgcc

NOTE: For 10g, you need libXp.so.6 installed. It seems the oracle installer is messed up with some i386 modules pointing to x86? Anyway, I was able to resolve the problem by installing the libXp.i386.rpm version.

2. install the necessary rpm packages:

rpm -ivh compat-db-4.2.52-5.1.x86_64.rpm 
rpm -ivh libgnome-2.16.0-6.el5.x86_64.rpm 
rpm -ivh sysstat-7.0.0-3.el5.x86_64.rpm 
rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpm 
rpm -ivh lm_sensors-2.10.0-3.1.x86_64.rpm
rpm -ivh beecrypt-devel-4.1.2-10.1.1.x86_64.rpm elfutils-devel-0.125-3.el5.x86_64.rpm net-snmp-devel-5.3.1-19.el5.x86_64.rpm elfutils-devel-static-0.125-3.el5.x86_64.rpm net-snmp-5.3.1-19.el5.x86_64.rpm net-snmp-libs-5.3.1-19.el5.x86_64.rpm

3. vim /etc/profile

ORACLE_BASE=/opt/oracle/product
ORACLE_SID=csdbora
ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
 
export ORACLE_BASE ORACLE_SID ORACLE_HOME
 
PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

4. Create oracle Account

groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
id oracle

uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

5. Run modify_kernel.sh

cat >> /etc/sysctl.conf << EOF
kernel.shmall = 2097152
kernel.shmmax = 1073741824 
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1025 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
EOF

6. vim /etc/sysctl.conf and comment kernel.shmall and kernel.shmmax because if
you don’t then we will have double results

7. /sbin/sysctl -p

8. Create Directories:

mkdir -p /u01
mkdir -p /opt/oracle
mkdir -p /opt/oracle/product
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 755 /u01
chmod -R 755 /opt/oracle
chmod -R 755 /opt/oracle/product

9. Run sh -v modify_shelllimits.sh

10. Add the ff lines in /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

11. cp -rf /home/installers/linux.x64_11gR1_database.zip /opt/oracle

12. chown oracle:oinstall /opt/oracle/linux.x64_11gR1_database.zip

13. Clost all terminals and logout as root from desktop.

14. Login as oracle

15. Follow tutorial until installing oracle
Installing Oracle 11g on CentOS under VMWare on a Macbook.doc

To extract: cpio -idmv < 10201_database_linux_x86_64.cpio

vim /etc/redhat-release
Redhat 4

16. Run the 2 scripts after the dialog:

[root@cs5ora11g db1]# sh root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/11.1.0/db1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …

Creating /etc/oratab file…
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

17. Open your firewall to 1158

18. Go to https://192.168.1.155:1158/em

- Login as SYSMAN:[password] (nickname+wife)

19. Install Oracle Instant Client for your distro [MacOS]

http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

a. Add exports to runsqlplus.sh
b. copy tnsnames.ora from centos to mac
c. add in firewall: 1521
d. sh runsqlplus.sh

20. do sqlplus
Enter user-name: SYSMAN@cybersof
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

You are now connected successfully.

21. Check for oracle processes: ps -ef | grep ora

SQLPLUS DBINSTANCE:
oraclecybersof (LOCAL=NO)
 
 
ORACLE LISTENER:
/opt/oracle/product/11.1.0/db1/bin/tnslsnr LISTENER -inherit
 
ORACLE ENTERPRISE MANAGER:
oracle   14487     1  0 15:37 ?        00:00:00
/opt/oracle/product/11.1.0/db1/perl/bin/perl
/opt/oracle/product/11.1.0/db1/bin/emwd.pl dbconsole
/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc/sysman/log/emdb.nohup
oracle   14511 14487  2 15:37 ?        00:00:36
/opt/oracle/product/11.1.0/db1/jdk/bin/java -server -Xmx512M
-XX:MaxPermSize=1024M -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40
-DORACLE_HOME=/opt/oracle/product/11.1.0/db1
-Doracle.home=/opt/oracle/product/11.1.0/db1/oc4j
-Doracle.oc4j.localhome=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc/sysman
-DEMSTATE=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc
-Doracle.j2ee.dont.use.memory.archive=true
-Djava.protocol.handler.pkgs=HTTPClient
-Doracle.security.jazn.config=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/jazn.xml
-Djava.security.policy=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/java2.policy
-Djavax.net.ssl.KeyStore=/opt/oracle/product/11.1.0/db1/sysman/config/OCMTrustedCerts.txt-Djava.security.properties=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/home/config/jazn.security.props
-DEMDROOT=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc
-Dsysman.md5password=true -Drepapi.oracle.home=/opt/oracle/product/11.1.0/db1
-Ddisable.checkForUpdate=true
-Doracle.sysman.ccr.ocmSDK.websvc.keystore=/opt/oracle/product/11.1.0/db1/jlib/emocmclnt.ks
-Dice.pilots.html4.ignoreNonGenericFonts=true -Djava.awt.headless=true -jar
/opt/oracle/product/11.1.0/db1/oc4j/j2ee/home/oc4j.jar -config
/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/server.xml

22. Set Oracle Environment

# su - oracle
# vim ~/.bash_profile
ORACLE_BASE=/opt/oracle/product
ORACLE_SID=cybersof
ORACLE_HOME=/opt/oracle/product/11.1.0/db1
export ORACLE_BASE ORACLE_SID ORACLE_HOME
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

23. Shutdown and Startup of Oracle

$ . oraenv
<enter your SID>
 
$ sqlplus "/ as sysdba"
SQL> startup
SQL> exit
 
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
 
$ cd $ORACLE_HOME/bin
./emctl start dbconsole

B. Creating Users

Login to https://192.168.1.155:1158/em
username:sysman
password: [nickname+wifey]
connect as “sysdba”

1. Creating admin user:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/admqs_administer_users.htm#CHDBDBGI

em > Setup > Administrators > Create

2. Create appdev user:
em > Server > Roles

http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/admqs_administer_users.htm

CREATE USER "APPDEV" PROFILE "DEFAULT" IDENTIFIED BY "*******" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK
GRANT UNLIMITED TABLESPACE TO "APPDEV";
GRANT "CONNECT" TO "APPDEV";
GRANT "RESOURCE" TO "APPDEV";

Picture 1.png

Part II. Installing Oracle10g on CentOS5

1. Choose Advanced Installation”

Picture 1.png

2. If its just network prerequisite.. ignore it. It’s not a big deal.

Picture 2.png

3. ORACLE_HOME: /opt/oracle/product/10.2.0/db_1

Picture 3.png

4. ORACLE_SID: orcl, CHARSET: utf8

Picture 4.png

5. EM Installed…

Picture 6.png

6. ISQLPLUS

Picture 7.png

7. Run root.sh

Picture 9.png

output…

Picture 8.png

8. Other settings

Picture 10.png

9. Oracle Environment Variables

Picture 12.png

Categories: oracle Tags: , ,

SquirrelMail SMTP Authentication

January 4th, 2008 rupert No comments

Just a quick note to myself… A co-worker just notified me that they cannot send email using the web interface–squirrelmail.

squirrelmail Server replied: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.5.3 - chkuser)

This qmailrocks forum thread gives a quick workaround. Just set “SMTP AUTHENTICATION” to login as noted below.


/usr/share/squirrelmail/config/config.php
$no_list_for_subscribe = false;
$smtp_auth_mech = 'login';
$imap_auth_mech = 'login';
$use_imap_tls = false;

Categories: linux Tags: , ,

Debian, Centos, Ubuntu

July 27th, 2007 rupert No comments

I didn’t have much time blogging for the past week. But since July 18, I am running Debian, Centos and Ubuntu on my desktop.

1. Install CentOS 5.

2. Manually partition as follows:

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux (boot)
/dev/sda2 14 3837 30716280 83 Linux (/)
/dev/sda3 3838 4090 2032222+ 82 Linux swap

3. Put bootloader grub on mbr.

4. Reboot.

5. Install Ubuntu

6. Manually partition.

/dev/sda4 4091 19457 123435427+ 5 Extended
/dev/sda5 19446 19457 96390 83 Linux
/dev/sda6 19204 19444 1935801 82 Linux swap / Solaris
/dev/sda7 15556 19202 29294496 83 Linux

7. Install bootloader on /boot of /dev/sda4

8. Reboot.

9. Install Debian 7

10. Manually partition as follows:

/dev/sda8 4091 4102 96327 83 Linux
/dev/sda9 4103 4343 1935801 82 Linux swap / Solaris
/dev/sda10 4344 7990 29294496 83 Linux

11. Reboot.

Hurray! Key point here is to install the bootloader on mbr first then, installing successive loaders in /boot of other distros.

Categories: linux Tags: , , ,