Thursday 27 December 2012

How to enable PPP Module to a VPS on OpenVZ

Steps to Enable PPP Module in a VPS:

To enable PPP module on a VPS, the Hardware Node should have the following module enabled.
*HN means Hardware Node

HN # modprobe ppp_async
HN # modprobe ppp_deflate
HN # lsmod | grep ppp
ppp_deflate             9793  2
zlib_deflate           21977  1 ppp_deflate
ppp_async              15169  1
crc_ccitt               6337  1 ppp_async
ppp_generic            30165  6 ppp_deflate,ppp_async
slhc                   10561  1 ppp_generic


HN # vzctl stop [VEnumber]
HN # vzctl set [VEnumber] --features ppp:on --save
HN # vzctl start [VEnumber]
HN # vzctl set [VEnumber] --devices c:108:0:rw --save

HN # vzctl exec [VEnumber] mknod /dev/ppp c 108 0
HN # vzctl exec [VEnumber] chmod 600 /dev/ppp


INSIDE THE VPS:
To check whether PPP is enabled or not:

VE# /usr/sbin/pppd

You should see gibberish in the standard output like
~�}#�!}!}!} }4}"}&} } } } }%}&)Q�}4}'}"}(}"p})



Sunday 23 December 2012

How to upgrade tomcat from 5.x to 7 on cpanel server


When you have installed tomcat by using Easy-Apache then it installed Tomcat 5.5 and if you want to installed Tomcat 7.0.34 then you need to made some necessary changes on the server.

1) First install Tomcat 5.5 by using Easy-Apache means java is also installed at the time of Easy-Apache. The Tomcat 5 is installed in /usr/local/jakarta/ directory with the symbolic link tomcat. For example:
[~]# ll /usr/local/jakarta
drwxr-xr-x 4 tomcat nobody 4096 Apr 5 17:15 ./
drwxr-xr-x 22 root root 4096 Mar 5 15:39 ../
drwxr-xr-x 12 tomcat nobody 4096 Apr 4 17:02 apache-tomcat-5.5.30/
lrwxrwxrwx 1 tomcat nobody 39 Apr 4 17:04 tomcat -> /usr/local/jakarta/apache-tomcat-5.5.30/


2) Then download and extract Tomcat 7 in /usr/local/jakarta directory
[~]# cd /usr/local/jakarta
[/usr/local/jakarta]# wget http://apache.cs.utah.edu/tomcat/tom...-7.0.34.tar.gz
[/usr/local/jakarta]# tar -xzvf apache-tomcat-7.0.34.tar.gz


3) Then Change the tomcat symbolic link to point to your new version (i.e. /usr/local/jakarta/apache-tomcat-7.0.34)
[/usr/local/jakarta]# ln -s /usr/local/jakarta/apache-tomcat-7.0.34 tomcat
Now it shows
[~]# ll /usr/local/jakarta
drwxr-xr-x 4 tomcat nobody 4096 Apr 5 17:15 ./
drwxr-xr-x 22 root root 4096 Mar 5 15:39 ../
drwxr-xr-x 12 tomcat nobody 4096 Apr 4 17:02 apache-tomcat-5.5.30/
drwxr-xr-x 9 tomcat nobody 4096 Apr 4 17:01 apache-tomcat-7.0.34/
lrwxrwxrwx 1 tomcat nobody 39 Apr 4 17:04 tomcat -> /usr/local/jakarta/apache-tomcat-7.0.34/

4) Then compile the new Tomcat version on cPanel server.
[~]# cd /usr/local/jakarta/apache-tomcat-7.0.34
[/usr/local/jakarta/apache-tomcat-7.0.34]# cd ./bin
[/usr/local/jakarta/apache-tomcat-7.0.34/bin]# tar xvfz commons-deamon-native.tar.gz
[/usr/local/jakarta/apache-tomcat-7.0.34/bin]# cd commons-daemon-1.0.x-native-src/unix
[/usr/local/jakarta/apache-tomcat-7.0.34/bin/commons-daemon-1.0.x-native-src/unix]# ./configure
[~]# make
[~]# cp jsvc ../..
[~]# cd ../../..

