Categories

Tuesday 23 April 2013

php_network_getaddress: getaddrinfo failed.

Hello,

 If you face the error as php_network_getaddress: getaddrinfo failed. on using file_get_contents on php

Then first check if fopen is enabled on php
else enable alloe_url_fopen on php.ini of the server and restart apache

If it is still not fixed, check the resolver configurations
change the name servers to google's one in /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Then load the code . If still not fixed , then do the following in /etc/hosts.

127.0.0.1 yourdomainname:80
 
Replace  yourdomainname with the server's hostname

This will fix the issue..


Regards
Syamkumar.M

Tuesday 16 April 2013

How to fix PROFTPD login failed error

Hello,


If you got incorrect password  on proftpd after installing the package succesfully  and created a user correctly.


First check /var/log/messages


The error for me is as follows.


Apr 16 15:04:15 backup1 proftpd[14860]: ) - FTP session opened.
Apr 16 15:04:14 backup1 proftpd[14837]: - FTP session closed.


Then check the /var/log/secure


If you see error as
USER ftpuser (Login failed): Incorrect password.
Apr 16 14:56:45 backup1 proftpd: PAM unable to dlopen(/lib64/security/pam_stack.so): /lib64/security/pam_stack.so: cannot open shared object file: No such file or directory


PAM adding faulty module: /lib64/security/pam_stack.so


Then it is due to some incorrect settings on the default pam security settings of proftpd in


/etc/pam.d/proftpd


take a backup of it and then replace all the codes with below settings


#%PAM-1.0M-1.0
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_shells.so
auth include system-auth
account include system-auth
#session include system-auth
session required pam_loginuid.so
Then save the file and restart proftpd service


Then try to login with the created user. You should be able to login.

Reference-http://blog.redbranch.net/2012/04/17/proftpd-centos-6-pam-unable-to-dlopen-lib64securitypam_stack-so/


Regards
Syamkumar.M

Sunday 14 April 2013

How to Reinstall Perl to fix perl errors .

Hello,


  Some times we need to reinstall perl on the Cpanel server due if existing perl package is no longer working.

common errors are as follows.
------------------------------------
Error
------------
frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missing requires of libasound.so.2()(64bit)
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missing requires of libasound.so.2(ALSA_0.9)(64bit)
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missinrl error on Cpanel server .
If you got the error “! Failed to install CPAN Perl module(s) Crypt::PasswdMD5 !!I”error


---------------------------------


First try to fix it by running cpanel perl script /scripts/fixperl

if that doesn't do it you'll need a complete perl reinstall so do the following:

wget http://httpupdate.cpanel.net/perl588installer.tar.gz
tar xzvf perl588installer.tar.gz
rm -rf perl588installer.tar.gz (skip this if you want to keep the tarball)
cd perl588installer/
./install

it'll take awhile but when it's done it should be fixed. 

If it still not fixed, then do the following steps.

-----------------------------------
Reinstall Perl
Get latest source from http://search.cpan.org/dist/perl/ , unarchive and go to that folder.

yum install make gcc
sh Configure -de -Dusethreads
make && make test && make install
cd /usr/bin
mv perl perl-backup
ln -s /usr/local/bin/perl perl

Reinstall Cpanel and Fix accounts

/scripts/upcp –force
/scripts/fixhome
/scripts/chownpublichtmls
-------------------------------


Regards
Syamkumar.M

Friday 12 April 2013

How to fix sendmail error on Ubuntu

Hello,

 If you ever face below error on running sendmail on the Ubuntu server. Then please do the following fix.

error
-------------------
/etc/mail/sendmail.cf: line 100: fileclass: cannot open '/etc/mail/local-host-names': Group writable directory
-----------------------

Make a copy of  /etc/mail/sendmail.cf on the server before we edit it.

Fix
------------------------

Replacing line Fw/etc/mail/ local-host-names with line Fw-o /etc/mail/local-host-names in sendmail.cf, and Ft/etc/mail/trusted-users with line Ft-o /etc/mail/trusted-users in submit.cf and sendmail.cf.

save the file after making the above changes and then restart it.
-----------------------

Reference-
http://forums.fedoraforum.org/archive/index.php/t-199647.html



Regards
Syamkumar.M

 

Tuesday 9 April 2013

Xen Vps showing offline after creating it from Solusvm

Hello,

If you are not able to create para virtualized Xen containers from your solusvm control panel, please follow the below procedure.

First check the xen configuration file which will be in /home/xen/vmid/vmid.conf
If it exist then try to start the container with the command xm create /home/xen/vmid/vmid.conf


it will show the exact error or you can refer the error log of xen which is /var/log/xen/xend.log

