Wednesday, September 17, 2008

Oracle 9i Startup Script on CentOS 4.4

Here is startup script for oracle 9i release 2 on centos 4.4

1. Save this script on /etc/init.d/oracle

#!/bin/sh
# 15 September 2008
# Created by Johannes Sitorus
# description: Oracle auto start-stop script.

ORA_HOME=/data/oracle/9.2.0
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi

case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1

esac

2. chkconfig --level 35 oracle on

P.S Replace the variable as needed

Tuesday, August 12, 2008

Apache security

Maybe we need to build up a super secure web server. It's can be done through many steps. There's so many article on Internet, how to secure your web server. One of the step is using modsecurity.

1. Make sure you have mod_unique_id installed
2. Install the latest version of libxml2, if it isn't already installed on the server
3. Stop Apache httpd
4. Unpack modsecurity package if you are using tar.gz or you can install using rpm package (http://www.modsecurity.org/download/)
5. Edit httpd.conf and add these lines
LoadFile /usr/lib/libxml2.so
LoadModule security2_module modules/mod_security2.so

6. Configure ModSecurity
7. Start Apache httpd

Reff: http://www.modsecurity.org/

Thursday, June 12, 2008

iptables Packet Route

This picture will show how packet processed on firewall



Source :
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

Thursday, May 22, 2008

[OOT] Speedy

Quiet amaze with speedy, this afternoon my speedy connection was down. Then I log in to router console, disconnect my speedy and then reconnect.

My office using speedy (Office package 384 Kbps). I was shocked seeing download rate on web interface, it show 1029 Kbps. And then I tested the connection through www.speedtest.net and I was amaze to see this ;)

Friday, May 16, 2008

Recompile Kernel on CentOS 4.6

1. Download the latest kernel source from kernel.org

2. Copy kernel source to /usr/src/kernel/ and unpack it
[root@appdev kernels]tar jxvf linux-2.6.25.3.tar.bz2

3. Copy config files from original kernel
[root@appdev kernels]# cd linux-2.6.25.3
[root@appdev linux-2.6.25.3]# cp /boot/config-2.6.9-67.0.15.ELsmp .config
[root@appdev linux-2.6.25.3]# make menuconfig

and then exit

4. Rebuild RPM package
[root@appdev linux-2.6.25.3]# make rpm

5. You will find src rpm and rpm package on /usr/src/redhat/RPMS and /usr/src/redhat/ SRPMS

6. Install the new rpm package
[root@appdev]#rpm -ivh --nodeps /usr/src/redhat/RPMS/i386/kernel-2.6.25.3-1.i386.rpm

7. Make init files
[root@appdev]#mkinitrd /boot/initrd-kernel-2.6.25.3.img 2.6.25.3

8. Edit boot loader and add the new kernel
[root@appdev]#vi /boot/grub/grub.conf

9. Reboot the system
[root@appdev]#shutdown now -r

This article taken from
http://www.howtoforge.com/kernel_compilation_centos

Wednesday, May 7, 2008

Masquerade on sendmail and SMTP Route

add this line to /etc/mail/sendmail.mc for masquerading
# vi /etc/mail/sendmail.mc

MASQUERADE_AS(gudangsms.com)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(
gudangsms.com)dnl

add this line to /etc/mail/sendmail.mc for SMTP Route
define(`SMART_HOST',`smtp.gudangsms.com')

compile configuration files
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

restart sendmail
# /etc/init.d/sendmail restart

Tuesday, May 6, 2008

Recreate TEMP tablespace

1. Create another temp tablespace
SQL> CREATE TEMPORARY TABLESPACE temp2
2 TEMPFILE '/u02/oradata/TESTDB/temp2_01.dbf' SIZE 5M REUSE
3 AUTOEXTEND ON NEXT 1M MAXSIZE unlimited
4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

2. Move default temporary tablespace on every user
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;

3. Drop default tablespace
SQL> DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;

4. Create default temp tablespace
SQL> CREATE TEMPORARY TABLESPACE temp
2 TEMPFILE '/u02/oradata/TESTDB/temp01.dbf' SIZE 500M REUSE
3 AUTOEXTEND ON NEXT 100M MAXSIZE unlimited
4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

5. Re-move again default temp tablespace
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;

6. Drop second temp tablespace

SQL> DROP TABLESPACE temp2 INCLUDING CONTENTS AND DATAFILES;