5) Copy over any Host blocks from /usr/local/jakarta/tomcat/conf/server.xml from the old Tomcat install to the new Tomcat install (you may or may not be able to set up new hosts through WHM).
Example: 
cp /usr/local/jakarta/apache-tomcat-5.5.30/conf/server.xml /usr/local/jakarta/tomcat/conf/

6) Copy over /usr/local/jakarta/tomcat/conf/workers.properties from the old Tomcat install to the new Tomcat install.
Example: 

# cp /usr/local/jakarta/apache-tomcat-5.5.30/conf/workers.properties /usr/local/jakarta/tomcat/conf/


7) Restart the server
[/]# reboot
Or
[/]# /usr/local/jakarta/tomcat/bin/shutdown.sh
[/]# /usr/local/jakarta/tomcat/bin/startup.sh
[/]# /etc/init.d/httpd restart

9) Check Tomcat Version
[/]# sh /usr/local/jakarta/tomcat/bin/version.sh
The cPanel EasyApache system makes it easy to recompile Apache with various add-ons and modules.
If you ever need your old Tomcat back just stop Tomcat, flip the tomcat symbolic link back to the old install, and restart Tomcat.



Sunday 2 December 2012

vzquota : (error) Quota on syscall for id 101: Device or resource busy

Quota on syscall for id, Device or resource busy on OpenVZ

Failing quota off with 'Device or resource busy' error means that some file from VE private area was in use: might be some process running on HN opened it or just somebody had an ssh session opened with current dir in /vz/private/101/..

Error:

#vzctl restart 101
Restarting container
Starting container...
vzquota : (error) Quota on syscall for id 101: Device or resource busy
vzquota : (error)       Possible reasons:
vzquota : (error)       - Container's root is already mounted
vzquota : (error)       - there are opened files inside Container's private area
vzquota : (error)       - your current working directory is inside Container's
vzquota : (error)         private area
vzquota : (error)       Currently used file(s):


Try this:

# lsof 2> /dev/null | egrep '/vz/root/101 | /vz/private/101'

If any process lists, then kill that process and start the VPS again.








Tuesday 20 November 2012

Error in Kloxo: Could not open database connection

You may get the below error while trying to access Kloxo Control Panel

"Could not open database connection" 

You can fix this by two ways, 

Fix 1:

Open your phpMyAdmin http://ip:7778/thirdparty/phpMyAdmin and enter the Root Login details.



Select the "Privileges"


Locate Kloxo  and select "Edit Privileges"


Click "Check All " options


Next, Go to the Bottom of the Page and select "password" and enter the password. 
Then Click "Go"

Thats it!!. Now Kloxo should work fine.


Fix 2:

mysql -u root -p
mysql> grant all on kloxo.* to kloxo@localhost identified by '{new password}';
mysql> flush privileges;
mysql> quit
cat "{new password}" > usr/local/lxlabs/kloxo/etc/conf/kloxo.pass
sh /script/restart




Friday 16 November 2012

ERROR! MySQL is running but PID file could not be found

You may get the below Error:

[root@server ~]# /etc/init.d/mysql status
ERROR! MySQL is running but PID file could not be found


Fix:


1.Check for mysql directory:

[root@server ~]# ll /var/run/mysql
ls: /var/run/mysql: No such file or directory


2.Create a mysql directory:

[root@server ~]# mkdir /var/run/mysql

3.Enter into the created directory:

[root@server ~]# cd /var/run/mysql/

4.Create the mysqld process id:

[root@server mysql]# touch mysqld.pid

5.Changing the ownership of mysqld.pid

[root@server mysql]# chown mysql:mysql mysqld.pid

6.Restart the MySQL:

[root@server mysql]# /etc/init.d/mysql restart
 ERROR! MySQL manager or server PID file could not be found!
Starting MySQL..................................................................                                                                     .................................. SUCCESS!



7.Check the Status of MySQL:

[root@server mysql]# /etc/init.d/mysql status
 SUCCESS! MySQL running (1583)
Thats it!!!




Tuesday 16 October 2012

Installing RKHunter on CentOS 5.x & 6.x

