Thursday, May 24, 2007

Installing IonCube Loader

1. Download the program and store it on your server using wget or FTP.

http://www.ioncube.com/loader_download.php

2. Unpack the program
tar -zxvf ioncube_loaders.tar.gz

3. cd ioncube

4. copy ioncube-install-assistant.php to a web directory such as your hosting directory and open it in your browser window.
cp ioncube-install-assistant.php /home/userdirectoryhere/www

5. Now lets move the iconcube directory to a permanent location:

cd ..
mv ioncube /usr/local

6. Now that you know the location of php.ini you need to edit it.
pico /usr/local/lib/php.ini

Now find where other zend extentions are in the file.
ctrl + w: zend_extension

Paste in your new line for ioncube loader
zend_extension = /usr/local/ioncube/ioncube_loader_lin_4.3.so

(NOTE) Check php version if it is 5.2 then entry should be ioncube_loader_lin_5.2.so

7. Save the changes
ctrl + X then Y and enter

8. Restart the web server to take effect.
/etc/init.d/httpd restart

Enjoy
Ninad S

Tuesday, May 22, 2007

What is RAID (Redundant Array of Independent Disks)?

RAID is a type of disk, where several physical disks are combined into an array for better speed and fault tolerance. RAID 0 implements data striping where file blocks are written to separate drives. RAID 0 does not provide fault tolerance, because failure of one drive will result in data loss. RAID 1 implements data mirroring. Data is duplicated on two drives either through software or hardware. It provides faster read performance than a single drive.

Enjoy
Ninad S

Monday, May 21, 2007

Cron to delete mails from Inbox

Here is the syntax for deleting all email in the inbox of the default email address for a website:

echo -n > /home/youraccount/mail/inbox

Enjoy
Ninad S

Send Email from a PHP Script Using SMTP Authentication

To connect to an outgoing SMTP server from a PHP script using SMTP authentication and send an email:

Adapt the example below for your needs. Make sure you change the following variables at least:
* from: the email address from which you want the message to be sent.
* to: the recipient's email address and name.
* host: your outgoing SMTP server name.
* username: the SMTP user name (typically the same as the user name used to retrieve mail).
* password: the password for SMTP authentication.
------------------------------------------------------------------------------------------------
require_once "Mail.php";

$from = "Bill Sender ";
$to = "Ninad Recipient ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("

" . $mail->getMessage() . "

");
} else {
echo("

Message successfully sent!

");
}
?>
------------------------------------------------------------------------------------------------
Enjoy
Ninad S

Saturday, May 19, 2007

Google AdSense Account Disabled

Hello Ninad Shirgaonkar,

It has come to our attention that invalid clicks and/or impressions
have been generated on the Google ads on your site(s). We have
therefore disabled your Google AdSense account. Please understand that
this was a necessary step to protect the interests of AdWords
advertisers.

As you may know, a publisher's site may not have invalid clicks or
impressions on any ad(s), including but not limited to clicks and/or
impressions generated by:

- a publisher on his own web pages
- a publisher encouraging others to click on his ads
- automated clicking or surfing programs, or any other deceptive
software
- a publisher altering any portion of the ad code or changing the
layout, behavior, targeting, or delivery of ads for any reason

These or any other such activities that violate Google AdSense Terms
and Conditions and program polices may have led us to disable your
account. The Terms and Conditions and program polices can be viewed at:

https://www.google.com/adsense/localized-terms?hl=en_US
https://www.google.com/adsense/policies?hl=en_US

If you have any questions about invalid activity or the action taken on
your account, please do not reply to this email. You can find more
information by visiting
https://www.google.com/adsense/support/bin/answer.py?answer=57153.

Sincerely,

The Google AdSense Team

How to increase file limit

Get current limit:

ulimit -n

cat /proc/sys/fs/file-nr

The default limit is 1024.

Get current number of open file descriptors:

lsof [-p pid] | wc -l

Increase the limit:

Edit /etc/security/limits.conf:

username hard nofile 32768

Enjoy

Ninad S

Friday, May 11, 2007

Postfix + ClamAV + MailScanner in OpenSuse 10.2

1) Install the anti virus software (Clamav) –> (here) http://rpm.pbone.net/
rpm -ivh clamav-db-0.88.2-1.i386.rpm
rpm -ivh clamav-devel-0.88.2-1.i386.rpm
rpm -ivh clamav-server-0.88.2-1.i386.rpm
rpm -ivh clamav-0.88.2-1.i386.rpm

