Upgrading Python in Cpanel Servers

It is little difficult for upgrading Python in cpanel servers. Because if you upgrade python directly , the yum package manager will not work. So you need to reinstall all old rpms again.

When you required to upgrade python on Cpanel server?
The latest Mailman have some bugs. It need Python version of 2.4.6 at least. But in your centos4/RHEL4 servers the python version is 2.4.3. So for fixing the mail man issue you need to upgrade the python without breaking Yum and other python modules.

Please proceed with the following for upgrading Python

1) Download and install python 2.4.6

# cd /usr/local/src/
# wget http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz
# tar -xvzf Python-2.4.6.tgz
# cd Python-2.4.6/
# ./configure โ€“prefix=/usr/local/python.2.4.6/
# make
# make install

2) Configure cpanel for latest Python as follows

# grep python /var/cpanel/cpanel.config
#python=/usr/local/bin/python2.4
python=/usr/local/python.2.4.6/bin/python2.4
3) Now reinstall Mailman
# /scripts/reinstallmailman

This will fix your issue

How to reset mysql root password ?

1. Stop/ kill the mysqld
# service mysql stop
#pkill -9 mysqld

2) Start the mysql insafe mode as follows

# /usr/libexec/mysqld --skip-grant-tables --user=root &

3) Now update the mysql user tables and root password as follows

#mysql
mysql>use mysql;
mysql>UPDATE user SET Password=PASSWORD('YOUR_PASSWORD')  WHERE Host='localhost' AND User='root';
mysql>flush privileges;

Now add the new password “YOUR_PASSWORD” in /root/.my.cnf and start mysql

# service mysql start

csf + lfd firewall configuration in vps (virtuozzo /openvz)

Introduction:

In general csf is giving good compatibility with cpanel servers . But in a vps (openvz or Virtuzzo) the csf configuration is something different.

Sometimes you may get an error as follow after the csf installation in vps

————–

Error: iptables command [/sbin/iptables -v -A LOGDROPIN -p tcp -m limit –limit 30/m –limit-burst 5 -j LOG –log-prefix ‘Firewall: *TCP_IN Blocked* ‘] failed, at line 196

—————

So how to resolve this issue. Let us do it as follows,

There are two steps to configure the csf in vps

i)Main vps server ( The host server ,in which the vps nodes are running) configuration

ii) Vps node configuration.

Main vps serverconfiguration

Before starting the csf installation in a node login to the main server (host server) and check whether the following modules are inserted in to the kernel

———
ipt_conntrack
ipt_LOG
ipt_owner
ipt_state
ip_conntrack_ftp
———

You can check it as follows

—————
# lsmod |grep -i <module-name>
—————

If not please insert these modules into the kernel.

————
#modprob <module-name>
eg: modprob ipt_conntrack
————-

Now add these modules to iptable configuration as follows.

———–
# vi /etc/sysconfig/iptables-config
Add the following in this file
IPTABLES_MODULES=”ipt_conntrack ipt_LOG ipt_owner ipt_state ip_conntrack_ftp”
———–

Now edit the vps configuration file from /etc/sysconfig/vz-scripts/ Let 101 is the VEID, add the above inserted modules in to the IPTABLE section in this configuration file.

———-
# vi /etc/sysconfig/vz-scripts/101.conf
IPTABLES=”iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ipt_state
iptable_nat ip_nat_ftp ipt_owner ip_conntrack_ftp”
————-

Here we completed the main vps server configuration . So now reboot the child node (not main server) as follows

—————

# vzctl restart <veid>

eg: vzctl restart 101

——————-

ii) Vps node configuration.

Now ssh /enter your child vps node

Now download and install the csf . You can download the csf fromhere

Before restarting the csf let us do some configurations as follows , Edit the file /etc/csf/csf.conf .Then set the following variables

——–
ETH_DEVICE = “venet0” #from ifconfig you can see the n/w device
MONOLITHIC_KERNEL = “1”
VERBOSE = “0” # will disable the verbose output during start
———

