Booser Empowering your life

11Jan/120

How to kill process that running on specific port

Its very annoying, when you trying to start the services, but the port is already in use. What to do? Kill it! So that you can start the services again.

i use example: red5 port running on 5080.

how to find that port : 5080 is run on what process?

lsof -w -n -i tcp:5080

then the process and pid will appear.

kill it by typing:

kill -9 <pid -id></pid>

hope that help.

8Jan/120

Install Lighttpd for Flv and MP4 Streaming

 

 

 

 

 

 

Install Lighttpd for Flv and MP4 Streaming

In this tutorial, i will show you how to install lighttpd for flv and mp4 streaming.
1. Install lighttpd by using yum

yum install lighttpd

2. Install pre-devel and glib2-devel

 yum install pcre-devel glib2-devel

3.  Download and install MP4 moded version of lighttpd

 wget http://h264.code-shop.com/download/lighttpd-1.5.0_mod_h264_streaming-2.2.9.tar.gz
 tar -zxvf lighttpd-1.5.0_mod_h264_streaming-2.2.9.tar.gz
 cd lighttpd-1.5.0
 ./configure
 make
 make install

4. Edit /etc/init.d/lighttpd for /local/sbin/ instead of /usr/sbin/

 nano /etc/init.d/lighttpd
 find /usr/sbin/
 add: local
 so that it look like: /usr/local/sbin/

5. Edit Configuration file at: /etc/lighttpd/lighttpd.conf

add:
                                "mod_secdownload",
                                "mod_flv_streaming",
				"mod_h264_streaming",
                                "mod_simple_vhost",