/etc/init.d/clamd start

2. Once the anti-virus is install then we need to install the MailScanner software the RPM along with the source files can be found at
http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml

Now get ready to install the mailscanner, this is going to take a long time.

gzip -d MailScanner-4.46.2-2.rpm.tar.gz
tar -xvf MailScanner-4.46.2-2.rpm.tar
cd MailScanner-4.46.2-2
./install.sh

3. In your MailScanner.conf file in /etc/MailScanner, there are 5 settings you need to change. The settings are:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix

4. You will need to ensure that the user “postfix” can write to

/var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine

chown postfix:postfix /var/spool/MailScanner/incoming
chown postfix:postfix /var/spool/MailScanner/quarantine

5. Edit file MailScanner.conf
Virus Scanners = clamav

6. Edit virus.scanners.conf
clamav /usr/lib/MailScanner/clamav-wrapper /var/lib/clamav

7. Now we need to edit the postfix main.cf file, go all the way to the bottom of the file and add the following
header_checks = regexp:/etc/postfix/header_checks

8. In the file /etc/postfix/header_checks add this line:
/^Received:/ HOLD

9. Set the servers to run on startup and then start them

chkconfig MailScanner on
chkconfig postfix on
chkconfig clamd on

/etc/init.d/Mailscanner start
/etc/init.d/postfix start
/etc/init.d/clamd start

Enjoy

Ninad S

How To use Yum

  • To seach for a application

Yum will search all your enabled repos and tell you where you can obtain the package from

yum search application_name
  • Yum can list all available packages from your enabled repos and tell you where you can obtain the package from:
yum list available
  • To find out more info about some package
yum info application_name
  • Installing applications

Inastalling is as easy as

yum install application_name
  • Listing rpms

yum can list installed rpms for you from the repos you have enabled

yum list extras
  • Removing rpms

Yum can remove a application and the dependenciesit installed with tat application. it will not remove depenencies if another application installed needs them.

yum remove application_name
  • Updating the system

Yum can update the system for you with out user interact if you want it to.

yum update
  • Not sure if you have upates?
yum check-update
  • Local install

downloaded a rpm and cannot install it with rpm because of dependencies?

yum localinstall /path/to/the/rpm

Enjoy

Ninad S

Thursday, May 10, 2007

To view the .html first instead of .php

Add the code in .htaceess as DirectoryIndex index.html

Enjoy
Ninad S

To turn off register globals for a particular user.

Put the code in .htaccess
php_flag register_globals off

Enjoy

Ninad S

How to Set wildcard DNS

Edit the httpd.conf and add the line in virtual host of domain.

ServerAlias *.domain.com www.*.domain.com

restart httpd/apache service.

Now edit the DNS file or db file of domain and add the line as

*.domain.com. 14400 IN A IP of server
www.*.domain.com. 14400 IN A IP of server

restart named service

Enjoy

Ninad S

Find out what messages are waiting for delivery?

To list the number of messages, use:

exim -bpc

To list all the messages in the queue, use:

exim -bp

To get a summary of all the messages waiting for delivery, use:

exim -bp|exiqsumm -c

This will produce a summary of all messages, listed in order of quantity to each destination (domain).

Enjoy

Ninad S

Nagios Installation and Configuration

You can use the following steps to install and configure Nagios.

Create the base directory where you would like to install Nagios.
mkdir /usr/local/nagios

Add a new user (and group) to your system.
adduser nagios

Download Nagois 1.0.
wget http://internap.dl.sourceforge.net/sourceforge/nagios/nagios-1.0.tar.gz
tar -zxvf nagios-1.0.tar.gz
cd nagios-1.0

