Welcome to Linux Family

Linux is a powerful opensource OS. Once you are in it, you feel like a genious! Now what are you waiting for? Install Linux in your machine and make the world out of it!

Apache Webserver Installation guide

Have a Linux server or localmachine? Need to power your own websites in it? Here you go!! Click to unleash apache webserver installation guide and learn to host your own sites

Linux Processes Overview

This document will give you an overview of linux processes. Advanced topics yet to come!!

Stop spamming!Sign outgoing mails

DKIM is an excellent software to digitally sign your outgoing mails and thus ensuring proper inbox delivery of all your mails.

Tuesday, March 13, 2012

overview of linux processes

We have a program and we needs to run it. When it is started, a process is generated. Thus a process is a running instance of a program. Programs/services like Apache, mysql etc. usually generates multiple instances of program, in other words, multiple processes to handle the tasks assigned to them.


Different process states

1. Running:
                Processes that are running in the system are called running processes. In most systems, at a time only one process runs.

2. Sleeping:
                 A process that is not running and is sleeping is called a sleeping process. This is inturn divided into two:

    2.1 Interruptible:
                            It defines a sleeping process that is waiting for a signal from another process. It will change to running state anytime.
    2.2 Uninterruptible:
                            A process that is waiting for a hardware condition to occur and is in a blocked state.

3. Stopped:
                A process that is stopped by another process. This can be restarted.

4. Zombie:
               A process that has completed its execution, but has entry in the process table is called Zombie process.

How a zombie process is generated:


Every process other than init has a parent process. So when the execution of a child process is complete, it releases all resources and memory and will be terminated. Then a signal is passed to the parent process indicating the status of that child process. Till the parent process receives that signal and confirms the termination of child, its entry will be in process table, which will make it a zombie process. In some cases, the parent gets killed due to some reasons and as a result wait call issued by parent will lose track of child process status. In that case the zombie process will remain in system until reboot.

Zombie processes are completely harmless, as it consumes no memory or resources and will just possess a simple entry in process table.




Tuesday, December 27, 2011

Apache Installation guide

For linux users (Fedora, centos, redhat )

For linux users, installation can be done in two ways. Either from source or using yum.

1. Installation


1.1 Installation using yum

Apache is included in standard linux repositories. So you can follow the below shown steps for installing using yum.

  1. Install httpd binaries.
    $yum install httpd
  2. Install http development libraries.
    $yum install httpd-devel
It was simple! Now apache webserver is installed in your machine. You can start the server using the following startup script:

$/etc/init.d/httpd start

Dont forget to configure apache to start automatically during system bootup. For that issue the following command:

$chkconfig httpd on