Steps to Installing RKHunter
#cd /usr/local/src
#wget http://nchc.dl.sourceforge.net/project/rkhunter/rkhunter/1.4.0/rkhunter-1.4.0.tar.gz
#tar -zxvf rkhunter-1.4.0.tar.gz
#cd rkhunter-1.4.0

#./installer.sh --layout default --install
#/usr/local/bin/rkhunter --update
#/usr/local/bin/rkhunter --propupd
#rm -Rf /usr/local/src/rkhunter*
#cd


Adding to Daily Cron

#vi /etc/cron.daily/rkhunter.sh


Add the Below text to rkhunter.sh

#!/bin/sh
(
/usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --cronjob --report-warnings-only
) | /bin/mail -s 'rkhunter Daily Run (PutYourServerNameHere)' your@email.here


Chmod rkhunter.sh to root only

#chmod 700 /etc/cron.daily/rkhunter.sh



Monday 15 October 2012

Error while installing CHKROOTKIT on CentOS 6

Error:
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make: *** [strings-static] Error 1


Fix:
yum install glibc-static


Install CHKROOTKIT on CentOS 5.x & 6.x


Steps to Install CHKROOTKIT on CentOS:

#cd /usr/local/src
#wget http://www.mediafire.com/download/9wj584qjffy9t25/chkrootkit.tar.gz
 or
#wget http://www.spenneberg.org/chkrootkit-mirror/files/chkrootkit.tar.gz
#tar -zxvf chkrootkit.tar.gz
#mkdir /usr/local/chkrootkit
#mv /usr/local/src/chkrootkit*/* /usr/local/chkrootkit
#cd /usr/local/chkrootkit
#make sense

Adding CHKROOTKIT to Daily Cron
#vi /etc/cron.daily/chkrootkit.sh

Add this text to the chkrootkit.sh file
#!/bin/sh
(
/usr/local/chkrootkit/chkrootkit
) | /bin/mail -s 'CHROOTKIT Daily Run (PutServerNameHere)' your@email.here
#chmod 700 /etc/cron.daily/chkrootkit.sh

Saturday 13 October 2012

Error in Named

Error:  /var/named/dynamic/managed-keys.bind.jnl: create: file not found  localhost named[17629]: managed-keys-zone ./IN: sync_keyzone:dns_journal_open -> unexpected error


Fix:
# mkdir /var/named/chroot/var/named/dynamic

# chown named:named /var/named/chroot/var/named/dynamic



Friday 21 September 2012

How to list all the Domains in Kloxo

From Kloxo Control Panel:

Go to Admin Home --> all domains


Command:

[root@server /]# /script/simplelist --resource=all_domain


Tuesday 4 September 2012

You don't have permission to access /PhpMyadmin on this server in DirectAdmin

You may get the Below error while trying to Access PhpMyadmin

Forbidden

You don't have permission to access /PhpMyadmin on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.



[root@server ]# tail -f /var/log/httpd/error_log
Error: Permission denied: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


First need to check the Directory Permissions.


[root@server ]# ls -ld /var/www
dr-xr-x--- 9 webapps apache 4096 Sep  2 14:43 /var/www

[root@server ]# chmod 755 /var/www

[root@server ]# ls -ld /var/www
drwxr-xr-x 9 webapps apache 4096 Sep  2 14:43 /var/www


When i changed the directory permissions, its worked for me !!!



Thursday 30 August 2012

vsftpd 530 permission denied root

In  vsftpd, You may get the below error while trying to connect FTP.

Response:    530 Permission denied.
Error:    Could not connect to server



First you need to check below files

1. /etc/vsftpd/ftpusers
2. /etc/vsftpd/vsftpd.conf
3.  /etc/vsftpd/user_list


If a user name is present in the "ftpusers" file, then the user is not allowed to login via ftp.
So, we need to remove the ftpusername from the "/etc/vsftpd/ftpusers" file.

Open the vsftpd configuration file "/etc/vsftpd/vsftpd.conf file"  and search for "userlist_deny="