Run the configure script.
./configure –prefix=/usr/local/nagios –with-cgiurl=/nagios/cgi-bin
–with-htmurl=/nagios/ –with-nagios-user=nagios –with-nagios-grp=nagios

Compile Nagios and the CGIs.
make all

Install the binaries and HTML files (documentation and main web page).
make install

Install the sample init script to /etc/rc.d/init.d/nagios.
make install-init

Installing the Plugins
——————————-

In order for Nagios to be of any use to you, you’re going to have to download
and install some plugins. Plugins are scripts or binaries which perform all
the service and host checks that constitute monitoring

Download and install the Nagios Plugins.
wget
http://aleron.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.3.1-1.9.i386.rpm
rpm -Ivh nagios-plugins-1.3.1-1.9.i386.rpm

Configuring Nagios
—————————

Nagios is compiled and installed. Now we have to configure it or in other
words define objects (hosts, services, etc.) that should be monitored.

The main configuration file (/usr/local/nagios/etc/nagios.cfg) contains a
number of directives that affect how Nagios operates. This config file is
read by both the Nagios process and the CGIs. This is a sample nagios.cfg

—————————————————————————————————————–
log_file=/usr/local/nagios/var/nagios.log
cfg_file=/usr/local/nagios/etc/checkcommands.cfg
cfg_file=/usr/local/nagios/etc/misccommands.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/dependencies.cfg
cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
resource_file=/usr/local/nagios/etc/resource.cfg
status_file=/usr/local/nagios/var/status.log
nagios_user=nagios
nagios_group=nagios
check_external_commands=1
command_check_interval=45s
command_file=/usr/local/nagios/rw/nagios.cmd
comment_file=/usr/local/nagios/var/comment.log
downtime_file=/usr/local/nagios/var/downtime.log
lock_file=/usr/local/nagios/var/nagios.lock
temp_file=/usr/local/nagios/var/nagios.tmp
log_rotation_method=d
log_archive_path=/usr/local/nagios/archives
use_syslog=0
log_notifications=1
log_service_retries=1
log_event_handlers=1
log_initial_states=1
log_external_commands=1
log_passive_service_checks=1
inter_check_delay_method=s
service_interleave_factor=s
max_concurrent_checks=0
service_reaper_frequency=1
sleep_time=1
service_check_timeout=30
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5
retain_state_information=1
state_retention_file=/usr/local/nagios/var/status.sav
retention_update_interval=60
use_retained_program_state=0
interval_length=20
use_agressive_host_checking=0
execute_service_checks=1
accept_passive_service_checks=1
enable_notifications=1
enable_event_handlers=1
process_performance_data=0
obsess_over_services=0
check_for_orphaned_services=0
check_service_freshness=1
freshness_check_interval=60
aggregate_status_updates=1
status_update_interval=15
enable_flap_detection=1
low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0
date_format=us
illegal_object_name_chars=`~!$%^&*|’”<>?,()=
illegal_macro_output_chars=`~$&|’”<>
admin_email=you@yourdomain.com
admin_pager=you@yourdomain.com
——————————————————————————————

Add the list of servers that you want to monitor in
/usr/local/nagios/etc/hosts.cfg

——————————————————————————————
# ’server42′ host definition
define host{
use generic-host
host_name (server hostname)
alias (hostname)
address IP Address
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24×7
notification_options d,u,r
}
# ’server43…..

——————————————————————————————

Edit /usr/local/nagios/etc/hostgroups.cfg to add all the servers.

——————————————————————————————
define hostgroup{
hostgroup_name tchosting
alias TotalChoice
contact_groups tchosting
members server40,server41,server42
}
—————————————————————————————–

To setup email and pager notifications edit
/usr/local/nagios/etc/contacts.cfg to add your contact info.

—————————————————————————————–
define contact{
contact_name Ninad
alias ninad
service_notification_period 24×7
host_notification_period 24×7
service_notification_options n
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email ninads123@yahoo.com
}
—————————————————————————————–