Now start the csf and lfd .

———–

/etc/init.d/csf start

/etc/init.d/lfd start

———–

Note: If it is cpanel server go to whm and configure the firewall settings

Enjoy it ๐Ÿ˜‰

How to configure Python and Lighttpd

Hello,

I found a good way to execute python scripts via lighttpd . So now I can write my web applications completely in python.

http://docwiki.gumstix.org/Sample_code/Python/Hello_World

It is the easy way

Red5 Flash media server development: How to install and configure ?

Red5 Flash media server development: How to install and configure ?

What is red5 server ?

Red5 is an Open Source Flash Server written in Java that supports:

* Streaming Audio/Video (FLV and MP3)
* Recording Client Streams (FLV only)
* Shared Objects
* Live Stream Publishing
* Remoting (AMF)

This is an amazing application for developing flash. even though its installation is not in a straight way. So this document will help you to setup a red5 server with a cool startup script to start and stop installations.

IMP: This procedure istested in RHEL , Fedora , Centos5 cpanel servers with red5 version 0.7.0. So I hope it will work in most distributions. But the startup script will not work in debian flavors. I don’t have so much time to buy a server and install debian for testing. May be in near future I can do that.

Packages required for installation.

1) Jdk 1.5 , J2ee.jar
2) Apache-ant
3) svn client ( for downloading the svn packages of red5 )
4) Lates red5 svn trunc distribution ( Please don’t use the tar distribution of red5, because some jar mirror are missing during make )

1) Installing Jdk and J2ee.jar

Please download and install the jdk and j2ee.jar from a java mirror. Or just copy paste the following links.
# cd /usr/local/src
# wget http://downloads.sherin.co.in/java/jdk-1_5_0-linux-i586.bin
# chmod 755 jdk-1_5_0-linux-i586.bin
#./jdk-1_5_0-linux-i586.bin
# mv jdk1.5.0/ /usr/local/
# ln -s /usr/local/jdk1.5.0/ /usr/local/jdk
#wget http://downloads.sherin.co.in/java/j2ee.jar
# mv j2ee.jar /usr/local/jdk/lib/

Now the installation of java components finished.

2) Installing Apache Ant

Please go to http://ant.apache.org/bindownload.cgi and download latest apache-ant distribution, or copy paste the following lines.

# cd /usr/local/src/
# wget http://downloads.sherin.co.in/red5/apache-ant-1.7.1-bin.tar.gz
# tar -xzf apache-ant-1.7.1-bin.tar.gz
# mv apache-ant-1.7.1 /opt/
# ln -s /opt/apache-ant-1.7.1 /opt/ant

3) Set the PATHS

This is very important. If you are skipping this step then you are breaking the installation. So very important to set the paths .

Do the following commands,

# export JAVA_HOME=/usr/local/jdk
# export PATH=$JAVA_HOME/bin:$PATH
# export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
# export PATH=”$PATH:/usr/local/bin:/usr/X11R6/bin:/opt/ant/bin”
# export ANT_HOME=/opt/ant

Now open the file /etc/bashrc and insert the above lines ( without # ) at the bottom of the script, because for the future working you need these environment variables. Otherwise you may need to set the above variables again and again during every login time. So It is very important to set the above lines in /etc/bashrc , got it !

4) Installing svn

In general all distributions have its own subversion packages. In Centos/RHEL/Fedora you can use “yum” to install svn client.
# yum install subversion
Or download the source of svn and install it.

5) Installing red5

Now proceed with following steps to install red5 FMS. Please use only SVN TRUNC distributions.

# cd /opt/
# svn co http://svn1.cvsdude.com/osflash/red5/java/server/trunk red5
# cd red5/
# make

Now we have build the red5 server. So the next step is configuring start up scripts. This script is very use full to start/stop red5 server. unfortunately red5 distributions not providing it. So I wrote this small script. This script is using the normal start/stop scripts from the folder /opt/red5/dist/.

