How to use wget to copy/backup remote ftp files recursively

This tutorial will teach you how to use wget to download entire folder of remote server with recursively

example: recursively download all the files that are in the subfolder3 folder for the ftp

ftp://user:pass@www.yourdomain.com/folder1/subfolder1/subfolder2/subfolder3

Solution:

 wget -r -np -nc -nH --cut-dirs=4 ftp://user:pass@www.yourdomain.com/folder1/subfolder1/subfolder2/subfolder3

-r = mean recursive
-np = Do not ever ascend to the parent directory when retrieving recursively.
-nc = skip existing files
-nH = no save folder as host name
-cut-dirs = remove all the subfolder during save, just the content inside subfolder3 will be saved.

Hope that help

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 

hope that help.

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.

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.

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/src
svn 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.

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

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~

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

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:

    Options FollowSymLinks
    AllowOverride none

change to :

    Options FollowSymLinks
    AllowOverride All

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:

 

<?php // htaccess tester // Copyright 2011 Booser if($_GET['url']==1){echo "Damn it! looks like htaccess is not working, please refer to: 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";} ?>

 

LINK1 = rewrite.php?link=1

LINK2 = link2.html

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 Booser Verify htaccess for solution

If you like Booser, you can copy this code and paste it to your website. Verify if .htaccess is working or not

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~

fix: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

When you install a 32bit application on 64bit OS, you will get this kind of problem:

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

solution is install 32bit library will solve that and you able to run 32bit apps on 64bit os
like charm.

Quick Fix:

On Centos, Fedora:

yum install glibc.i686

On Ubuntu, Debian:

apt-get install ia32-libs

Hope that help.

~Cheers~

faad2: config.status: error: cannot find input file: plugins/xmms/Makefile.in

You might facing this problem:

config.status: error: cannot find input file: plugins/xmms/Makefile.in

during compiling faad, well here is the solution to fix it:
use your favourite editor tool to edit: configure.in i use nano because its easy to use.
nano configure.in
look for dnl AC_PROG_CXX
erase the dnl so that it become:
AC_PROG_CXX
then save it and run:

autoreconf -vif
./configure
make && make install

that will fix the problem. Hope that help, and dont forget to say thanks below.

How to : Install Subversion

Here is 2 way to install subversion on your server.

1st method:

yum install subversion

or

apt-get install subversion

2nd method: compiling from source

wget http://subversion.tigris.org/downloads/subversion-1.6.12.tar.gz
tar zxvf subversion-1.6.12.tar.gz
cd  subversion-1.6.12
./configure --prefix=/usr/local/subversion/ --with-apxs=/usr/local/subversion/bin/apxs --with-ssl
make && make install
svn --help

3rd method: Using RPM for rhel server

wget http://pkgs.repoforge.org/subversion/subversion-1.6.6-1.el5.rfx.x86_64.rpm
rpm -ivh subversion-1.6.6-1.el5.rfx.x86_64.rpm

You are done. Hope that help, normally installing from yum or apt-get should do the job. If you get following error:

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

Please read this article for solution

neroAacEnc: error while loading shared libraries: libstdc++.so.6

You might face this problem after installed neroAacEnc:

neroAacEnc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

here is the fix for centos or fedora user.

yum whatprovides libstdc++.so.6

then it will show the result of:

[root@web]# yum whatprovides libstdc++.so.6
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirror.ash.fastserv.com
 * extras: mirror.batblue.com
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.metrocast.net
libstdc++-4.4.4-13.el6.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Other       : libstdc++.so.6

just install it with :

yum install libstdc++-4.4.4-13.el6.i686

Note: This only work on centos, or fedora or any other mechine that has yum. For debian or ubuntu, you might need to find alternative solution. Or suggest at comment below if you know any solution.

Hope that help, and dont forget to say thanks on comment below, its free and motivate me to post more useful fix/solution for you.

Cheers
Boon

How do you extract MP3 from a video files using ffmpeg

There is alot of youtube to mp3 site out of internet to convert youtube video to MP3 files. You must be wonder how they do it, in this article i will show you how to get a video files converted using ffmpeg to mp3 format.

ffmpeg -i youtubevideo.flv -f mp3 audiofile.mp3

-i (input video)
-f (output format)
if you like to adjust the sound quality:

ffmpeg -i youtubevideo.flv -ab 192k -ar 44100 -f mp3 audiofile.mp3

-ab (audio bitrate)
-ar (audio rate)

simple and easy, Hope that help.

/etc/skel directory

/etc/skel directory

The system will copy the contents of the /etc/skel directory to the user’s HOME directory.

The useradd command allows an administrator to create a default HOME directory configuration, then uses that as a template to create the new user’s HOME directory. This allows you to place default files for the system in every new user’s HOME directory automatically. On my Linux system, the /etc/skel directory has the following files.

root@mycoolserver:/etc/skel# ls -ld *
drwxr-xr-x 2 buddy buddy 4096 Oct 11  2008 Desktop
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Documents
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Download
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Music
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Pictures
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Public
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Templates
drwxr-xr-x 2 buddy buddy 4096 Mar  4  2009 Videos

Umask command

 

The umask value is just that, a mask. It masks out the permissions you don’t want to give.The umask value is subtracted from the full permission set for an object. The full permission for a file is mode 666 (read/write permission for all), but for a directory it’s 777 (read/write/execute permission for all).

umask command shows and sets the default permissions:

root@mypowerserver:~# umask 0022

Thus, in the example, the file starts out with permissions 666, and the umask of 022 is applied, leaving a file permission of 644. The umask value is normally set in the /etc/profile startup file.

IonCube PHP Loader Error, IonCube not installed.

Often when surfing website, you found:

Site error: the file /home/USER/public_html/index.php requires the ionCube PHP Loader ioncube_loader_lin_X.X.so to be installed.

here is the way to resolve it:

Create a ‘php.ini’ and add following:

zend_extension = /home/USER/public_html/ioncube/ioncube_loader_lin_4.X.so

Download ioncube_loader_lin_4.X.so from : http://www.ioncube.com/loaders.php
and upload ioncube_loader_lin_4.X.so to /home/USER/public_html/ioncube/
Replace USER with the username of the cpanel account you are uploading the php.ini file to.

Replace “X” with the appropriate version of the ioncube loader

Upload the php.ini to your public_html directory.

If you are running your script from a directory other than public_html – for example /home/USER/public_html/blog/index.php you will need to upload the php.ini file to that directory.

Hope that help.

Upgrade PHP 5.1 to PHP 5.2 on CentOS ( Jason Source )

Using yum upgrades to update your PHP 5.1.6 to PHP 5.2.11

add the following source to your repo

nano -w /etc/yum.repos.d/utterramblings.repo
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

then

yum update php -y

Hope that help