The contact name must be a member of contact group. Edit
/usr/local/nagios/etc/contactgroups.cfg to add your name.

Enjoy

Ninad

zlib installation

wget http://www.zlib.net/zlib-1.2.3.tar.gz

tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

Enjoy

Ninad S

Missing DNS zone ?

If you are facing issue related to missing DNS zone with cpanel update do the following:

/scripts/perlinstaller Compress::Raw::Zlib
/scripts/perlinstaller –force Scalar::Util

This should fix the issue.

Enjoy

Ninad S

Wednesday, May 9, 2007

WHM not updating quotas

The binary /usr/sbin/repquota must be missing onthe server which is used by the Cpanel script /usr/local/cpanel/bin/cachedrepquota to write to the file
/var/cpanel/repquota.cache.

After copying this binary and executing this script and restarting Cpaneld ,
the issue should be resolved.

Enjoy

Ninad S

Accounts missing from WHM

There are a lot of causes if the accounts in the server are missing from WHM-->list accounts.

Any of the following will cause the issue.

1) The account is missing from httpd.conf

2) The account has no cpanel user file.

3) The account is not there in the following files.
/etc/localdomains, /etc/userdomains, /etc/trueuserdomains and /etc/trueuserowners

/etc/trueuserowners file specifies the owner of each accounts in the following manner.

user: owner

4) If the account's DNS conflicts. ie if the domain has 2 DNS entries such as domainname and www.domainname. It may cause the account not listed in WHM-->list accounts.

You can run the following script if the account is missing.

/scripts/updateuserdomains (It won't add the account in httpd.conf, that
you have to add manually)

Enjoy

Ninad S

Not able to view JSP pages

If you are getting code instead of JSP page then you need to install servlets.

To install servlet go to the WHM >> Account Functions >> Install Servlets. Select domain and install.

After doing this you need to restart tomcat.

Now you will be able to view JSP pages.

Enjoy

Ninad S

Sunday, May 6, 2007

Enabling FP extensions for an addon domain

HowTo enable FP extensions for an addon domain
——————————————————————-
A) We won’t be able to install FP extensions on addon domain basically for
two reasons.

1) There won’t be a ServerName entry for the addon domain in the Apache config file and hence the install program will show an error like
the “domain” is not a valid virtual server.

2) FrontPage extension install program won’t install extensions in a directory which comes under another domains web root having FP extensions already installed.

To overcome these hurdles you can do the following.

1) Comment out the existing ServerName entry for the subdomain.

2) Create a new ServerName entry for in the corresponding subdomain’s VirtualHost entry.

3) Create a temporary folder in the document root of main domain and MOVE all .htaccess* and _* files from public_html in to the new directory.

4) Remove the _* and .htaccess files(created by FP) from the addon domain’s folder.

5) Verify the access.conf file in apache config directory and ensure that the AllowOverride directive is set to ‘All’. Some times this will not be enough for us to continue, hence, you have to make sure that the AllowOverride is set to ‘All’(by default it will
be ‘None’) in Apache config file.
Change only the directive inside entry.

6) Restart Apache and run the install program from back end.

#/usr/local/frontpage/version5.0/bin/owsadm.exe -o install -u $USERNAME -xuser $USERNAME -xgroup $USERNAME -p 80 -m $DOMAIN -pw $PASSWORD -s /usr/local/apache/conf/httpd.conf
where
$USERNAME give control panel login name
$DOMAIN give addon domain use www.addon.com
$PASSWORD choose a password

7) Restore the changes you made in the Apache config file.

Cool Move the .htaccess* and _* files from the backup directory (main domain web root).

If you are still having problems with connecting to the server using
FrontPage please make sure that the server name is http://www.addondomainname and you may also want to close the FP program and
start again to clear cache.

Enjoy

Ninad S

WHM not updating quotas

The binary /usr/sbin/repquota is missing onthe server which is used by the Cpanel script /usr/local/cpanel/bin/cachedrepquota to write to the file
/var/cpanel/repquota.cache.

After copying this binary and executing this script and restarting Cpanel ,
the issue should be resolved.

