Archive for June, 2009

SBDavid

Compile Apache

Compile Apache

Download from - http://mirrors.homepagle.com/apache/httpd/httpd-2.2.11.tar.gz

Untar the file httpd-2.2.11.tar.gz

cd into httpd*

Type the following to prepare for building.

./configure –prefix=[path] –enable-module=so
make
make install

Check if you have mod_so enabled:
cd to the Apache bin directory

./httpd -l

Open httpd.conf and find a line starting with ServerAdmin.

ServerAdmin admin@serverbuddies.com

Find a line starting with ServerName.

ServerName server1.serverbuddies.com:80

Save the file.

cd up a directory (type cd ..)

Start Apache

./bin/apachectl start
SBDavid

Fsck.ext3: Unable to resolve UUID

Fsck.ext3: Unable to resolve UUID

If you are getting the FSCK error fsck.ext3: Unable to resolve ‘UUID=”0415c1ac-8f7a-49e3-9638-bbab4ceefe9b”‘ on system booting, then you can try following steps to resolve that.

1. Use following command to get the UUID of current partitions.

blkid

2. Open the /etc/fstab file and check the UUID in the fstab and the result of blkid are same.

$ sudo blkid |grep /dev/sda
/dev/sda1: TYPE=”swap” UUID=”0415c1ac-8f7a-49e3-9638-bbab4ceefe9b”
/dev/sda2: LABEL=”Dreamlinux” UUID=”5845b99a-14e0-4bd5-b17a-05a8085b16f3″ TYPE=”ext3″

3. Edit the /etc/fstab and change the UUID to that got from the blkid

That will solve the issue.

How to disable the the stats services(Analog or Awstats or Webalizer stats)

You can disable Analog or Awstats or Webalizer stats in a cpanel server via backend by editing the file “/var/cpanel/cpanel.config”.

Check for the variables skipanalog, skipawstats, skipwebalizer in the file and change the values of the variables to one. Now the variables should look like as follows:

skipanalog=1
skipawstats=1
skipwebalizer=1

Save the changes and restart the cpanel service in the server.

/etc/init.d/cpanel restart

Now the all the three stats will be disabled server wide.

SBDavid

Find text in a large number of files

Find text in a large number of files

If you need to find a string in a file, you would typically use:

grep -H “string” file-name.ext

However, grep doesn’t handle a large number of files well. If you specify grep “string” * or even grep “string” `find ./`you may find yourself facing this error:

bash: /bin/grep: Argument list too long

Simple bash script to do the searching.

In this sample, We will be looking for a string “welcome” in a directory named “./Document/”:

for i in `find ./Document/`; do grep -H “welcome” $i; done

This uses the find command to do the searching. It actually returns a list of filenames, which we can then grep one-by-one. The -H option tells grep to let us know the filename it found the string in so we can go right into that file to find the location of it.

SBDavid

Enable quotas in your cpanel server

Enable quotas in cpanel server

If quotas are not enabled for the partition, the following error will occur while doing a quotacheck in the server. In case of Cpanel server, /scripts/initquotas will throw the following error.

/scripts/initquotas
Quotas are now on
Updating Quota Files……
quotacheck: Can’t find filesystem to check or filesystem not mounted with quota option.
quotacheck: Can’t find filesystem to check or filesystem not mounted with quota option.
….Done

You need to follow the steps given below:

$ touch /quota.user /quota.group
$ chmod 600 /quota.*
$ mount -o remount /
$ quotaoff -a
$ vi /etc/fstab
( open ‘fstab’ file and add usrquota,grpquota to the partition where you want to have quota on. That is, for example, add the entry like:
/dev/ubd0 / ext3 defaults,noatime,usrquota,grpquota 1 0 )
$ quotaon -a

You should be able to run a quotacheck nor /scripts/initquotas in your cpanel server without any problem.

« Prev - Next »