Start Apache automatically during system startup

In the previous post, I installed and compiled the current latest version of apache on CentOS. So, whenever you install apache from source, you will have to start the apache service using the default apachectl script. If you try to run using service command (service httpd {start|stop|restart}), it won’t work.

In order to start apache service using the “service” command, you should update both ‘apachectl’ and ‘httpd’ variables in “/etc/rc.d/init.d/httpd” service script as shown in the below video.

Advertisements

Apache2.4.2 Installation

Here I’m installing the latest version of apache 2.4.2 on CentOS release 6.2 (Final) with kernel version 2.6.32-220.13.1.el6.i686. The server is a new one which was installed and configured few hours back.

Sorry about the voice quality. I didn’t notice that my mic was broken….

Upgrading Kernel to 3.3.5

Here I’m upgrading the existing kernel 2.6 to 3.3.5. So, here is the steps I followed to upgrade:

Download the stable kernel from http://boot.kernel.org/

wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.5.tar.bz2

Extract the tar file

tar -xvjf linux-3.3.5.tar.bz2

Change to the extracted folder linux-3.3.5

cd linux-3.3.5

Make sure you have installed all the required packages to upgrade the Kernel. In case if you haven’t, use yum to install those as follows:

yum install kernel-headers kernel-devel gcc

Copy the config file to the current directory.

cp /usr/src/kernels/3.2.12-3.2.4.amzn1.x86_64/.config .

.config file is used for kernel compliation; Don’t forget the . at the end of the command

Now it’s time to run ‘make oldconfig’ command. You’ll be asked a lot of questions. I just kept on pressing enter key except one place where you’ll be asked the processor type. So select the appropriate processor you are using. For rest of the questions you can simply press enter to accept the defaults.

make oldconfig

In case the command ‘make’ is not working, you have to install the development tools as follows:

yum groupinstall “Development Tools”

make clean
make bzImage

{This will take a while to complete. bzImage stands for big compressed kernel image found under directory like somepath/arch/i386/boot/bzImage moved to /boot and renamed as vmlinuz. In short, bzImage and vmlinuz are the same.}

cp arch/x86_64/boot/bzImage /boot/vmlinuz3
chmod a+x /boot/vmlinuz3
cp System.map /boot/System.map3
{system.map – Used by kernel if it needs to recover from fatal errors.}

make modules

{This will again take a lot of time to complete.}

make modules_install

{check /lib/modules for the newly installed kernel version}

mkinitrd /boot/initrd-3.3.5.img 3.3.5

{initrd is used to mount real root file system}

Now it’s time to update grub. So open /boot/grub/grub.conf and change the values of kernel and initrd parameters as kernel /vmlinuz3 and /initrd-3.3.5.img as shown in the figure. Now save this file and reboot your machine.

vi /boot/grub/grub.conf

default=0
timeout=5
password –md5 $1$n6/cJ0$UoUbLOTOsQqUOLlUUqa6b0
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (Upgraded to Kernel 3.3.5)
root (hd0,0)
kernel /vmlinuz3 ro root=/dev/mapper/vg_centos-lv_root rd_LVM_LV=vg_centos/lv_root rd_LVM_LV=vg_centos/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us nomodeset crashkernel=auto rhgb quiet
initrd /initrd-3.3.5.img

:wq!

Once rebooted, you can verify your kernel by issuing ‘uname -r’ command. If it is showing 3.3.5 then the task is completed successfully.

That’s it. Happy Compiling!!!

———————————————————-
Using the same above procedure, I have created a video on upgrading Kernel from version 2.6.32 to 3.4.2. Check the video below: