Archive for the Category »Few good queries and suggestions «

How to upgrade kernel version?



First you need to download the latest stable kernel.
You can check it at http://kernel.org/.
Download it :
root@server [~]# cd /usr/local/src/

root@server [~]# wget http://www.kernel.org/pub/linux/kernel/v2.6/
Select latest Kernel and download it

root@server [~]# tar –zxvf linux-2.6.28.tar.gz
root@server [~]#cd linux-2.6.28
root@server [~]# make clean
root@server [~]# make mrproper
root@server [~]# uname -r
root@server [~] # cp /boot/config-’uname -r’ .config
root@server [~] # make oldconfig
root@server [~] # make menuconfig
root@server [~] # make
root@server [~] # make modules_install
root@server [~] # make install
root@server [~] # grubby –bootloader-probe
root@server [~] # pico /etc/grub.conf

Change the default as per the entry for your new kernel.
root@server [~]# reboot

Some time after reboot server it won’t up and running with the new kennel due to that before rebooting server, make following

changes.

root@server [~]#grub

Above command will give you grub prompt.

grub > savedefault –default=0 –once

grub>quit

root@server [~]#reboot

If server is up and running after reboot you can set new kernel as default server in grub.conf file.

root@server [~]#pico /boot/grub/grub.conf

Set

default=1

to

default=0

How to change timezone on Linux server?

You can change the time zone for your server by using following command.

root@gunjan[~]#date

Wed Nov 11 19:30:29 EST 2009

For example we are changing time zone  from EST to GMT.

root@gunjan[~]#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

root@gunjan[~]#date

Thu Nov 12 00:31:36 GMT 2009

Simple cgi script to check the Server uptime?

The following script you can use to check the Server uptime?

root@Gunjan [/usr/local/apache/cgi-bin]# nano loads
#!/bin/bash

echo Content-type: text/plain
echo

echo $(hostname)
echo “=>”
echo $(uptime)

What is Core Files in Linux?

A core file created when ever a program terminates unexpectedly and its also useful for determining what caused the termination. In many Linux server by default they do not produce core files when programs crash or terminates unexpectedly.

On  most of the Linux server core file size limitation is set to 0.You can check the core file size limit set in server by using following command.

root@gunjan [~]# ulimit -c
1000000

In above command core file size limit is 1000000 if output occur empty then it means core file size limit haven’t set on server and you can set it as

root@gunjan [~]# ulimit -c 1000000

or

root@gunjan [~]# ulimit -c unlimited

If you want to test core file limit is working on your server or not? then run following command

kill -s SIGSEGV $$

This above command will crashes your shell and produces core file in the current directory. as core.*

If core file is taking lots of disk space on server and you want to disable it then follow the steps one by one.

root@gunjan [~]#which httpd

/usr/sbin/httpd

root@gunjan [~]#pico /usr/sbin/httpd

And following line in /usr/sbin/httpd

ulimit -c 0

And then restart the Apache server

What is path for “ifconfig”?

The ifconfig is present under /sbin  director and the PATH of the normal users don’t point to /sbin directory and if execute “ifconfig” under normal by using any normal cPanel user login details then it will not show you.

you can set PATH to add /sbin  #PATH=$PATH:/sbin

Or you can enter command with full path like # /sbin/ifconfig

How to Open Passive FTP in iptable?

To Open Passive FTP in iptable root login is require.

If you want to open port range from 30000:64000 then run the following command from shell.

iptables -A INPUT -p tcp -m tcp –dport 30000:64000 -j ACCEPT

Similarly you can open passive post range as per your requirement.

How to install ssl on default services(http, exim, imap, pop3, cpanel/WHM)?

You can install SSL on default services(http, exim, imap, pop3, cpanel/WHM) from your WHM but you require root login details to

The all cert information save in following path

/var/cpanel/ssl/cpanel

You can install the certificate from your WHM >>  Main >> Service Configuration >> Manage Service SSL Certificates

Explain rmmod?

The “rmmod" is used to remove the module from kernel.The module name which you wan to remove from the Kernel (excluding the .ko) is specified to identify the module. The kernel will not remove a module that is currently being used in the kernel (a non-zero use count), but a -w option can be specified to "rmmod" to instruct the kernel to remove it once the use-count has decreased to zero.

root@gunjan#rmmod your_module

If you don’t know anything about “lsmod” then please read it first

Problem with cgi script?

Most of the time cgi script is not working properly after uploading by using FTP but script is working fine on local machine, why?

Because you need to be upload cgi script in ASCII Mode and Perl in BINARY Mode to run it without any problem.

How to reset the load value for server?

You can set the load value for server by using following steps but make sure that you are having root login details to make server wide chanegs.

Edit the file

/var/cpanel/cpanel.config

and change extracpus to a number larger then 0

Then run /usr/local/cpanel/startup afterwards to pickup the changes.