Wednesday, February 20, 2008

How to get and install Apache in Linux

1. Get the latest Apache distribution at http://www.apache.org

2. Download and save it to /home/someuser/source/

3. Open terminal

4. # cd /home/someuser/source/

5. Unpack the distribution

· # tar xzvf httpd-x.x.x tar.gz

6. Go to the Apache source directory

· # cd httpd-x.x.x

7. Configure, compile and install Apache

· # ./configure --prefix=/usr/local/apache --enable-module=all --enable-shared=max

· # make

· # make install

Wednesday, February 13, 2008

How to use crontabs

Crontab Commands
__________
export EDITOR=vi ;to specify a editor to open crontab file.

crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)

Crontab syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

* in the value field above means all legal values as in braces for that column.
The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

Note: The specification of days can be made in two fields: month day and weekday. If both are specified in an entry, they are cumulative meaning both of the entries will get executed .

Crontab Example

A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*

Below runs the script every 3 minutes.

*/3 * * * * /home/perl/update.pl

Disable Email

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

>/dev/null 2>&1

Friday, February 8, 2008

How to install JDK 6 Update 4 in RHEL 4/5

STEP 1:DOWNLOADING FILE
Download Linux RPM in self-extracting file from http://java.sun.com/.

jdk-6u4-linux-i586-rpm.bin - for non 64 bit computer
jdk-6u4-linux-x64-rpm.bin - for 64 bit computer

STEP 2: HOW TO INSTALL
  1. chmod a+x jdk-6u4-linux-xxxx.rpm.bin
  2. ./ jdk jdk-6u4-linux-xxxx.rpm.bin
  3. Remove the existing java installation. you can identify the package by executing 'rpm -qa | grep java' you can remove the package by executing rpm -e 'java-1.x.x.'
  4. rpm jdk-6u4-linux-xxxx.rpm
  5. vi /root/.bash_profile and add this ..

    PATH=$PATH:$HOME/bin:/usr/java/jdk1.6.0_04/bin

After doing the steps reboot your machine.

PHP Compilation Error: configure: error: Cannot find rfc822.h. Please check your c-client installation.

If you are getting this error while compiling the PHP source, this is how to fix the problem.

Solution: If your machine is registered to redhat network just execute up2date -i libc-client-devel to install in your machine

If your machine is not registered download the libjpeg-devel.x.x.x.rpm then install it your machine.

rpm -ivh libc-client-devel.x.x.x.rpm

PHP Compilation Error: lib64/libc-client.a: could not read symbols: Bad value | make: *** [ext/imap/imap.la] Error 1

/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc-client.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [ext/imap/imap.la] Error 1

If you are getting this error, you can fix this by installing an older version of the following rpm's below.

libc-client.x.x.x.rpm
libc-client-devel.x.x.x.rpm

Some older php-source is not compatible with the latest libc-client.

I don't know if this is the ultimate solution but it works when I tried to install the older version of libc-client. =-)

PHP Compilation Error: configure: error: libjpeg.(a|so) not found.

If you are getting this error while compiling the PHP source, this is how to fix the problem.

Solution: If your machine is registered to redhat network just execute up2date -i libjpeg-devel to install in your machine

If your machine is not registered download the libjpeg-devel.x.x.x.rpm then install it your machine.

rpm -ivh libjpeg-devel.x.x.x.rpm
The On Demand Global Workforce - oDesk
Google