Enjoy

Ninad S

Synchronize time on Cpanel servers

Command to Synchronize time on Cpanel servers

rdate -s rdate.cpanel.net

Enjoy

Ninad S

PHP5 install as CGI

1) Download PHP 5.1.2 and do the usual

cd /usr/local/src
http://www.php.net/get/php-5.2.1.tar.bz2/from/a/mirror
tar -jxvf php-5.2.1.tar.bz2

2) Compile php as in a new directory such as /usr/local/php5

Use the same ./configure line required but with the following changes:

–with-config-file-path=/usr/local/php5/etc –prefix=/usr/local/php5 –with-mysqli=/usr/bin/mysql_config (only with Mysql 4.1)

3) Compile and install
make
make install

IMP Steps :

cp php.ini-dist /usr/local/php5/etc/php.ini
cp /usr/local/php5/bin/php /usr/local/cpanel/cgi-sys/php5
chown root:wheel /usr/local/cpanel/cgi-sys/php5

4) Edit httpd.conf and add lines below::

AddHandler application/x-http-php5 .php5
Action application/x-http-php5 /cgi-sys/php5

Just use .php5 and it will invoke php5.

Enjoy

Ninad S

How do I check how many messages are in the mail queue?

This can be done by typing in the following command:
Standard:
/usr/local/psa/qmail/bin/qmail-qstat
RPM:
/var/qmail/bin/qmail-qstat

Enjoy

Ninad S

Disable PHP Functions

Edit php.ini

Comment out the original disable_functions, then put this underneath

disable_functions = dl,passthru,proc_open,proc_close,shell_exec,system

/etc/rc.d/init.d/httpd restart

Enjoy

Ninad S

How to disable mod_security for an individual account ?

If you are receiving the error for mod_security, access denied with error code 403 when you check the error logs for any account. You can disable the mod_security for that account by adding a simple code in his .htaccess

==================

SecFilterEngine Off
SecFilterScanPOST Off

==================

Enjoy

Ninad S

How to Update stats on Plesk server

Run the following command to update stats on plesk server.

/usr/local/psa/admin/sbin/statistics

Enjoy

Ninad S

How to Install RvSkin

Installation

Create a account from whm called rvskin.com

1. SSH as root to server that was registered while purchasing the license and run:

mkdir /root/rvadmin

cd /root/rvadmin

wget http://download.rvglobalsoft.com/download.php/download/rvskin-auto/saveto/rvauto.tar.bz2; bunzip2 -d rvauto.tar.bz2; tar -xvf rvauto.tar; perl /root/rvadmin/auto_rvskin.pl

Answer a couple of questions on your shell, and wait until it finishes. First installation will take 2- 5 minutes to install. Installer will create a new hosting account ‘rvadmin’. Don’t terminate it. It will be used for internal RVSkin configuration management.

2. Log in to RVSkin Manager. Both root and reseller are able to access RVSkin Manager in WHM / Add-ons (at the bottom left menu). If you cannot find the RVSkin Manager menu, please close WHM and open it again.

If there is no messages display on the skin, please run this command on your SSH.

rm -f /usr/local/cpanel/Cpanel/rvversion
perl /root/rvadmin/auto_rvskin.pl

3. In RVSkin Manager:

* Set global configuration
* Set default language
* Create defaul feature list for user and for reseller
* Set tweak setting, reseller feature control, body links, top links, help, tutorial links, and etc.
* Test configuration setting in 2 hosting accounts.
* rvadmin: this account can consider to be account belong to root
*reseller’s client: this account will reflect setting from reseller skin manager. If it is not configued, it will remain anonymous.

4. Change user cPanel to RVSkin themes
5. Change cPanel language to the new language

Enjoy.

Ninad S

How to enable/disable PING

To Enable PING on the server

echo “0″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all

To Disable PING on the server

echo “1″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all

Enjoy

Ninad S

RAM disk

