Wednesday, May 26, 2010

How to dump postgres database

1. use pg_dump to dump database
pg_dump dbname | gzip > filename.gz

2. The restore it
createdb dbname
gunzip -c filename.gz | psql dbname



How to install an application in linux using tar.gz file

1. copy in a suitable location mainly /usr/local/ then run following command
tar -zxvf .tar.gz

2. change dir to /usr/local/

3. run ./configure --help

4. set appropriate options and run ./configure --[options]

5. run command make

6. if available run make test

7. at last run make install

8. here you have done

9. set the PATH to include the lib files of above application

10 Good luck

Monday, March 22, 2010

How to configure IPSEC on linux

Scientific Linux or fedora/RHEL comes with ipsec-tools.
Host-to host config:
configure ifcfg-ipsec[number] on both machine
DST=X.X.X.X
TYPE=IPSEC
ONBOOT=yes
IKE_METHOD=PSK

Configure keys-ipsec[number]
IKE_PSK=secretkey

use setkey -f [filename] to set policy

use ifup ipsec[number] to start encryption.

use command tcpdump -n -i host [IPaddress of other machine] to find out whether encryption is taking place or not.



Wednesday, March 10, 2010

How to start service in LINUX on startup

To start a service in Linux on startup there are two methods.

i) if it is standard service and has a script in /etc/init.d just check its status

chkconfig --list service name

if is off

make it on by the following commands

chkconfig service name on

Similarly you can make a service off by following command

chkconfig service name off

other way write a script put it in /etc/init.d

add run following command

chkconfig --add service name
chkconfig service name on

simlarly you can remove a service for the list

chkconfig --del service name

ii) put the startup code in rc.local file.

Monday, January 25, 2010

To Store file in postgres database

There are two methods to store a file in database.

1. use either bytea type of database (Stores file as bytestream <1 GB)

2. use large objects type ( stores file in separate table referenced by integer OID)


for more information see the following links

http://www.postgresql.org/docs/7.4/interactive/jdbc-binary-data.html#JDBC-BINARY-DATA-EXAMPLE