to: server.modules              = (

6. Include these example for your vhost

$HTTP["host"] == "www.yourcooldomain.com" {
flv-streaming.extensions = ( ".flv" )
h264-streaming.extensions = ( ".mp4", ".f4v" )
h264-streaming.buffer-seconds = 10
secdownload.secret = "mysecretkeyhere"
secdownload.document-root = "/home/user/public_html/path/to/flv-or-mp4"
secdownload.uri-prefix = "/streamer/"
secdownload.timeout = "3600"
server.document-root = "/home/user/public_html"
}

7. start your lighttpd:

/etc/init.d/lighttpd start

8. Step to generate/produce lighttpd stream able link using php.

< ?php
 	$myflv        = '"/home/user/public_html/path/to/flv-or-mp4' .$videoname. '.flv';
  	$mymp4        = '"/home/user/public_html/path/to/flv-or-mp4' .$videoname. '.mp4';
  	$timestamp      = time();
  	$timestamphex  = sprintf("%08x", $timestamp);
	$md5sumflv      = md5('mysecretkeyhere' . $myflv . $timestamphex);
	$md5summp4      = md5('mysecretkeyhere' . $mymp4 . $timestamphex);
	$flvulr = 'http://www.yourcooldomain.com/streamer/'.$md5sumflv.'/'.$timestamphex.$myflv;
  	$mp4url = 'http://www.yourcooldomain.com/streamer/'.$md5summp4.'/'.$timestamphex.$mymp4;
	echo $flvulr."<br />";
	echo $mp4url."<br />"
?>

Hope that help.
I provide lighttpd installation services for $50, please contact me at here for more detail.

7Jan/120

Jailbreak IOS 5 untethered (windows version)

YES, toward 2012 iphone jailbreaker team has released a stable version of redsn0w to jailbreak IOS 5.0.1, it was found by pod2g after several week release of iOS 5.0.1. Its a good news for everyone that want to jailbreak their new IOS 5. This tutorial will show you how to jailbreak your A4 based device like iphone 4, iphone 3GS, and do not work on latest version example: iphone 4s, ipad2

Here is tutorial for how to jailbreak your iphone 4 with IOS 5.0.1

1. Get redsn0w_win_0.9.10b3.zip from here 

2. Make sure you have latest itune installed, you can download it here:  http://www.apple.com/itunes/

3. You will need the IOS 5.0.1 file:

iPhone 4 GSM

iPhone 4 CDMA

i assume you know how to upgrade or restore your IOS to your iphone, so i skipped the step.

4. Open RedSn0w:

Click on the jailbreak button

5. Put your iphone into DFU mode by follow the instruction on the screen you saw.

once you got into DFU mode you will get something like below, Your iOS device should also flash white on the screen for a moment, and then reboot:

It work automatic for jailbreaking your iphone from now on.

6. Install Cydia

after done, you will be rebooted to jailbroken iphone. Use it on your own risk, i'm not responsible for the damage has done to your iphone :) But this tutorial will work fine, if you carefully follow the step.

Cheers.

7Jan/120

Install NginxAdmin to WHM/Cpanel for Optimize Performance

This tutorial will show you how to install and uninstall NginxAdmin. Why Nginx reverse proxy? Good question, when you using a limited resources server such as VPS, you definitely need this method to help you to reduce your CPU load for serving more user or traffic on your site. Nginx can cache static content very well and you will get lighting speed to load your website and reduce the load of CPU usage.

This tutorial's requirement is show as below:

1. WHM/Cpanell installed server
2. SSH access to your server
3. Root access
4. little basic ssh knowledge

For install NginxAdmin

cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller install

Restart your apache and your apache will run as reverse proxy with nginx.

/etc/init.d/httpd restart

For Uninstall NginxAdmin

cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller uninstall

Troubleshooting Installation:

if you get something similar to following:

Welcome to the Nginx Admin installer......Starting Install
Generating vhosts...
Traceback (most recent call last):
File "/scripts/createvhosts.py", line 2, in ?
import yaml
File "/usr/lib/python2.4/site-packages/PyYAML-3.10-py2.4-linux-i686.egg/yaml/__init__.py", line 26
SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause
Installing WHM interface...
deploying booster rockets
Traceback (most recent call last):
File "/usr/local/src/publicnginx/nginxinstaller2", line 9, in ?
import createvhosts
File "/usr/local/src/publicnginx/createvhosts.py", line 2, in ?
import yaml
File "/usr/lib/python2.4/site-packages/PyYAML-3.10-py2.4-linux-i686.egg/yaml/__init__.py", line 26
SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause

Here is the Solution:

cd /usr/lib/python2.4/site-packages
mv PyYAML-3.10-py2.4-linux-x86_64.egg PyYAML-3.10-py2.4-linux-x86_64.egg_
wget http://www.booser.com/wp-content/uploads/PyYAML-3.09-py2.4-linux-x86_64.egg

*note: if you have 32bit version of os, you can use PyYAML-3.09-py2.4-linux-i686.egg

If you facing tmp folder is full, you will get 500 internal error.
Solution:

To automated /tmp cleanup add bellow cron
0 */1 * * * /usr/sbin/tmpwatch -am 1 /tmp/nginx_client
via crontab -e command

Hope that help. I provide installation services for this as well. Contact me Here for more detail.

7Jan/122

How to install Red5 1.0 RC1 on Centos 5/6

Howdy folks, in this article i will show you on how to install red5 as media streaming server, video live broadcast server. Why Red5? Because it is a free version of RTMP server that does the same thing as commercial version of streaming server such as FMS, Wowza, etc. Lets cut the crap here, lets proceed to installation.

 

 

 

 

 

 

Lets prepare the ingredient before Red5 installation.

1. Install Java

Red5 is developed using java, so you will need java installed on your mechine before you can run it. Lets use yum to install it.

yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

  
2. In order to compile red5 on your server, you will need a tool called ant. Yes its ant, its developed by apache.

cd /usr/local/src
wget http://apache.cs.utah.edu//ant/binaries/apache-ant-1.8.2-bin.tar.gz
tar zxvf apache-ant-1.8.2-bin.tar.gz
mv apache-ant-1.8.2 /usr/local/ant

  
3. Export correct path/directory  for Ant and Java

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

if you wish all of your user to  use above path everytime they logged in into ssh, you can add those path to /etc/bashrc so that they dont need to type it eveytime.

echo 'export ANT_HOME=/usr/local/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/lib/jvm/java' >> /etc/bashrc
echo 'export PATH=$PATH:/usr/local/ant/bin' >> /etc/bashrc
echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >>/etc/bashrc

ingredient prepared, next step is cook the red5.  

4. Download and Install RED5 Server

cd /usr/local/srcsvn
checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist

After you saw bunch of line then you will noticed BUILD SUCCESSFUL that mean the process is successfully done.  
5. Copy Required file from dist/conf folder to main folder of red5

cp -r dist/conf /usr/local/red5

  
6. Test and run it

sh red5.sh

You will get alot of line as well, once it stopped, you will found the word: bootstrap complete to indicate the red5 started successfully. To exit the process with putty type: ctrl + z, ctrl + c. If you saw error on the last few line, mean the red5 is not compiled correctly, maybe you missing something like java or ant.  
7. Test it with browser
Open any browser the insert the url http://yourserverip:5080/

you will saw something like below:
red5 installed

 

 

 

 

 

 

 

 

Troubleshooting:
1, All success but open in url become 404.
#port 5080 might get blocked with your firewall? Solution is allow port 5080 and 1935 to your firewall. 
2, latest version is buggy for you?
#no problem, check out old version here: http://red5.googlecode.com/svn/java/server/tags/ 
3, If you get bash: svn: command not found
#no problem, i have a tutorial for install svn 
4, other problem? please use the following comment box, i will try my best to help you. 

thats all, cheers and happy 2012 new year.

22Dec/110

Tutorial on Find command

Find command are useful command in linux which help you to find and search certain file or folder in your server, here is few tutorial that might help you for better understanding it.

·Find all world writable directories:

find / -perm -0002 -type d  –print

·Find all world writable files:

find / -perm -0002 -type f  -print
find / -perm -2 ! -type l  -ls

·Find files with no user:

find / -nouser -o -nogroup  –print

·Find files modified in the last two days:

find / -mtime 2 -o -ctime 2

·Search and list all files from current directory and down for the string ABC:

find ./ -name "*" -exec grep -H ABC {}  \;
find ./ -type f -print | xargs grep -H  "ABC" /dev/null
egrep -r ABC *

·Find all files of a given type from current directory on down:

find ./ -name "*.conf"  –print

·Find all user files larger than 5Mb:

find /home -size +5000000c  –print

·Find all files owned by a user (defined by user id number) on
the system: (could take a long time)

find / -user 501 –print

·Find all files created or updated in the last five minutes: (Great for finding effects of make install)

find / -cmin -5
9Dec/110

Batch Image Resizing on linux

Batch Image Resizing on linux

Assume that you have more than 1000 image in a directory, and you are going to resize them all with higher resolution to match
your new web site design. Here is hassle free method that you can try using ImageMagick and use its tools called "mogrify". On centos you can install imagemagick via yum by typing the following command:

yum install ImageMagick

then you can resize the image inside folder using follwing command:

mogrify -resize 320 *.jpg

all the image size will be resize to 320px

 

Hope that help, cheers~

4Dec/110

Fix: perl(URI) >= 1.17 is needed by subversion

When you installing subversion on server you might found following problem:

error: Failed dependencies:
        perl(URI) >= 1.17 is needed by subversion-1.6.6-1.el5.rfx.x86_64

Here is the solution to fix:

wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
rpm -i perl-URI-1.35-3.noarch.rpm

then proceed to subversion installation.

Cheers

2Dec/110

Verify if .htaccess is working or not

We use .htaccess to rewrite and redirect link. When you get your new hosting its always there is easy step to verify if .htaccess is working fine or not on your new hosting account. Some hosting does not configure their apache server correctly and caused .htaccess is not working even the code itself is correct. So, Here is simple step that might useful for you to verify if the .htaccess is work or not working. (with these instruction, make sure you have root access to your server)

First of all you will need to check if mod_rewrite is enabled for apache.

cat /etc/httpd/conf/httpd.conf | grep rewrite

make sure you see result below:
LoadModule rewrite_module modules/mod_rewrite.so
if you dont see above line, then you will need to add it. If yes you can proceed to 2nd step

make sure AllowOverride inside httpd.conf is set to All instead of none by default.
example show on below:

<directory /var/www/html>
    Options FollowSymLinks
    AllowOverride none
</directory>

change to :

<directory /var/www/html>
    Options FollowSymLinks
    AllowOverride All
</directory>

Dont forget to restart apache after making change to AllowOverride. /var/www/html is example of mine, you can replace it to your directory example: /home/user/public_html

What next? Test it!!

Open notepad and copy and paste the following code into it:

<h1 align=center>
< ?php
// htaccess tester
// Copyright 2011 Booser
if($_GET['url']==1){echo "Damn it! looks like htaccess is not working, please refer to: <a href="http://www.booser.com/verify-htaccess-is-working-or-not.html">Booser Verify Htaccess  for solution";}
elseif($_GET['url']==2){echo" YES!! Your .htaccess is work fine man!";}
else{echo"Linux Apache mod_rewrte Test Tutorial";}
?>
</h1>

<hr />

<head>
<title>Verify if .htaccess is working or not</title>
</head>

<body>
<p align="center">Powered by <a href="http://www.booser.com">Booser Linux</a></p>
<p><a href="rewrite.php?url=1">LINK1</a> = rewrite.php?link=1</p>
<p><a href="my-rewite-link.html">LINK2</a> = link2.html</p>
<p>Click on Link1 and Link2, they both are same file, if you clicked link2 not work or get 404 mean its not working you will need to refer <a href="http://www.booser.com/verify-htaccess-is-working-or-not.html" title="Verify Htaccess">Booser Verify htaccess</a> for solution</p>

If you like Booser, you can copy this code and paste it to your website.
<textarea onclick="this.focus(); this.select();" readonly="readonly" name="Booser Verify Htaccess"><a href="http://www.booser.com/verify-htaccess-is-working-or-not.html">Verify if .htaccess is working or not</a></textarea>

</body>

Save it as: rewrite.php
Next step is open a new notepad again and paste following into it:

RewriteEngine On
RewriteRule ^my-rewite-link([^/]*).html$ rewrite.php?url=$1 [L]

Save it as: .htaccess

Now upload both files to your server using ftp, so that you can access it from url:

http://www.yourcoolsite.com/rewrite.php

click on Link1 and Link2 to test them out.

If you get:

404 error its mean, you dont have mod_rewite installed correctly or allowOveride is none.
500 internal error mean that you have some problem with .htaccess files make sure you copy them correctly.

You can contact your hosting to check if you not sure what you are going to do, or drop me a message on contact page, i would happily to check it for you.

Hope that help.
~Cheers~

30Nov/110

Simple Notepad Created Using VB.NET 2010

I downloaded Microsoft Visual Basic 2010 when i was bored,here is the simple notepad program that i wrote using vb 2010. It has open files, saves files, change font, font color features. Check the screenshot here:

Source Code: Download here ( VB 2010)

Hope you enjoy the code for practice, dont forget to say thanks comment below.