6) Creating init start-up script /etc/init.d/red5

Now create a file with name /etc/init.d/red5 . Please copy paste the following code to /etc/init.d/red5.

#==========Start init script ==========

#!/bin/sh
# red5
# chkconfig: 2345 95 55
# description: red5  server startup script

# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo "Could not find functions file, your system may be broken"
exit 1
fi

# Source networking configuration.
if [ -f "/etc/sysconfig/network" ] ; then
. /etc/sysconfig/network
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting red5: "
cd /opt/red5/dist/; sh red5.sh 2 >/dev/null &
echo_success
echo
touch /var/lock/subsys/red5
;;
stop)
# Stop daemons.
echo -n "Shutting down red5: "
cd /opt/red5/dist/; sh red5-shutdown.sh 2 >/dev/null
echo_success
echo
rm -f /var/lock/subsys/red5
;;
*)
echo "Usage: red5 {start|stop}"
exit 1
esac

exit 0

#=============End of init==============

PS : You can download it from http://script.sherin.in/red5.sh . if so move red5.sh to /etc/init.d/red5 .

Now we have created the init sript. chmod this script for getting execute permission .
# chmod 755 /etc/init.d/red5

Now start/stop the red5 server as follows

# /etc/init.d/red5 start
# /etc/init.d/red5 stop

7) Testing the installation

First you need to start your red5 installation using he following command,
# /etc/init.d/red5 start
Now open your web browser and type the following url

http://<server ip adress : 5080/

where , “server ip address” is the IP of your server.

TIP: if you need to automatically start the service during system start up, please add “” /etc/init.d/red5 start” line to /etc/rc.local

So this is all about red5 server installations. Any comments ? ๐Ÿ™‚

Unable to open pty: No such file or directory

This issue comes with openvz nodes. After the creation of VE, we may face an issue like following,
———————————-

# vzctl enter 101
enter into VE 101 failed
Unable to open pty: No such file or directory

———————————
Its solution is simple. Please do the following procedure

# vzctl exec 101 /sbin/MAKEDEV tty
# vzctl exec 101 /sbin/MAKEDEV pty
# vzctl enter 101

Now do the following, to find the udave package name as follows.

# rpm -qf /etc/udev/makedev.d/50-udev.nodes
udev-095-14.9.el5
# rpm -e udev-095-14.9.el5 –nodeps

Now restart that VE ( here 101 ) enjoy.

Squid Proxy server configuration over Internet in 5 steps

The Squid is a good proxy server. Its configuration is very simple. Please use the following procedures.

1) Most of the standard distributions have squid packages in its repository. If you are using fedora, RHEL or centos please do the following procedurea

# yum install squid -y

If your in debian or Ubundu please use the following,

# apt-get install squid

2) Now open the squid configuration file “squid.conf” . In general it will be in /etc/squid/squid.conf . Now modify/ add the following lines.

visible_hostname machine-name
http_port 3128
cache_dir ufs /var/spool/squid 1000 16 256
access_log /var/log/squid/access.log squid

3) Now add the following in the acl section.

acl our_networks src xxx.xxx.xxx.xxx/xx
http_access allow our_networks

Here the xxx.xxx.xxx.xxx/xx is your local IP /netmask

4) Now start the squid server

# /etc/rc.d/init.d/squid start

5) Now configure your web browser as follows. ( It is my firefox configuration )

Go to Preferences -> connection settings -> manual Proxy configurations
Now configure your proxy server IP and port ( 3128)
Now click Ok.

This is the most simplest proxy server configurations over network.

Note : Please check the log file /var/log/squid/access.log for any errors

Tomcat Virtual hosting in Linux

Tomcat Virtual hosting in Unix

The tomcat virtual hosting configuration in Unix/Linux is simple.

1) Create the virtual host entry in server.xml
2) Create the document root
3) Restart tomcat

let us consider the tomcat installation root is /usr/local/tomcat