If there is no such "userlist_deny=" , then add it to the "/etc/vsftpd/vsftpd.conf" file.
If  "userlist_deny=NO", only allow users in the file "/etc/vsftpd/user_list".
If "userlist_deny=YES" (default), never allow users in this file, and do not even prompt for a password.



[root@test ~]# cat /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.

Once you edited the configuration file, you need to restart the service.
[root@test ~]# /etc/init.d/vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]


Monday 30 July 2012

Spam Assassin Icon is Missing in cPanel

If the Spam Assassin Icon is Missing in your cPanel. 
 



You need to enable this option from your cPanel/WHM.

WHM > Tweak Settings > SpamAssassin > tick
WHM > Service Manager > spamd > tick both boxes





In WHM, Go to  Main >> Packages >> Feature Manager


Click the Edit Button under Edit Feature List



Select the Check Box to Spam Assassin  and Save it.



Now go to your cPanel Account , You can see the Spam Assassin Box under the "Mail"









ls: /proc/sys/net/ipv4/ip_conntrack_max: No such file or directory

[root@Node ~]# ll /proc/sys/net/ipv4/ip_conntrack_max
ls: /proc/sys/net/ipv4/ip_conntrack_max: No such file or directory



Maybe the module has not loaded.
Check whether the module loaded 


[root@Node ~]# lsmod | grep  ip_conntrack



If not loaded, then load the module as below.
[root@Node ~]# modprobe ip_conntrack

[root@Node ~]# ll /proc/sys/net/ipv4/ip_conntrack_max
-rw-r--r-- 1 root root 0 Apr 22 22:29 /proc/sys/net/ipv4/ip_conntrack_max

iptables: Unknown error 4294967295

OpenVPN connected but Internet is not working. 
While trying to do NAT, you may get the below error


[root@VPS ~]# iptables -t nat -A POSTROUTING -s 10.9.0.1/24 -o venet0 -j MASQUERADE
iptables: Unknown error 4294967295



Try like this:
iptables -t nat -A POSTROUTING -o venet0 -j SNAT --to-source #main ip

Sunday 29 July 2012

Error: vzquota : (warning) Incorrect quota shutdown for id 101, recalculating disk usage


[root@Node ~]# vzctl start 101
vzquota : (warning) Incorrect quota shutdown for id 101, recalculating disk usage


Try the Below steps.
[root@Node ~]# vzquota on 101
[root@Node ~]# vzquota off 101
[root@Node ~]# vzquota on 101
[root@Node ~]# vzctl start 101



Sunday 24 June 2012

How to Enable TUN/TAP Module in OpenVZ

OpenVZ supports VPN inside a container via kernel TUN/TAP module and device. To allow VPS #101 to use the TUN/TAP device the following should be done: 

#101 - VPS  id. Replace #101 with your VPS id.

Make sure the tun module has already loaded on the Node.
[root@Node /]#  lsmod | grep tun

If not listed, then load the tun module with the below command
[root@Node /]# modprobe tun

 [root@Node /]#  lsmod | grep tun
  tun                    82432  6

Run the following command in Node:
[root@Node /]#  vzctl set 101 --devnodes net/tun:rw --save
[root@Node /]#  vzctl set 101 --devices c:10:200:rw --save 
[root@Node /]#  vzctl stop 101 
[root@Node /]#  vzctl set 101 --capability net_admin:on --save
[root@Node /]#  vzctl start 101 
[root@Node /]#  vzctl exec 101 mkdir -p /dev/net
[root@Node /]#  vzctl exec 101 chmod 600 /dev/net/tun 

To check TUN/TAP is enabled or not :
[root@Node /]# vzctl enter 101
 
Inside the VPS: 
[root@vps /]# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state     # It means the TUN/TAP is enabled on your VPS.
 
 cat: /dev/net/tun: No such device     #  If you receive like this, then the TUN/TAP has not enabled on your VPS . Try to enable TUN/TAP again and check.
 

Source: http://wiki.openvz.org/VPN_via_the_TUN/TAP_device

Saturday 23 June 2012

Error: -bash: mail: command not found in CentOS

You may get this error while trying to send mail from ssh. It means the package is not installed. Try to send mail after installing the package " mailx"


