FIX ssh from whm

If you think your ssh is dead or blocked out in server firewall. Then you can start a stand alone ssh  from whm which will listen on port 22 .

http://your_server_ip:2086/scripts2/doautofixer?autofix=safesshrestart

Now you can login to ssh with port 22 and  fix your original ssh issue. Also if you have csf firewall installed in this server , please turn off it from whm

cPnginx version 5.1 Released

cPnginx version 5.1 Released
Hello,

The latest version of cpnginx plugin 5.1 is released with the following minor bug fix,

  •  Whm plugin interface invalid text bug fix
  •   New license system updated

 

Backup and restore a mysql table using mysqldump

There are two  methods for taking backup of a single table from a database and restore in into another database

1) Method 1

In this method you can take  a backup of a database table and  restore into another db. But this restoration will remove the  already existing  table and recreate it in the new database .

#  mysqldump old_db table  > old_db.table.sql
#  mysql new_db < old_db.table.sql

2)Method 2

In this method you can table only the backup of database table  data ( not the sql scheme )  and restore it into new database without removing the old data in new database

#  mysqldump -t old_db table  > old_db.table.sql
#  mysql new_db << old_db.table.sql

Make sure to table backups of new database before doing the restoration

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.

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.

    • Jdk 1.5 , J2ee.jar
    • Apache-ant
    • svn client ( for downloading the svn packages of red5 )
    • 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.

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

  • Main vps server ( The host server ,in which the vps nodes are running) configuration
  • 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

How to reset mysql root password ?

1. Stop/ kill the mysqld
# service mysql stop #pkill -9 mysqld
2) Start the mysql in safe mode as follows

# 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