A RAM disk is a portion of RAM which is being used as if it were a disk drive. RAM disks have fixed sizes, and act like regular disk partitions. Access time is much faster for a RAM disk than for a real, physical disk. However, any data stored on a RAM disk is lost when the system is shut down or powered off. RAM disks can be a great place to store temporary data.The Linux kernel version 2.4 has built-in support for ramdisks. Ramdisks are useful for a number of things, including:

  • Working with the unencrypted data from encrypted documents
  • Serving certain types of web content
  • Mounting Loopback file systems (such as run-from-floppy/CD distributions)

Ninad S

Steps for Kernel Upgrade

Following are steps to upgrade kernel on live servers.

1. Check current version of kernel on server using command uname -a, if
its 2.4 then download latest release for 2.4 please do not download 2.6
kernel.
You can download kernel from
http://www.kernel.org/pub/linux/kernel/v2.6/
if its 2.4 then http://www.kernel.org/pub/linux/kernel/v2.4/, you can
check latest stable release from http://www.kernel.org

2. wget kernel in /usr/local/src
3. untar it using tar -zxvf linux-2.x-xxxx
4. cd linux-2.x-x
5. make clean
6. make mrproper
7. If kernel is 2.4 then copy current version of config file from
/boot/config-’uname-r’ as .config in /usr/local/src/linux-2.x-xx, if
kernel is 2.6 then you do not need to make .config in current directory
8. make menuconfig, select and check if all required modules are
selected,
also make sure that your kernel supports multiple cpu
you can check it and select from processor type, if it displays support
for more then 2 kernel then you do not need to modify anything there.
9. save configuration and exit
10. make modules if kernel is 2.4 then need to run make dep before
running
make modules
11. make modules_install
12. make
13. if 2.4 kernel then need to run make bzImage and then make install,
you can directly run make install if kernel is 2.6
15. now make sure bootloader and modify default kernel accordingly
grubby –bootloader-probe if it displays grub then edit /etc/grub.conf
and
if its lilo then edit lilo.conf and make compiled kernel as default
kernel
16. If your boot loader is lilo then you need to run one more command
/sbin/lilo which will update lilo
17. now its time to reboot server

Enjoy

Ninad S

Lost Mysql root password ?

Few Simple steps to change your mysql root password.

service mysql stop

wait until MySQL shuts down. Then run

mysqld_safe –skip-grant-tables &

then you will be able to login as root with no password.

mysql -uroot mysql

In MySQL command line prompt issue the following command:

UPDATE user SET password=PASSWORD(”abcd”) WHERE user=”root”;
FLUSH PRIVILEGES;

At this time your root password is reset to “abcd” and MySQL will now
know the privileges and you’ll be able to login with your new password:

mysql -uroot -pabcd mysql

Enjoy.

Ninad S

How do you password protect your pages?

Using a password protected folder. With this method, you create the passwords ans usernames, and let users (members) have them. This method is used when a limited number of users will use the site.

Go the cpanel >> Password protection >> Select the name of the directory that you wish to protect >> Check the folder requires a password to access via http:// give a name such as Members now go back and create a user and password. Now when visitors will create this directory they will be prompted for username and password.

Enjoy
Ninad S

Using RPM

Installing software (rpm -i)
rpm -ivh package.rpm

Uninstalling software (rpm -e)
rpm -e software name

Updating packages (rpm -U)

Note :: This will uninstall and install the new package avoiding this annoying messages. It is also usual to install packages with –U flag in this way:

rpm -Uvh software.rpm

Ninad S

How to Install Mod_evasive

cd /root

wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz

tar xvfz mod_ev*

cd mod_evasive*

CPANEL & Apache 1

/usr/local/apache/bin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

CPANEL & Apache 2

/usr/local/apache/bin/apxs -i -a -c mod_evasive20.c

/etc/init.d/httpd restart

PLESK & Apache 1

/usr/sbin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

PLESK & Apache 2

/usr/sbin/apxs -i -a -c mod_evasive20.c

/etc/rc.d/init.d/httpd restart

Enjoy.

Ninad S

To view Stats without login to cpanel

You can view webalizer stats without login to your cpanel.

