Sunday, November 1, 2009
SSHD Failed
sshd dead but subsys locked
Do the following
remove /dev/null
and then: "mknod /dev/null c 1 3"
this will create the /dev/null and sshd should start as normal.
Thanks
Ninad
GeoIP installation for Linux
Download the current GeoLite Country, GeoLite City and Organization (AS Numbers) databases
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
Create GeoIP data directory if it doesn't already existif [ ! -d /usr/local/share/GeoIP ] ; thenMove data files to directory and unzip.
mkdir /usr/local/share/GeoIP
fimv GeoIP.dat.gz /usr/local/share/GeoIP/
gunzip /usr/local/share/GeoIP/GeoIP.dat.gz
mv GeoLiteCity.dat.gz /usr/local/share/GeoIP/
gunzip /usr/local/share/GeoIP/GeoLiteCity.dat.gz
mv GeoIPASNum.dat.gz /usr/local/share/GeoIP/
Install the GeoIP program.
There are two options:
- Install a C program and a Perl program
- Install just a Perl program.
Option a) will provide the fastest performance.
The instructions for a) are known to work using Fedora Core 6 - FC6.
- Install GeoIP C API http://www.maxmind.com/app/c
Download the GeoIP-*.tar.gz file, uncompress it and compile.
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz
tar -xvzf GeoIP-1.4.5.tar.gz
cd GeoIP-1.4.5
./configure
make
make check
2007-10-10: Thanks to James Rice who notified us of version 1.4.3. 2007-02-21: Thanks to Daniel Wallace who notified us of version 1.4.2. 2007-01-13: Thanks to Daniel Wallace who notified us of version 1.4.1. 2006-09-25: Thanks to Oleg Nerus who notified us of version 1.4.0. 2006-05-21: Thanks to Florian Burka who notified us of the availability of version 1.3.17.
With a text editor, add the directory libGeoIP.so was installed in, i.e. /usr/local/lib, to /etc/ld.so.conf, and execute ldconfig
- Install Geo::IP Perl Module
Download the Geo-IP-*.tar.gz file, uncompress it and compile.
wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.35.tar.gz
tar -xvzf Geo-IP-1.35.tar.gz
cd Geo-IP-1.35
perl Makefile.PL LIBS='-L/usr/local/lib'
make
make test
Option b) (in lieu of option a!)
PurePerl Module (is slower, but does not require C library). Download latest Geo-IP-PurePerl-*.tar.gz file, uncompress and compile. Replace the version below with the current version.
wget http://www.maxmind.com/download/geoip/api/pureperl/Geo-IP-PurePerl-1.17.tar.gz tar -xvzf Geo-IP-PurePerl-1.17.tar.gz -C /usr/local/src/ cd /usr/local/src/Geo-IP-PurePerl-1.17 perl Makefile.PL make make test make installUpdate your awstats.mysite.conf configuration file
Look for the following geoip LoadPlugin options in your AWStats configuration file. Update them with the full path to each of the two database files.
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoIPASNum.dat"
sudo make install
sudo make install
gunzip /usr/local/share/GeoIP/GeoIPASNum.dat.gz
Source : Antezeta
Friday, October 30, 2009
How to take backup of your mysql database
# mysqldump database_name > backup.sql
For example ninad_ninad is the database name
command will be
#mysqldump ninad_ninad > ninad_ninad_old.sql
backup created in ninad_ninad_old.sql
Now restore it
first create an emtpy database
#mkdir ninad_ninad
Correct ownership
#chown mysql.mysql ninad_ninad
#mysql databasename < backup.sql
it will be
#mysql ninad_ninad < ninad_ninad_old.sql
Thanks
Ninad
Thursday, October 29, 2009
How to check suPHP version
Run the command
find / -name suphp
Once you have found the binary, run the following:
/path/to/suphp
It should produce a result along the lines of:
suPHP version 0.6.3
Thanks
Ninad
suPHP on Plesk
**Make sure yum is installed on the server as it will help to install the dependencies.
1) To get the latest version of mod_suphp RPM enable the Atomic Repository for Yum. This can be done using Following command
# wget -q -O - Path to RPM
Note : Path may get changed.
Better to get from http://rpm.pbone.net/index.php3/stat/4/idpl/1027655/com/apache2-mod_php-2.0.48_4.3.4-3sls.i586.rpm.html
2) After this mod_suPHP can be installed using command “yum install mod_php”
Configuration:
Once mod_suphp is installed, you will have to configure it with Apache.
1) First you will have to create a suphp.conf file in /etc/httpd/conf.d/ Directory and Paste the following code
LoadModule suphp_module modules/mod_suphp.so
php_admin_value engine off
suPHP_Engine On
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
2) Restart Apache Service using command “service httpd restart”
3) Now you will have to creae suphp configuration file. So, create a new file in /etc directory named “suphp.conf” (rename the existing file and create a new one) and add following lines in it:
[global]
logfile=/var/log/suphp.log
loglevel=info
webserver_user=apache
docroot=/var/www/vhosts
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false
check_vhost_docroot=false
errors_to_browser=false
env_path=/bin:/usr/bin
umask=0022
min_uid=30
min_gid=30
[handlers]
x-httpd-php=php:/usr/bin/php-cgi
x-suphp-cgi=execute:!self
4) Restart Apache once more i.e. “service httpd restart”
Thanks
Ninad
Wednesday, October 28, 2009
Fantastico Error
Run the script
/scripts/makecpphp
Thanks
Ninad
Command to find CPU usage of process
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
This will show the process which are consuming max CPU
