Saturday, April 30, 2011

HOWTO : Ubuntu 11.04 on Gigabyte TouchNote T1028X/M1028

Gigabyte TouchNote T1028X/M1028 equipped with Intel Atom N280 and eGalax touch screen. It runs Ubuntu 11.04 flawlessly except touchpad. This tutorial is telling you how to overcome this problem.

"lsusb" shows the following :

Bus 005 Device 002: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen

Step 1 :

Boot up the system and press "Ctrl+Alt+t" to open a terminal.

sudo nano /etc/default/grub

Append "i8042.noloop=1" to "GRUB_CMDLINE_LINUX_DEFAULT".

It will look like this :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.noloop=1"

Save and exit.

sudo update-grub

Step 2 :

sudo nano /etc/modprobe.d/blacklist.conf

Append the following to the file.

blacklist usbtouchscreen

Step 3 :

Reboot your system.

That's all! See you.

Wednesday, April 27, 2011

HOWTO : Wipe hard drive safety and completely

Darik's Boot and Nuke (DBAN) is a self-contained boot disk that securely wipes the hard disks of most computers. DBAN will automatically and completely delete the contents of any hard disk that it can detect, which makes it an appropriate utility for bulk or emergency data destruction.

There are some wipe methods, they are Quick Erase, RCMP TSSIT OPS-II, DoD Short, DoD 520.22-M, Gutmann Wipe and PRNG Stream. Where DoD is The American Department of Defense. The default is The American Department of Defense 5220.22-M short wipe (DoD Short).

It is a very easy to use utility. A 300GB hard drive will take about 2 or 3 hours to wipe with the DoD Short method. The hard drive after the wipe is like a brand new one.

You can download it at here. Then, burn it in a CD-ROM or create a bootable USB stick with UNetBootin.

That's all! See you.

Sunday, April 24, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 10.10 Server

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 10.10 Server.

You will experience a faster server after the installation of CUDA 4.0.

This HOWTO does not require to install X.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc nvidia-current-modaliases libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc nvidia-current-modaliases lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

Step 3 :

sudo nano /etc/init.d/nvidia_cuda

Append the following lines.

============= Copy from here ================
#!/bin/bash

PATH=/sbin:/bin:/usr/bin:$PATH