If you get error as disk image not found then check the image file on the server which will be in /dev/mapper/vmid.img. IF it doen't exist then there should be some issue with configuration of xen vms in the solusvm.

For me below step fixed.

1) I compared the configuration file of newly created xen vps with one which is running and created before. I found difference in the parameters defined in the configuraiton files(/home/xen/vmid/vmid.cfg)

The difference is that kernal and initrd images are different, also the hard disk is showing as sda instead of xvda(xen virtual device)

2)Then check the solusvm xen advanced configuration file /usr/local/solusvm/data/advanced.conf. I found it empty on the slave node where iam creating vps
3) But on the master node the file usr/local/solusvm/data/advanced.conf contains all the data.
4)just copy the configuraiton file from master and copy to the slave node
5)Then restart the solusvm service using the command
/etc/init.d/solsuvm restart
6)then delete and recreated the new vps
7)server should be created and online now.

Saturday 6 April 2013

How to reset Xen Root password if it is not changing from SolusVM control Pannel

Hello,

  Some times One of the Xen VPS became in accessibe thriough ssh and we are not able to change the Root password through SolusVM. Then please follow the steps mentioned below to reset the root password.

1)First Stop the container using command(xm shutdown CTID) or through solusvm
2)Secondly find the the the Xen image location  of the VPS which is /dev/mapper/xen-vm369_img(example)
3)create a directory name test and then mount the image to it using command
 mount /dev/mapper/xen-vm369_img /test
4)then change the root environment to test using the command
 chroot /test
5)Now the root environment will be same as that of Xen VPS which we have mounted
6)Then change the root password of root using passwd command.
passwd root
7)Then exit from the root environment by typing the command exit and unmount the /test directory using umount /test
8)Reboot the server in solusvm

Now you will be able to ssh into the server with the new password

Regards
Syamkumar.M 

Friday 5 April 2013

How to install Geo IP module for apache(Especially in a Cpanel Server) to block sites in different countires

 Hello,

 Geo IP module is used to block access for certain countries to the websites. This is done by a module named mod_Geoip on the apache. Below is the steps to enable and configure Geo IP on a Cpanel linux servers .

 1.Install GeoIP binaries:

    yum install GeoIP GeoIP-devel

2.You can download  more databases from MaxMind and put them into /opt/geoip/share/GeoIP/:

    http://geolite.maxmind.com/download/geoip/database/

3.install CPanel EasyApache GeoIP module:

    View details: http://www.cpanel.net/apps/easyapache/custom.html
    Download mod_GeoIP:

    wget http://easyapache.cpanel.net/optmods/custom_opt_mod-mod_geoip.tar.gz

    tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz}
Steps 2 and 3 are optional as Geo IP module is already enabled on the easy apache.

4.    Run EasyApache and select mod GeoIP:

    /scripts/easyapache

5.configure GeoIP by adding to httpd.conf (or pre_virtualhost_global.conf):

    /usr/local/apache/conf/httpd.conf
    /usr/local/apache/conf/includes/pre_virtualhost_global.conf

LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /var/lib/GeoIP.dat
</IfModule> 
6.Install GeoIP PHP Extension:

    Install geoip via PECL:

    pecl install geoip

7.Restart Apache:

    /scripts/restartsrv_apache


8.After this has been done we can test if the Geo IP was enabled by adding some rules on .htaccess of a website .

edit .htaccess of a website and add the following lines to it

SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese
SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese
# Add more countries here
Deny from env=BlockThese

A full list of 2 digit country codes can be found here: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm

The above listed in the example are "CN = China" and "TR = Turkey"


Regards
Syamkumar.M



Cacti Server monitoring Tool Installation on Centos

Cacti
----------

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

All the Steps for the installation of Cacti Software was mentioned in the link http://www.cyberciti.biz/faq/fedora-rhel-install-cacti-monitoring-rrd-software/.

 Please follow the steps one by one.

Regards
Syamkumar.M

How to remove Banned IP from the Cpanel Cphulkd and from the WHMCS

Hello,

 some times your IP got banned on cpanel or WHMCS  due to invalid login attempts . Usually if you type the the username and password incorrectly for more than 3 times then then your IP will get blocked on CPhulkd Database.

Same is the case with WHMCS. IP will get blocked on the table named tblbannedips on the WHMCS databases.

To unblock the IP please doe the following steps .

For Cphulkd
---------------

Login to mysql on the server as root user  and connect to the cphulkd database.

mysql> use cphulkd;

You will now connect to database cphulkd. Now type in sql query
just to confirm if your IP is really blocked there.
mysql> SELECT * FROM `brutes` WHERE `IP`=’x.x.x.x’;