cd /home/user/www
mkdir stats
cd stats
ln -s /home/user/tmp/webalizer webalizer
cd ../
chown -R user:user stats
cd ../
chmod -R 0775 tmp

You can access it as http://domain/stats/

Enjoy.

Ninad S

Port Forwarding

To forward port 411 to port 4411

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx –dport 411 -j DNAT –to xxx.xxx.xxx.xxx:4411

/sbin/iptables -A FORWARD -p tcp -i eth0 -d xxx.xxx.xxx.xxx –dport 4411 -j ACCEPT

Enjoy.

Ninad S

Cpanel license error

If you are getting cpanel license error then run this command

/usr/local/cpanel/cpkeyclt

If that doesnt clear it the first time, remove the file called “lisc” in
/usr/local/cpanel and then run that cpkeyclt again

Enjoy.

Ninad S

Zend Optimizer

For i386
wget http://downloads.zend.com/optimizer/3.0.2/ZendOptimizer-3.0.2-linux-glibc21-i386.tar.gz
tar xvfz ZendOptimizer-3.0.2-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.2-linux-glibc21-i386
./install.sh

For x86_64
wget http://downloads.zend.com/optimizer/3.0.1/ZendOptimizer-3.0.1-linux-glibc23-x86_64.tar.gz
tar xvfz ZendOptimizer-3.0.1-linux-glibc23-x86_64.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc23-x86_64
./install.sh

Enjoy.

Ninad S

Eaccelerator

cd /usr/local/src
mkdir ea
cd ea
wget http://kent.dl.sourceforge.net/sourc…r-0.9.5.tar.gz

tar zxvf eaccelerator-0.9.5.tar

cd eaccelerator-0.9.5

export PHP_PREFIX=”/usr”
$PHP_PREFIX/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
make
make install

For PLESK: vi /etc/php.ini

For CPANEL: vi /usr/local/lib/php.ini

If Zend is already installed, vi /usr/local/Zend/etc/php.ini

Find this:

;Windows Extensions

Above this, comment out the PHPA or ZEND lines if you have them. Replace them with this:

zend_extension=”/usr/local/src/ea/eaccelerator-0.9.5/modules/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

mkdir /tmp/eaccelerator

chmod 0777 /tmp/eaccelerator

service httpd restart

Enjoy.

Ninad S


Lame Server Resolve

service named stop

vi /etc/named.conf

add the three lines at the top

logging {

category lame-servers { null; };

};

service named restart

Enjoy.

Ninad S

Open DNS Servers

vi /etc/named.conf

Before the line that says “directory /var/named”; (it could be /var, /var/named, etc)
Put:
recursion no;

service named restart

Make sure you can ping yahoo.com and google.com afterwards.

Enjoy.

Ninad S

Configuring APF Firewall

cd /usr/local/src
wget http://rfxnetworks.com/downloads/apf-current.tar.gz
tar -zxf apf-current.tar.gz
cd apf-0.*
./install.sh

Now edit config file
vi /etc/apf/conf.apf
Scroll down to the “Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.

IG_TCP_CPORTS=”20,21,22,25,26,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096″
IG_UDP_CPORTS=”21,53,873″

EGF=”1″
EG_TCP_CPORTS=”21,22,25,26,27,37,43,53,80,110,113,443,465,873,2089″
EG_UDP_CPORTS=”20,21,37,53,873″

save the file
start apf
apf -s
If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!
DEVEL_MODE=”0″

restart APF
apf -r

Enjoy.

Ninad S

SIM (System Integrity Monitor)

How to Install SIM

Login to your server via SSH as root.

wget http://www.r-fx.org/downloads/sim-current.tar.gz

tar xvfz sim-3*.gz

cd sim-3.0

./install.sh -i

Type

sim -j

If ifconfig is not eth0 (eg eth1, or venet0)

nano -w /etc/conf.sim

Enjoy.

Ninad S

Install Chkrootkit

cd /root

wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

tar xvzf chkrootkit.tar.gz

mv chkrootkit-* chkrootkit

cd chkrootkit

make sense

Enjoy

Ninad


View My Stats