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.