1.2 Installation from source (Applicable to both redhat as well as ubuntu variants)
  1. Download apache source from http://httpd.apache.org/download.cgi. At the time of writing this doc, the latest stable version is 2.2.21. So I am going ahead with that.
    $cd /usr/local/src

    $wget http://apache.osuosl.org//httpd/httpd-2.2.21.tar.gz
  2. Extract the downloaded archive.

    $tar -xvzf httpd-2.2.21.tar.gz
  3. Change to the newly created extracted folder

    $cd httpd-2.2.21
  4. Configure the source. Here you can use a lot of options like "--prefix=/usr/local" (will install apache inside that folder) "--with-apxs=/path/to/apxs/binary" (you need to install apxs separately if it is not there. For full list of options, just issue the command "./configure --help" without quotes. Here I am using only prefix option to make you understan.

    $ ./configure --prefix=/etc/httpd/
  5. Build the configuration

    $make
  6. Finally install the source package.

    $make install

If no errors encountered during ./configure and make, make install steps, apache should now be installed in your machine.

2. Configuration
By default, /var/www/html is the location from which web files will be served for apache. To further configure the location and adding domain names, you can follow the below shown steps.

1. Edit the file /etc/httpd/conf/httpd.conf

2. Uncomment the line:
NameVirtualHost *
(This is used to enable name based virtualhosting feature in apache, which allows you to configure multiple domain names using single IP.

3. Now add a separate virtual host entry to the end of httpd.conf for the domain name you need to create. The entries will be like the following:


ServerName mytestdomain.com
ServerAlias www.mytestdomain.com
DocumentRoot /home/mytest/public_html



Note: 192.168.1.2 is the IP address to which the domain points.
ServerName: The name of the domain.
ServerAlias: Alternate names that can be used to fetch same contents (usually www.domainname)
DocumentRoot: The directory from which the web files are fetched from.

There are lot more configuration options available for apache. But here I have mentioned only the basic ones for creating the domain.

Sunday, September 4, 2011

(could mean shell command ended by signal 127 (Unknown signal 127)) from command: /usr/bin/php exim filter

This error means that the exim is trying to deliver the queue as nobody (exim security) and it does not have access to certain files used by the script for writing. This could be in most cases the log files inside the script directory.

An easy fix to this problem is to provide full permission (chmod 777) to the log files or files that script writes information to, so that the exim queue runner can access and write to log files or other files mentioned by the script.

chmod 777 /path/to/logs/of/script

Saturday, August 6, 2011

make servername remote in sendmail in ubuntu

In some cases, we need to make the mail handling of server name itself to be done by a remote server. Let the server name be test.com. Then if you sent a mail from the server of test.com (from backend or through a php mailer) using sendmail to user@test.com, then the mail will be tried to be delivered locally in the main server rather than actual mail handling server and this results in a failure. In that case, what I did was the following: Hope this might help you.

checked /etc/mail/local-host-names and make sure that server name (test.com) is not there. Then did the following:

1. Open /etc/mail/sendmail.mc
vi /etc/mail/sendmail.mc

2. Added the following in the end:
define(`MAIL_HUB', `test.com.')dnl define(`LOCAL_RELAY', `test.com.')dnl 
3. ran the following command to reflect the changes:
sendmailconfig
Restarted the sendmail service and I was able to send mail to the remote mail server fine.

Thursday, August 4, 2011

backup automation script in linux

sorry for the inconvenience. but the link broke and you wont be able to download the script. I will be updating this soon to a new location with an improved version.

You can download this script by clicking here.
Description:
This script when executed will generate a customized script file according to your backup needs and you just need to execute that script file in your cronjob for your backup process. Upon execution, you will be asked for a series of qns according to which the final script will be generated.
This will also display the line that you need to enter into your cronjob, so all you have to do is:
1. Open cronfile.
crontab -e
2. Paste the cron line that is displayed at the end of executing this script.

PS: cronscript.sh is the name of customized script that is generated at the end of execution and will be stored where you are executing this script. If you change its location after that, change the path in cron entry as well.

Requirements:
1. ncftp package is needed if you are going to use FTP for remote backup. You can install it using yum.
yum install ncftp*

2. If you are using ssh for backup, just make sure that you atleast connect once from the source machine to backup machine using ssh. This is to avoid the extra prompt while cron script tries to connect to remote machine.

Thats all for now. ENjoy!!

Tuesday, August 2, 2011

no mysql_check in nagios plugins ubuntu

1. apt-get install libmysqlclient15-dev
2. Now recompile nagios plugins with mysql plugin.
./configure --with-mysql
make
make install

Now check the folder /usr/local/nagios/libexec/ or wherever you had installed nagios and you will find check_mysql plugin required for checking mysql service.

how to detect servername as remote domain for mailing by sendmail

In some cases, the mails for the main hostname will be handled by remote mail servers and sendmail will tend to detect it as local domain name and hence mails from the server to the particular hostname will be taken as local. To rectify this problem, you can follow the following steps:

Before performing the following, make sure that mx entries of the hostname is resolving properly to the remote mail server. You can check this using the command:
dig mx hostname.com

1. open /etc/mail/sendmail.cf
vi /etc/mail/sendmail.cf

2. make the following change:

O DontProbeInterfaces=False

3. Save the file and restart sendmail

/etc/init.d/sendmail restart

Now mails to the hostname from the server will be relayed remotely.