[root@test ~]# mail -v testmail@example.com

-bash: mail: command not found



Fix: # yum install mailx



Thursday 9 February 2012

How to Reset the Login Password for DirectAdmin Control Panel

If you forget the password for DirectAdmin, then follow the steps to reset your password.

check the setup.txt file for password.
[root@test]# cat /usr/local/directadmin/scripts/setup.txt

if the password in the setup.txt  not works, then try to change the admin password with the following command,
[root@test]# passwd admin
Changing password for user admin.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


Friday 3 February 2012

SMTP Error: No support for Delivery Status Notifications

You may get the SMTP Error while trying to send emails from webmail roundcube. This error occurs because the new version of roundcube uses a feature that our servers do not have available (due to incompatibility server e-mails) and the lack of this feature is shown the error message and the email is not sent.



Fix:
 # Go to settings option then click composing messages and uncheck it as in the below picture.
    Then save it and now try to send emails. Now you can send mails !!



Thursday 2 February 2012

'TS3ANetwork::Connect failed error: 111' 'Unable to connect to accounting server' ' Server() error while starting servermanager, error: unable to connect to accounting server'

You may see the below errors in Teamspeak error log file.
Error:
2012-02-03 02:31:05.061747 |INFO    |SQL      |   | pruning old database log entries where timestamp is older than 90 days
2012-02-03 02:31:05.123310 |ERROR   |         |   | TS3ANetwork::ResolveHostName failed error: -5 (No address associated with hostname) 110
2012-02-03 02:31:05.238214 |ERROR   |         |   | TS3ANetwork::Connect failed error: 111
2012-02-03 02:31:05.238322 |ERROR   |Accounting    |   | Unable to connect to accounting server
2012-02-03 02:31:05.238389 |ERROR   |ServerLibPriv |   | Server() error while starting servermanager, error: unable to connect to accounting server
Solution:
Move the  licensekey.dat  file to some other directory and try to start the teamspeak....

# /etc/init.d/teamspeak restart

# /etc/init.d/teamspeak status
Server is running

Wednesday 25 January 2012

Error: Domain 'vm00' does not exist. Error: Unable to open config file: vm00

You may get the below errors while starting or enter into vps from node on xen.

[root@test ~]# xm start vm00
Error: Domain 'vm00' does not exist.

[root@test ~]# xm reboot vm00
Error: Domain 'vm00' does not exist.

[root@test ~]# xm create vm00
Error: Unable to open config file: vm00


Solution :
[root@test ~]# xm create /home/xen/vm00/vm00.cfg
Using config file "/home/xen/vm00/vm00.cfg".
Started domain vm00 (id=27)


Errors: apache2: Could not reliably determine the server's fully qualified domain name, using x.x.x.x for ServerName

Solution:
To fix that problem, you need to edit the httpd.conf file. Open the terminal and type,  
sudo gedit /etc/apache2/httpd.conf

By default httpd.conf file will be blank. Now, simply add the following line to the file.  
ServerName localhost

Save the file and exit from gEdit. Finally restart the server.  
sudo /etc/init.d/apache2 restart

How to Install and Configure Apache, PHP, MySql and phpmyadmin on Ubuntu

Installing Apache:


Open the Terminal and type the below command to Install Apache

sudo apt-get install apache2

Type your ubuntu password and press enter. 

Type y and hit enter to confirm apache installation.


To Confirm


Open your browser and type 


http;//localhost/


Installing PHP:


sudo apt-get install php5 libapache2-mod-php5

After successful Installation, restart your apache2

# /etc/init.d/apache2 restart

To check
# vi /var/www/phpinfo.php

and type the below code

<?php  phpinfo() ?>

Now open your browser and type

http://localhost/phpinfo.php


Installing MySql

apt-get install mysql-server

give mysql root password when it requires.









Command to List Load Average of Each VPS in Openvz

Enter into node and type the following command to list the load average of each vps and their vps id.

# vzlist -o veid,laverage

Output :
CTID LAVERAGE  
300 0.25/0.39/0.34  
340 0.10/0.09/0.11 
310 0.83/0.89/0.86  
030 1.62/1.62/1.38