To start the tomcat use /usr/local/tomcat/bin/start.sh
To stop the tomcat use /usr/loca/tomcat/bin/shutdown.sh

The following is my server.xml. Please copy paste and change the domain.com
====================================

# more conf/server.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<Server>
<Listener className=”org.apache.catalina.core.AprLifecycleListener”/>
<Listener className=”org.apache.catalina.mbeans.GlobalResourcesLifecycleListener”/>
<Listener className=”org.apache.catalina.storeconfig.StoreConfigLifecycleListener”/>
<Listener className=”org.apache.catalina.mbeans.ServerLifecycleListener”/>
<GlobalNamingResources>
<Environment
name=”simpleValue”
type=”java.lang.Integer”
value=”30″/>
<Resource
auth=”Container”
description=”User database that can be updated and saved”
name=”UserDatabase”
type=”org.apache.catalina.UserDatabase”
pathname=”conf/tomcat-users.xml”
factory=”org.apache.catalina.users.MemoryUserDatabaseFactory”/>
</GlobalNamingResources>
<Service
name=”Catalina”>
<Connector
port=”80″
redirectPort=”8443″
minSpareThreads=”25″
connectionTimeout=”20000″
maxSpareThreads=”75″
maxThreads=”150″>
</Connector>
<Connector
port=”8009″
redirectPort=”8443″
protocol=”AJP/1.3″>
</Connector>
<Engine
defaultHost=”localhost”
name=”Catalina”>
<Realm className=”org.apache.catalina.realm.UserDatabaseRealm”/>
<Host
appBase=”mydomain”
name=”mydomain.com”>
<Context path=”” docBase=”.”/>
<Alias>www.mydomain.com</Alias>
</Host>
<Host
appBase=”webapps”
name=”localhost”>
</Host>
</Engine>
</Service>
</Server>

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

Now create the document root “/usr/local/tomcat/mydomain” and directory structure as follows
# mkdir -p /usr/local/tomcat/mydomain/{WEB-INF/{classes,lib},META-INF}

Create a test index.jsp file in here ,

# cat > /usr/local/tomcat/mydomain/index.jsp << EOF

<%@page contentType=”text/html” pageEncoding=”UTF-8″%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>Centropoly</title>
</head>
<body>
<h2>Welcome to the temporary home of mydomain.com.</h2>
<p>
Just for testing
</p>
</body>
</html>

EOF

This is all about simple virtual hosting in tomcat. I testes the above configuration successfully in Tomcat 5

Any comments

sherin.in

I Have recently faced a serious problem with my Original website , sherin.in. My DNS registrar is suspended it without a notice, because IT was expired on March 20th 2009. I contacted them for getting back, but they asking 5000 Rs for this domain, which I can’t afford it.

So all projects related with sherin.in will not work properly because some of it using the mirror site as sherin.in . It is mainly affected by the project ffmpeginstaller. I am updating content of my old website to this new site.

SO for the ffmpeginstaller issue, I have moved the project with Sharemixer community. You can download it from new website, http://www.ffmpeginstaller.com/ . Also please notice I only modified the latest version of script ( version 3. 2. 1) .

I also moved the forum to forum.ffmpeginstaller.com . Alaso added new two Professional service plan one for 49$ ad another one for 150$.

In 49$ package, I will install the complete ffmpeg package in your server. So you don’t need to worry about it.
In 150$ package you will get my installation service , OS hardening apache/php/mysql optimization and performance tuning.

I am apologizing for all the troubles cased by my DNS issues.

20th May 2009

Sherinmon

SUPHP and Cpanel = 500 error

IN cpanel servers suphp is a good choice. But you may get a 500 internal server error some times

You can’t see any error logs in server, In such situation check the logs files size in /usr/local/apache/logs specially /usr/local/apache/logs/suphp_log , It must have size more than 2.0 GB.

So this seems to be a bug in suphp , eventhough we chosing apache version 2.2.x ., because apache 2.2.x have larger file size handling method. BUt still suphp in old age .

Let me open a bug report in suphp.org