It will list your IP if it got blocked . The next step is to unblock the IP using the below command.

mysql> DELETE FROM `brutes` WHERE `IP`=’x.x.x.x’;
once it done quit the mysql by typing
mysql> quit
In this way your IP will be removed from brute force

For WHMCS
--------------
For whmcs identify the database used by whmcs appication.

Then select the database from mysql

mysql> use example_whmcs
Issue the command

select * from `tblbannedips` WHERE `IP`=’x.x.x.x’;

It will list your IP.

Then remove the IP using the command as below

DELETE  FROM  tblbannedips WHERE  ip='x.x.x.x.';

Then  you will be able to access your WHMCS

Regards
Syamkumar.M





How to rescue openvz from File System corruptions

Hello,

 Some times File System in linux server may got corrupted . Suppose that /vz partition got corrupted in OpenVZ Hardware node. Then Please follow the below the steps to fix it.

You will see the file system errors in /var/log/messages and on dmesg.
Also on issuing the command df -h on the server, it will show incorrect Disk statistics if the File system is corrupted. Some times partition will show as 100% even though there is enough free space.

If /vz partition is corrupted..

Then at first stop vz service which is openvz service by command /etc/init.d/vz stop
After that unmount /vz partition using the command
umount /vz

Some times /vz partition won't un mount properly if there is some qoata issues are there on any of the Virtual Machines.

Don't use lazy unmount for unmounting it (umount -l /vz). Even if it shows as unmounted , fsck fail to run showing error as still it is mounted.

If such issue persists, then either reboot the server and enter into single user mode and run fsck on the server if you have KVM details from the DC.

If you don't have KVM details, then open /etc/fstab using the command vi /etc/fstab
Then comment out the entry of the partition /vz on it and then reboot the server

Wait for few minutes for the server to be online. As the /vz partition is commented out , it is automatically disabled when the server boots up.

ensure that /vz is unmounted using either the command mount or df -h

After that Run the fsck command as below.

fsck -fyC /vz

Always run the command on screen (screen -S fsck)


It will take some time for the task to complete depending upon size of the partition. Once it completes check the server using commands df -h. If it shows the correct disk statistics, then the issue has been fixed.

Regards


Thursday 4 April 2013

Commands to Fix Permission on Linux Server

Hello,

To fix the permission of all the files on the linux server especially for files inside public_html(Cpanel) ,then please do the following steps .

cd Directory

Then issue the command for files

find . -type f -exec chmod 644 {} \;


For directories


find . -type d -exec chmod 755 {} \;



Regards

Syam



 




Use Full tips to find out load issues on the Linux Server(Server with Cpanel as well)

Finding Load causing connections and users

Below are certail scripts the user that is causing the load and for finding the procees,ip which has high cpu usage.

To check number of IPs connected to port 80
# netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head

To list number of connections to domains in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | awk  'BEGIN { FS = ” ” } ; { print $12 }' | sed '/^$/d' | sort | uniq -c | sort -n

To list the Busiest Site in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $12}' | sort | uniq -c | sort -rn | head

To list the Busiest Script running on the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $14}' | sort | uniq -c | sort -rn | head

To list the most running process in the server
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1 | tail -n5

To list the total process running by the users
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1

When we see the process in the top result with “php” or “/usr/bin/php”, we can find the directory it is working with. You can use,
# for i in `ps -ef | awk '/php/{print $2}'`; do ls -l /proc/${i}/cwd; done

We can even check this dynamically with in a particular time limit, say 5 sec. We can use it as below.
# while true; do clear; for i in `ps -ef | awk '/php/{print $2}'`;do ls -l /proc/${i}/cwd; done; sleep 5; done

Ubuntu 12.04 OpenVz template issue in kernal 2.6.18-308.el5.028stab099.3

Hello,

 If you are running kernal  2.6.18-308.el5.028stab099.3 openvz. Then VM built with template ubuntu 12.04 won't boot with the error as FATAL: kernel too old.

To fix the issue, First add the ubuntu12.04 with latest kernal in the file named /etc/vz/osrelease.conf on the hardware node.

ubuntu-12.04    2.6.32

Another option is that

cd /proc/sys/kernel/
 cat virt_osrelease
 2.6.18-238.5.1.el5.028stab085.5

 echo 2.6.32 > virt_osrelease

Then restart the ubuntu VPS which will start the  VPS.

 But there will be problem with network.

 on restarting the network you may get the error as ifdown: failed to open statefile /run/network/ifstate: No such file or directory

Just manually create  the folder named /run/network/ on th virtual machine and then restart the network which will fix the issue.

Regards

Ad