How to recompile kernel?

November 20, 2009    |   Posted by admin   |    Category: Linux Administration

How to compile a kernel on a CentOS server?

Compiling a kernel on a CentOS server is probably easy than other Operating Systems but still you should take care while selecting modules else the server won’t boot up on the new kernel. New System admins find it difficult to compile a kernel, however, the following steps should help them a bit.

1) Download the kernel:

cd /usr/local/src/
wget http://www.kernel.org/pub/linux/kern…x.xx.xx.tar.gz

2) Extract the kernel:

tar -zxf linux-2.xx.xx.tar.gz

3) Here you can use previous config during compilation and select the new required modules:

cd linux-*
cp /boot/config-`uname -r` .config

This will copy the current kernel config in the extracted directory of the new kernel.

4) Now configure the kernel using “make menuconfig”. It will present a graphical display with all the available modules.

make menuconfig

Most of them are already selected since you are using the previous config. You need to make sure you select the new modules for example, the ones related to iptables. Each module provides a HELP module which will help you to understand what the module is all about.

5) Compile the kernel:

make

6) Compile the modules:

make modules

7) Install the modules:

make modules_install

8 ) Install the kernel:

make install

This will place the required files of the new kernel under the /boot directory.

Now, the /etc/grub/grub.conf file will have “default=1” where, ‘1’ is the old kernel. You now need to change “default” value to ‘0’ i.e. from

default=1
to
default=0

Save the file and reboot the server. The server will boot up with the new kernel. However, if the kernel is not compiled properly, your server won’t come online and you will have to change the “default” value back to ‘1’ to boot the server using a single usermode and investigate the issue further.

To overcome this issue, you can use the following steps to test the new kernel.  Once you complete the kernel installation using the “make install” command, execute the command:

root@server[#]# grub

At the grub prompt, execute:

savedefault –default=0 –once
quit

You now need to reboot the server to pick up the new kernel just once i.e. even if the server won’t boot up on the new kernel, you just need another reboot and the server will come online on the old kernel. This will save time and will allow you to work immediately on the issue.

Comments Off on How to recompile kernel?

How to turn off Innodb engine?

November 17, 2009    |   Posted by admin   |    Category: Linux Administration

How to turn off Innodb Engine in Mysql?

When Mysql is installed, Innodb Engine is set to ON by default. You can verify whether Innodb is set to On or Off by using ‘mysqladmin variables’. Login to the server as root and execute:

root@host [~]# mysqladmin variables | grep have_innodb
| have_innodb                     | ENABLED

To turn off Innodb, you need to edit the Mysql Configuration file at /etc/my.cnf and add the following line:

skip-innodb

Save the file and restart the mysql service. You now execute the ‘mysqladmin variables’ to check the status of Innodb engine.

Comments Off on How to turn off Innodb engine?

PHP Warning: POST Content-Length exceeds the limit

November 13, 2009    |   Posted by admin   |    Category: Linux Administration

PHP Warning: POST Content-Length of xxxxx bytes exceeds the limit of xxxxxx bytes in Unknown on line 0

You receive the “POST Content-Length” error message when a file greater than the size defined in the php.ini file is uploaded via the browser.

The file you are uploading using the POST method should not exceed the value of post_max_size defined in php.ini file. If it does, it results in the above error message.

Solution:
In case you are looking to upload a larger file size, you need to increase the value of “post_max_size” in php.ini.

1) To locate the exact php.ini file, your PHP is using

php -i | grep php.ini

2) Edit the php configuration file

pico /usr/local/lib/php.ini

3) If you are looking to upload a file of 30M, set post_max_size and to upload_max_filesize to 40M.

post_max_size = 40M
upload_max_filesize = 40M

4) Save the file and restart the httpd service

service httpd restart

You should be done now.

How to read core.xxx files in linux

November 10, 2009    |   Posted by admin   |    Category: Linux Administration

How to view core.xx files in Linux?

The core.xxx files are created on Linux servers and holds the current state of a process working memory when a process is crashed. To view the core.xx files in Linux, execute the command:

root@host [~]# strings core.xxx

It will list different state of a process on each line.

Comments Off on How to read core.xxx files in linux

Vcards and mime types

November 9, 2009    |   Posted by admin   |    Category: Linux Administration

How to make a .vcf file down loadable?

Problem: If you link a .vcf file on a page, it shows as a text file instead of asking for a download.

Solution: In order to make the .vcf file download-able, you need to add the AddTye directive in the .htaccess file as follows:

AddType text/x-vcard .vcf

Save the file and that’s it.