/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then

   # Count the number of NVIDIA controllers found.
   N3D=`/usr/bin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
   NVGA=`/usr/bin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l`

   N=`expr $N3D + $NVGA - 1`
   for i in `seq 0 $N`; do
      /bin/mknod -m 666 /dev/nvidia$i c 195 $i;
   done

   /bin/mknod -m 666 /dev/nvidiactl c 195 255

else
   exit 1
fi


=========== Copy to here =================

Step 4 :

sudo chmod +x /etc/init.d/nvidia_cuda
sudo update-rc.d nvidia_cuda defaults

Step 5 :

Reboot your system.

Remarks

I do not have nVidia display cards server in hand at the moment, I am not sure the captioned startup script working properly or not.

That's all! See you.

Saturday, April 23, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 10.10 Desktop

If you have nVidia display card that have several CUDAs on it, you will interested in this tutorial. This time, I would like to show you how to install CUDA 4.0 RC on Ubuntu 10.10 Desktop.

You will experience a faster desktop after the installation of CUDA 4.0. Meanwhile, if you installed SMPlayer, you can playback 1080p videos with the help of vdpau.

Step 1 :

Add the CUDA 4.0 PPA.
sudo add-apt-repository ppa:aaron-haviland/cuda-4.0

Step 2 :

sudo apt-get update
sudo apt-get upgrade


64-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler libnpp4 nvidia-cuda-doc nvidia-current-modaliases libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc nvidia-current-modaliases lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev nvidia-kernel-common opencl-headers

Step 2a :

If you do not have any nVidia driver installed before, you need to do the following command. Otherwise, this step is not required at all.

sudo nvidia-xconfig

Step 3 :

Reboot your system.

Step 4 (Optional) :

To install SMPlayer.

sudo apt-get install smplayer smplayer-translations smplayer-themes

Then set it to use "vdpau" at "Output Driver" at "Preference".

Step 5 - Compiling of nVidia CUDA sample codes (Optional)

Some sample codes at gpucomputingsdk_4.0.13_linux.run cannot be compiled successfully. However, I would like to share how I compile some of them.

(a) Install the gupcomputingsdk with the following command and accepted the default setting that it provides.

sudo apt-get install freeglut3-dev libxi-dev libXmu-dev

Go to the following link :
http://developer.nvidia.com/cuda-toolkit-40#Linux

wget http://developer.download.nvidia.com/compute/cuda/4_0_rc2/sdk/gpucomputingsdk_4.0.13_linux.run

sudo chmod +x gpucomputingsdk_4.0.13_linux.run
sh gpucomputingsdk_4.0.13_linux.run

(b) Set the environment :

sudo nano /etc/environment

Append the following at the end of the entry.

:/usr/lib/nvidia-current:/usr/lib/nvidia-cuda-toolkit

source /etc/environment

(b1) Set LD_LIBRARY_PATH :

sudo nano /etc/ld.so.conf.d/cuda.conf

Append the following lines to the file.

/usr/lib/nvidia-current
/usr/lib/nvidia-cuda-toolkit

sudo ldconfig

(b2) Create a softlink of libcuda.so :

sudo ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/
sudo ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/


(c) Make softlink to the /usr/include/thrust :

sudo mkdir /usr/lib/include
sudo ln -s /usr/include/thrust /usr/lib/include/


(c1) Add the path of new location of thrust to the common/common.mk :

sudo nano ~/NVIDIA_GPU_Computing_SDK/C/common/common.mk

Go to line 64 and add "-I/usr/lib/include" :

Change from -
INCLUDES += -I. -I$(CUDA_INSTALL_PATH)/include -I$(COMMONDIR)/inc -I$(SHAREDDIR)/inc

Change to -
INCLUDES += -I. -I$(CUDA_INSTALL_PATH)/include -I/usr/lib/include -I$(COMMONDIR)/inc -I$(SHAREDDIR)/inc

(d) Compiling of the sample code :

cd NVIDIA_GPU_computing_SDK/C
make


The executable sample codes will be situated at ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/

Run the sample codes as the following, e.g. nbody and deviceQuery :

./nbody
./deviceQuery

(e) According to the developer of the PPA, this issue (Step 5(b) to Step 5(c1)) (Step 5(c) to Step 5(c1)) may be caused by the SDK itself and nvcc compiler. However, if you install the official SDK, there is no such problem.

***(f) The CUDA 4.0 PPA just updated today (April 26, 2011 GMT+8) and it solved the Step 5(b) to Step 5(b2) problem.

That's all! See you.

Thursday, April 21, 2011

HOWTO : Undelete files and directories on Ubuntu

extundelete is a utility that can recover deleted files from an ext3 or ext4 partition.

Hereby, I am going to show to how to compile and install this utility from source on Ubuntu 10.10. The current version of extundelete is 0.2.0 at this time of writing.

Step 1 :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool e2fslibs-dev autoconf automake autotools-dev m4 e2fslibs e2fsprogs


wget http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download

tar -xvjf extundelete-0.2.0.tar.bz2
cd extundelete-0.2.0
./autogen.sh
./configure
make
sudo make install


Step 1a : (Alternative)

If you want to generate a debian installable file instead of install from source, you can use this step.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool e2fslibs-dev autoconf automake autotools-dev m4 e2fslibs e2fsprogs checkinstall


wget http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download

tar -xvjf extundelete-0.2.0.tar.bz2
cd extundelete-0.2.0
./autogen.sh
./configure
make
sudo checkinstall


Follow the instruction on screen to complete the debian executable file generation.

sudo dpkg -i extundelete_0.2.0-1_amd64.deb
or
sudo dpkg -i extundelete_0.2.0-1_i386.deb

Step 2 :

Usage :

Help -
extundelete --help

To undelete test.png file at /dev/sda3 and /home/samiux -
extundelete /dev/sda3 --restore-file /home/samiux/test.png

To undelete test directory at /dev/sda3 and /home/samiux -
extundelete /dev/sda3 --restore-directory /home/samiux/test

To undelete all files and directories at /dev/sda3 -
extundelete /dev/sda3 --restore-all

That's all! See you.

Tuesday, April 19, 2011

HOWTO : Change mode of files and directories in batch

To change the mode to 777 for all directories under /var/www/drupal.

sudo find /var/www/drupal/*/ -type d -exec chmod 777 {} \;

To drop the execution rights of the all files under /var/www.

sudo find /var/www -type f -exec chmod -x {} \;

That's all! See you.

HOWTO : Performance tuning on Ubuntu

This tutorial can be applied to Desktop and Server. Make sure you have at least 512MB RAM on your system beofre doing so.

Step 1 :

sudo nano /etc/sysctl.conf

Append the following lines at the end of the file.

kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# If you have more than 512MB RAM, use this setting (uncomment it and comment the setting just below)
fs.file-max = 262140
# If you have 512MB RAM or less, use this setting
#fs.file-max = 65535
vm.swappiness = 1
vm.vfs_cache_pressure = 50
vm.min_free_kbytes = 65536

net.core.rmem_default = 33554432
net.core.rmem_max = 33554432
net.core.wmem_default = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 10240 87380 33554432
net.ipv4.tcp_wmem = 10240 87380 33554432
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_window_scaling = 1
#net.ipv4.tcp_timestamps = 1
#net.ipv4.tcp_sack = 1
#net.core.netdev_max_backlog = 5000
#net.ipv4.tcp_mem = 786432 1048576 26777216
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_max_tw_buckets = 360000

net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.core.somaxconn = 32768
net.core.netdev_max_backlog = 32768
net.ipv4.tcp_max_syn_backlog = 65536
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_fin_timeout = 15
#net.ipv4.tcp_sack = 0
net.ipv4.tcp_orphan_retries = 2
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_syncookies = 1


Save and perform the following command.

sudo /sbin/sysctl -p

Step 2 :

sudo nano /etc/rc.local

Insert the following lines just before "exit 0". This requires to reboot the system to make it works.

echo 1024 > /sys/block/sda/queue/read_ahead_kb
echo 256 > /sys/block/sda/queue/nr_requests


Step 3 :

To do the following step is in your own risk. It works for ext4 only.

sudo nano /etc/fstab

add "discard,norelatime,noatime" just before "errors=remount-ro" and "defaults".

If there is any problem or error when applying the commands, please do not reboot the system. Correct the problem or typo before reboot. Otherwise, your system cannot be reboot.

sudo mount -a
sudo mount -o remount /


Step 4 :

You can now reboot your system if there is no error at Step 3.

That's all! See you.

Friday, April 01, 2011

HOWTO : Latest Adobe Flash for 64-bit Ubuntu 10.10

When you upgraded your Firefox to version 4 on your 64-bit Ubuntu as per this tutorial, you may find that the flash is operating abnormally. Now, we can fix this by installing the latest Flash from PPA.

As I do not have any 32-bit system, I do not know what happen to 32-bit when Firefox is upgraded to version 4.

Your 32-bit version of Flash will be uninstalled automatically from your 64-bit system.

sudo add-apt-repository ppa:sevenmachines/flash
sudo apt-get update
sudo apt-get install flashplugin64-installer


That's all! See you.

Thursday, March 31, 2011

HOWTO : Upgrade to Firefox 4 on Ubuntu 10.10

Firefox 4 is released recently. It also works on Ubuntu 10.10. You can upgrade it from PPA. Be keep in mind that some of the add-ons are not compatible with Firefox 4 at the moment.

sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update
sudo apt-get upgrade


That's all! See you!

Saturday, March 26, 2011

HOWTO : LibreOffice 3.3 on Ubuntu 10.10

OpenOffice is now owned by Oracle. The development team of previous OpenOffice reformed and developed LibreOffice for the replacement. You can use LibreOffice as the alternative. LibreOffice is faster and more powerful.

Be keep in mind that OpenOffice will be uninstalled automatically when you install LibreOffice.

Step 1 :

sudo add-apt-repository ppa:libreoffice/ppa

sudo apt-get update

Step 2 :

sudo apt-get install libreoffice-gtk libreoffice-gnome libreoffice-pdfimport libreoffice-officebean libreoffice-ogltrans libreoffice-wiki-publisher libreoffice-core libreoffice-mysql-connector libreoffice-base-core libreoffice-style-andromeda libreoffice-calc libreoffice-draw libreoffice-impress libreoffice-writer libreoffice-math libreoffice-common libreoffice-emailmerge libreoffice-l10n-common libreoffice-dtd-officedocument1.0 libreoffice-report-builder-bin libreoffice-style-hicontrast libreoffice-base libreoffice-java-common libreoffice-style-galaxy libreoffice-report-builder ttf-opensymbol libreoffice-presentation-minimizer libreoffice-style-crystal libreoffice-style-oxygen libreoffice-filter-mobiledev mozilla-libreoffice libreoffice-style-human libreoffice-style-tango python-uno ure uno-libs3 libreoffice-help-en-us

Step 3 : (Optional)

The following will install Traditional Chinese and Simplified Chinese.

sudo apt-get install libreoffice-l10n-zh-cn libreoffice-l10n-zh-tw libreoffice-help-zh-cn libreoffice-help-zh-tw

Step 4 : (Optional)

If you are using Kubuntu, install the following instead of libreoffice-gnome and libreoffice-gtk.

sudo apt-get install libreoffice-kde

That's all! See you.

Thursday, March 24, 2011

HOWTO : Third Party Modules for Drupal 6

The following list is my currently using third party modules of Drupal 6.2. I would like to share with you all.

Download the following modules with the following url and put them at sites/all/modules/contribute/.

http://www.drupal.org/project/????

Where ???? is the following titles

e.g. http://www.drupal.org/project/acl


acl

# The following are for Google Adsense
adsense
adsense_injector

advanced_forum
advanced_forum_more_styles
advanced_help
advuser
author_pane
backup_migrate
bookmark_us
browscap
cck
composite
content_access
ctools
date
db_maintenance
emfield
fb
fckeditor
filefield
formblock
getid3
google_analytics
htmlmail
i18n
imageapi
imagecache
imagefield
jquery_ui
lang_dropdown
languageicons
lightbox2
login_security
media_youtube
mimemail
mobile_tools
mollom
mp3player

# The following are for online shop
nap
node_access_rebuild_bonus

options_element
panels
pathauto
phone
phpmailer
print
private
privatemsg
rules
security_review
select_or_other
signup
simpletest
sina_open
sitedoc
skinr
tablefield
theme_editor
token

# The following are for online shop
ubercart
uberpos
uc_addresses
uc_alipay
uc_coupon
uc_node_access
uc_node_checkout
uc_product_triggers
uc_views

user_delete
user_register_notify
views
views_bulk_operations
webform
webform_validation
wurfl

# The following are themes for mobile_tools
fusion
fusion_mobile


By the way, if you want to tune the Drupal 6, MySQL and PHP5 as well as Hiawatha, please refer to Performance tuning and Installation of Hiawatha and Drupal.

That's all! See you.

Monday, February 21, 2011

HOWTO : Drupal 6.2 or 7 with Hiawatha 7.4 WebServer on Ubuntu Server/Desktop 10.10

I am going to setup a development environment of Drupal 6.2 or 7 with Hiawatha 7.4 on Ubuntu Desktop 10.10. However, this setting is also suit for production environment on Ubuntu Server 10.10 with a little bit changing.

Step 0 - Installation of Hiawatha

Follow this link to install required packages. You can omit the optional security settings at the moment.

Step 1 - Configuration of Hiawatha

Change the following section to the /etc/hiawatha/hiawatha.conf.

Binding {
   Port = 80
   #Interface = 127.0.0.1
   MaxKeepAlive = 30
   TimeForRequest = 3,20
   MaxRequestSize = 8192
   MaxUploadSize = 30
}


Add the following section to the /etc/hiawatha/hiawatha.conf.

UrlToolkit {
   ToolkitID = drupal7
   RequestURI exists Return
   Match /favicon.ico Return
   Match .* Rewrite /index.php
}


or/and

UrlToolkit {
   ToolkitID = drupal6
   RequestURI exists Return
   Match ^/favicon.ico$ Return
   Match /(.*)\?(.*) Rewrite /index.php?q=$1&$2
   Match /(.*) Rewrite /index.php?q=$1
}


Step 2 - Configuration of virtual host

sudo nano /etc/hiawatha/enable-site/drupal7

Drupal 7 :

VirtualHost {
   Hostname = localhost, 127.0.0.1
   WebsiteRoot = /var/www/drupal7
   StartFile = index.php
   SecureURL = false
   AccessLogfile = /var/log/hiawatha/access.log
   ErrorLogfile = /var/log/hiawatha/error.log
   TimeForCGI = 120
   #UseFastCGI = PHP5
   UseToolkit = drupal7
   #DenyBody = ^.*%3Cscript.*%3C%2Fscript%3E.*$
   ExecuteCGI = yes
   PreventCSRF = yes
   PreventSQLi = yes
   PreventXSS = yes
   TriggerOnCGIstatus = no
}


or

sudo nano /etc/hiawatha/enable-site/drupal6

Drupal 6 :

VirtualHost {
   Hostname = localhost, 127.0.0.1
   WebsiteRoot = /var/www/drupal6
   StartFile = index.php
   SecureURL = false
   AccessLogfile = /var/log/hiawatha/access.log
   ErrorLogfile = /var/log/hiawatha/error.log
   TimeForCGI = 120
   #UseFastCGI = PHP5
   UseToolkit = drupal6
   #DenyBody = ^.*%3Cscript.*%3C%2Fscript%3E.*$
   ExecuteCGI = yes
   PreventCSRF = yes
   PreventSQLi = yes
   PreventXSS = yes
   TriggerOnCGIstatus = no
}


Step 2a :

sudo /etc/init.d/hiawatha restart

Step 3 : Preparation of installation of Drupal

Download the Drupal from her official site. Extract the downloaded file and copy to /var/www/.

sudo tar -xzvf drupal-6.20.tar.gz

or

sudo tar -xzvf drupal-7.0.tar.gz

Step 3a :

Create a directory under /var/www/.

sudo mkdir /var/www/drupal6

or

sudo mkdir /var/www/drupal7

Step 3b :

Copy the files to the /var/www/.

sudo cp ~/drupal-6.20/* /var/www/drupal6

or

sudo cp ~/drupal-7.0/* /var/www/drupal7

Step 3c :

cd /var/www/drupal6

or

cd /var/www/drupal7

Step 3d :

sudo chmod a+w sites/default
sudo mkdir sites/default/files
sudo chmod a+w sites/default/files


sudo cp sites/default/default.settings.php sites/default/settings.php
sudo chmod a+w sites/default/settings.php


Step 3e :

mysql -u root -p

After entered the password, create a database for the installation.

create database drupal;

After that, then quit MySQL.

quit

Step 3f :

Open the browser and type "localhost" at the address field to continue the installation. The database name is "drupal".

When the installation is completed, carry out the following commands.

sudo chmod go-w sites/default
sudo chmod go-w sites/default/settings.php


sudo chmod a-r CHANGELOG.txt

Step 4 : Complete the installation

Drupal 6.2

sudo crontab -e

Add the following :

0 * * * * wget -O - -q -t 1 http://localhost/cron.php

or

Drupal 7

Administration -- Configuration -- System -- Cron

Get the Cron key at Administration -- Reports -- Status report -- Cron maintenance tasks.

sudo crontab -e

0 * * * * wget -O - -q -t 1 http://localhost/cron.php?cron_key=YOURKEY

Step 5 : Localization (Optional)

Download the required localization .po file at the following links.

http://localize.drupal.org/download
http://drupal.org/localize

That's all! See you.

Sunday, February 13, 2011

HOWTO : CakePHP 1.3.7 and Hiawatha 7.4 on Ubuntu Desktop 10.10

This tutorial shows you how to configure a development environment of CakePHP on Ubuntu Desktop 10.10. It can also be used in production for Ubuntu Server 10.10.

Step 0 :

Follow this link to install Hiawatha 7.4 on Ubuntu Desktop 10.10. The security options can be skipped.

Step 0a :

sudo nano /etc/hiawatha/hiawatha.conf

Add the following to "hiawatha.conf".
UrlToolkit {
   ToolkitID = cakephp
   Match ^/app/webroot/ Skip 2
   Match ^/app/(.*) Rewrite /$1 Continue
   Match ^/(.*) Rewrite /app/webroot/$1 Continue
   RequestURI exists Return
   Match (.*)\?(.*) Rewrite $1&$2 Continue
   Match ^/app/webroot/(.*) Rewrite /app/webroot/index.php?url=$1
}


UrlToolkit {
   ToolkitID = cakephp_apps
   Match ^/webroot/ Skip 2
   Match ^/(.*) Rewrite /$1 Continue
   Match ^/(.*) Rewrite /webroot/$1 Continue
   RequestURI exists Return
   Match (.*)\?(.*) Rewrite $1&$2 Continue
   Match ^/webroot/(.*) Rewrite /webroot/index.php?url=$1
}


Step 0b :

sudo nano /etc/hiawatha/enable-sites/mysite

VirtualHost {
   Hostname = localhost, 127.0.0.1
   WebsiteRoot = /var/www/mysite
   StartFile = index.php
   AccessLogfile = /var/log/hiawatha/access.log
   ErrorLogfile = /var/log/hiawatha/error.log
   TimeForCGI = 15
   #UseFastCGI = PHP5
   UseToolkit = cakephp_apps
   DenyBody = ^.*%3Cscript.*%3C%2Fscript%3E.*$
   ExecuteCGI = yes
   PreventCSRF = yes
   PreventSQLi = yes
   PreventXSS = yes
}


Step 1 :

Install CakePHP for github.
sudo apt-get install git

cd /var/www

sudo git clone https://github.com/cakephp/cakephp.git

Step 1a :

sudo nano /etc/environment

Add the following to the end of the line, but within in the " ".

:/var/www/cakephp/cake/console

Step 1b :

. /etc/environment

To see if the captioned path is included or not :

echo $PATH

Step 2 :

Create databases and tables according to your project requirement.

mysql -u root -p

When done, type the following :

quit

Step 3 :

cd /var/www

sudo su

cake bake project myproject

Follows the instruction on the screen.

cd /var/www/myproject

cake bake model all
cake bake controller all
cake bake view all


Exit from the root.
exit

Step 4 :

cd /var/www/myproject/config

sudo cp database.php.default database.php

Change the "login", "password" and "database" accordingly to the MySQL root and password as well as database that you just created.

Step 5 :

Now you can open Firefox to browse your application by typing "localhost" at the address field.

Step 6 :

To configure localization for the application.

sudo apt-get install libwxgtk2.8-dev libwxbase2.8-0 wx-common wx2.8-headers libwxgtk2.8-0

Go to http://www.poedit.net to download the current version 1.4.6.1.

tar -xvzf poedit-1.4.6.1.tar.gz
cd poedit-1.4.6.1


./configure
make
sudo make install


Reboot your computer when necessary.

Step 6a :

cd /var/www/myproject

sudo su

cake i18n

Select "E" and follows the instruction on screen. Then, select "I".

Now, a "default.pot" file is created at the /var/www/myproject/locale.

Exit from the root.
exit

Execute "poedit" and open the file "default.pot". Translate the content to Traditional Chinese and then save to "default.po". A "default.mo" will also be created.

Step 6b :

sudo mkdir /var/www/myproject/locale/zh_TW
sudo mkdir /var/www/myproject/locale/zh_TW/LC_MESSAGES

sudo cp /var/www/myproject/locale/default.* /var/www/myproject/locale/zh_TW/LC_MESSAGES/

Step 6c :

cd /var/www/myproject/config
sudo nano core.php

Append the following line to the core.php :

Configure::write('Config.language', 'zh_TW');

Restart Hiawatha :
sudo /etc/init.d/hiawatha restart

For example :
Open the browser and type "localhost/users", the content will be changed to Traditional Chinese.

*Where "users" is a Controller and table of a database that you just create. "users" is just an example.

That's all! See you.

Wednesday, January 26, 2011

HOWTO : Tor on Back|Track 4 R2

Step 1 :

Make sure tor and privoxy are installed.

apt-get install tor privoxy

Step 2 :

nano /etc/privoxy/config

Append the following line to the file.

forward-socks4a / localhost:9050 .

Step 3 :

/etc/init.d/privoxy start
/etc/init.d/tor start


Step 4 :

Install tor button on firefox

https://addons.mozilla.org/zh-TW/firefox/addon/torbutton/

Go to Tor Button perference and set as the following.

Select "Use custom proxy settings"

HTTP Proxy : 127.0.0.1 Port : 8118
SSL Proxy : 127.0.0.1 Port : 8118
SOCKS host : 127.0.0.1 Port : 9050


Step 5 :

Click on the "Tor enable" at the right bottom of the Firefox to enable the Tor Button.

Hints : You should repeat the Step 3 and Step 5 when you are using Tor to surf the internet next time.

That's all! See you.

Saturday, January 22, 2011

HOWTO : Traditional Chinese support on Back|Track 4 R2

Back|Track 4 R2 is an English based Linux distribution. The Firefox cannot browse Traditional Chinese webpages properly. This tutorial shows you how to make Back|Track 4 R2 to recognize Traditional Chinese characters on Firefox.

Open the terminal and key in the following :

apt-get install language-support-zh language-support-fonts-zh language-support-input-zh language-support-translations-zh language-pack-zh language-pack-zh-base language-pack-kde-zh language-pack-kde-zh-base kde-l10n-zhtw

After the installation, reboot your system.

That's all! See you.

Wednesday, December 22, 2010

HOWTO : GoDaddy.com and Google Apps (Email) with your Domain

You can use GMail web mail service with your domain name, such as yourname@yourdomain.com on www.gmail.com.

Follow this link to set up Postfix to use GMail as your SMTP server.

Step 0 :

Apply of free Google Apps (Free) Email :

Google Apps (Free) Email

Step 1 :

Create the MX record at your domain automatically.

Create the MX record at your domain manually.

The MX record are :
ASPMX.L.GOOGLE.COM
ALT1.ASPMX.L.GOOGLE.COM
ALT2.ASPMX.L.GOOGLE.COM
ASPMX2.GOOGLEMAIL.COM
ASPMX3.GOOGLEMAIL.COM


Step 1a :

Create a SPF record

Step 2 :

You will receive a email from Google and ask you to create a adminstrator account with your domain name. Your domain name needs to be authorized to use Google Apps. You should follow the instructions to complete the process.

After that, you can you GMail as your domain's email.

Step 3 (Optional) :

If you are using Untangle as gateway and IPS, you should do the following :

Open a browser and point to Untangle web page as well as login.

Config/Networking/Hostname

Change the following settings :

From -
Hostname : untangle.mydomain.com

To -
Hostname : untangle.mydomain.local

Step 3a (Optional) :

Config/Email/Outging Email Server (SMTP)

Change the following settings :

Send Email using the specified SMTP Server
- Server Address or Hostname : <postifx server IP address>
- Server Port : 25


Known issue

Cannot send to yourself with your domain, e.g. yourname@yourdomain.com via Untangle.

That's all! See you.

HOWTO : Send Mail to GMail by Postfix on Ubuntu Server 10.10

You cannot send any mail to GMail from you mail server, unless you set GMail server as your SMTP server.

Step 0 :

Install the Ubuntu Server 10.10 and select Mail Server when install.

Step 1 :

sudo nano /etc/postfix/transport

Append the following line.

*     smtp:[smtp.gmail.com]:587

Step 2 :

sudo nano /etc/postfix/sasl/sasl_passwd

Append the following line.

[smtp.gmail.com]:587     samiux@gmail.com:password

Step 3 :

sudo nano /etc/postfix/main.cf

Add or make the change of the following lines.

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
mynetworks = 192.168.0.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128


Step 4 :

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Step 5 :

sudo postmap /etc/postfix/transport
sudo postmap /etc/postfix/sasl/sasl_passwd


Step 6 :

sudo /etc/init.d/postfix restart

That's all! See you.

Thursday, December 16, 2010

HOWTO : Faster Firefox

The following steps are for broadband users who are using Firefox and wish it is running more faster.

Step 0 :

Open Firefox and type the following at the address field.

about:config

Step 1 :

Change the following value from "false" to "true" :

network.http.pipelining
network.http.proxy.pipelining


Step 2 :

Change the following value from "4" to "30" :

network.http.pipelining.maxrequests

Step 3 :

At any browsing area of the browser, add the following string with a value of "0" :

nglayout.initialpaint.delay

Step 4 :

Restart Firefox. Now, you can browse the web pages more faster.

That's all! See you.

HOWTO : No skill hacking with Armitage on Back|Track 4 R2

*** WARNING : This tutorial is for education purpose only. It alert you to update your system once there is any patch or update available. Please do not hack any website, computer and/or network without authorization. Otherwise, you will be put into the jail. ***

Prerequisites

In order to complete this tutorial, you should have an Ubuntu or Windows system as host. Back|Track 4 R2 and Metasploitable as clients on VirtualBox 3.2.

You can download Back|Track 4 R2 at here and Metasploitable at here. Metasploitable is an Ubuntu Server 8.04 that installed some applications with flaws that can be exploited.

The installation of Back|Track 4 R2 is here.

The network interfaces of Back|Track 4 R2 on VirtualBox 3.2 are "NAT and "Host Only (vboxnet0)". The network interface of Metasploitable is "Host Only (vboxnet0)".

The Armitage should be installed on Back|Track 4 R2 and the tutorial is here.

Step 0 :

Run the Metasploitable on VirtualBox first. The IP address should be 192.168.56.101. The run Back|Track 4 R2 on VirtualBox the next and the IP address should be 10.x.x.x of eth0.

Step 1 :

On the Back|Track 4 R2, run the following command to make sure eth0 and eth1 are up and have their IPs.

/etc/init.d/networking restart

Step 2 :

Run the following commands to launch Armitage.

/etc/init.d/mysql start
cd /pentest/exploits/armitage
./armitage.sh


Step 3 :

Select "Use SSL" and click "Start MSF".

Then, "Using database driver mysql" message box will be displayed. Click "OK".

Step 4 :

Select "Host" -- "Nmap Scan" -- "Intense Scan, all TCP ports"

Wait for the scanning complete.

Step 5 :

Select "Attacks" -- "Find Attacks" -- "by port".

Wait for the scanning complete.

Step 6 :

Select "Attacks" -- "Hail Mary" -- "by port".

Wait for the "Monitor" image to change to red colour. If so, the target is exploited. Then, right click on the "Monitor" image and select "Shell". To check if the target is privilege escalated by issuing "whoami" on the Shell. If it shows "root", you are successfully owned the target.



That's all! See you.

Wednesday, December 08, 2010

HOWTO : The Onion Router (Tor) on Ubuntu 10.10 Desktop

Tor Overview

Step 1 :

sudo nano /etc/apt/sources.list

Append the following line to the file :

deb http://deb.torproject.org/torproject.org lucid main

Save and exit. Then add the key :

gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -


Install tor.

sudo apt-get install tor

Step 2 :

Install Privoxy.

sudo apt-get install privoxy

Edit the configure file of privoxy.

sudo nano /etc/privoxy/config

Append the following line.

forward-socks4a / localhost:9050 .

Step 2a (Optional) :

If you are behind firewall or NAT as well as router, you should append the following line at the configure file.

forward 192.168.*.*/ .

Step 3 :

Made sure Tor is working.

sudo /etc/init.d/privoxy start
sudo /etc/init.d/tor start


netstat -a | grep 9050

If the output is similar to the following line, your Tor is working.

tcp 0 0 localhost:9050 *:* LISTEN

Step 4 :

Get "TorButton" addon for Firefox. Then enable/disable it by Ctrl+2.

Step 5 :

You can confirm the Tor is working on the remote side by visiting the following site.

check.torproject.org

Step 6 (Optional) :

If the System start/stop links do not exist, please issue the following commands :

sudo update-rc.d privoxy defaults
sudo update-rc.d tor defaults


Reference

Tor Project
TorButton
WiKi of Tor

That's all! See you.