Monday, May 16, 2011

HOWTO : Blank screen when boot up Ubuntu 11.04 Desktop

I have a very old SONY laptop and the model is PCG-TR1. The following is the display card of the laptop :

lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

You can boot up the Live CD or DVD and install the system properly. It is no problem when the first boot up after the installation. However, it will be blank screen / black screen on the second and later boot up.

How to overcome this problem? Yes, I can and going to tell you.

Step 1 :

The screen will go blank and black in the second boot and later. Don't worry, just press the following key combination. Yes, just complete the following key combination.

Press ctrl+alt+F5, ctrl+alt+F7, ctrl+alt+F5, and then ctrl+alt+F7

Then, you will see the login screen again. You should press the key combination every time when you boot up your system.

However, the Unity 3D interface and special effect do not support but classic is working fine.

Step 2 (Optional) :

To use Unity 2D interface instead of Gnome classic interface.

sudo apt-get update
sudo apt-get install unity-2d


Reboot your system.

Select "Unity 2D" at the bottom of the screen when login to the system after the next boot up.

Remarks :

Some laptops that equipped with other model of Intel integrated display cards may encounter other problems, such as blinking screen. Someone out there suggest to update the xorg packages may solve the problems.

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get dist-upgrade


That's all! See you.

Saturday, May 14, 2011

HOWTO : SopCast and PPStream on Ubuntu 11.04 Desktop Made Easy

SopCast is online TV and PPStream is online movie of China. Now, you can watch these online TV and movies on Totem. This tutorial is written for any person who know Chinese.

Step 1 :

sudo apt-add-repository ppa:cnav/ppa
sudo apt-get update


Step 2 :

SopCast :

sudo apt-get install sopcast gst-plugins-sopcast totem-sopcast

PPStream :

sudo apt-get install ppstream gst-plugins-pps totem-plugin-pps totem-pps

Step 3 :

Open Totem. Select "Edit" -- "Plugins" on the menu.

Enable "SopCast browser" and "PPStream browser".

Enable "Show channel name in Chinese" at "Setup" of "SopCast". This step is important if you want to use "Step 6" below; otherwise, some channels cannot be shown up.

Select "SopCast" or "PPStream" at the right hand side's sidebar and enjoy it.

Step 4 (Optional) :

Enter "about:config" (without quote) at the address field of Firefox. Right click on any empty place. Select "Add", then choose "Boolean". Enter "network.protocol-handler.expose.pps" (without quote) to the place provided. Then choose "false".

Go to http://kan.pps.tv/ and choose any movie and select "Client Playback" (客戶端播放). Then select "/usr/bin/totem" from the file system.

The video will be playback on the Totem after clicking on the "Client Playback".

Step 5 (Optional) :

Install GMLive for SopCast channels as the channel of SopCast at Totem does not work.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gmlive


(a) Open GMLive and select "Tools" on the menu. "Preference" -- "SopCast"

Change the values as the following :
Mplayer cache : 8192 Kbs
Boardcast URL : http://www.sopcast.com/gchlxml


(b) Open GMLive and select "Tools" on the menu. "Preference" -- "GMLive"

Disable "PPLive support".
PPStream function does not work at GMLive.

Football channels for example :
"Vozao.com" and "Sports Channel" on the list of SopCast.

Step 6 (Optional) :

(a) If you want to use the channel list of GMLive instead of Totem's one, you can copy it.

mv ~/.local/share/totem/plugin/sopcast/channels.xml ~/.local/share/totem/plugin/sopcast/channels.xml-original

cp ~/.config/gmlive/sopcast.lst ~/.local/share/totem/plugin/sopcast/channels.xml

(b) Or, if you do not want to install GMLive, you can download the channel list for SopCast official site.

mv ~/.local/share/totem/plugin/sopcast/channels.xml ~/.local/share/totem/plugin/sopcast/channels.xml-original

wget http://www.sopcast.com/gchlxml
cp gchlxml ~/.local/share/totem/plugin/sopcast/channels.xml


The same football channels as "Step 5" are at the "Other" on the right hand side of the Totem. They are "Sport" and "Soccerhd.info".

Remarks :

Some channels of SopCast on Totem are not working. However, sports channel of CCTV is working properly. Fortunately, it can be overcame by doing the "Step 6(a)" or "Step 6(b)".

The video playback with PPStream on Totem will not be counted at the webpage of http://kan.pps.tv/. Therefore, some of the movies cannot be watched.

PPStream does not work on GMLive. PPLive does not support on GMLive in this tutorial.

** If you are using Ubuntu Samiux Remix 11.04 r0.8.1 or later, the captioned steps had been completed for you (but except the Firefox step). You can use it right away. You can download it at here.

UPDATED

Today (2011-June-11), I cannot use Totem to watch PPStream and the reason is still unknown. However, PPStream can be (Search for the application namely PPStream by press "Super" key). Just go to "Tool" -- "Option" -- "Select Sound device" and choose "alsa" to enable the sound of the PPStream.

That's all! See you.

Saturday, May 07, 2011

HOWTO : HD video playback on Ubuntu 11.04 Desktop

Step 1 - Install the official driver and SMPlayer from Ubuntu :

Install the official nVidia or ATi display card driver from the "Hardware drivers" from your Ubuntu 11.04 system. Then, install SMPlayer for the video player.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install smplayer


Step 2 - SMPlayer configuration :

(A) Open the SMplayer. Select "Option" -- "Preference".

Go to "General" on the left hand side :

(1) If you have an nVidia display card :
"General" -- "Video" -- "Output driver" : vdpau

(2) If you have an ATi/AMD Radeon display card :
"General" -- "Video" -- "Output driver" : xv (0 - ATI Radeon AVIVO video)

(B) Go to "Performance" on the left hand side :
"Performance" -- "Cache" -- "Local" : 99999 kb
"Performance" -- "Cache" -- "Streaming" : 99999 kb

"Performance" -- "Performance" -- "Allow hard frame drop (can lead to image distortion)" : Enable
"Performance" -- "Performance" -- "H.264" -- select "loop filter (only skip on HD moive)"

If you have dual core CPU -
"Performance" -- "Performance" -- "Decoding thread (only MEG-1/2 and H.264)" : 2

Remarks :

Lenovo ThinkPad X100e, which is equipped with ATi Radeon HD3200 and AMD Athlon Neo MV-40 single processor, can playback HD movies (such as MKV) smoothly.

That's all! See you.

Tuesday, May 03, 2011

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 11.04 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 11.04 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 libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev 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.

HOWTO : nVidia CUDA 4.0 RC on Ubuntu 11.04 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 11.04 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 libcudart4 libcublas4 libcufft4 libcusparse4 libcurand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev opencl-headers

32-bit :
sudo apt-get install nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-compute-profiler lib32npp4 nvidia-cuda-doc lib32cudart4 lib32cublas4 lib32cufft4 lib32cusparse4 lib32curand4 nvidia-current nvidia-opencl-dev nvidia-current-dev nvidia-cuda-dev 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".

Known issue

Sample codes cannot be compiled successful due to newer C compiler. However, you can download the sample programs which are compiled with C compiler of Ubuntu 10.10. The compiled sample programs are in 64-bit.

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

tar -xvzf CUDA_4.0_samples_x64.tar.gz
cd CUDA_4.0_samples_x64
./nbody

That's all! See you.

Monday, May 02, 2011

Hints on installation of Ubuntu 11.04

Ubuntu 11.04 comes with a new theme namely Unity. It is a 3D theme that requires 3D display driver.

If you have an nVidia or ATi/AMD display cards, you should install the display driver after the installation of Ubuntu 11.04. Otherwise, you will be in Classic interface instead of Unity.

Or, may be you can install the 2D Unity instead.

sudo apt-get install unity-2d

Furthermore, the 3D Unity will be installed automatically on Intel display card system.

In addition, if you are going to install Ubuntu 11.04 on a laptop or netbook, you should plug in the power cable; otherwise, your interface after the installation will be in a mess.

If you considered to upgrade from 10.10, I recommended to fresh install as some previous settings of Gnome may affect to the new interface - Unity as well as Firefox 4. Before fresh install, please backup all your data.

By the way, if you encounter the blank screen or black screen on Intel display card system, you can refer to this tutorial.

The following is the video which shows you how to operate with the Unity on my remastered Ubuntu Samiux Remix :



That's all! See you.

HOWTO : Moonlight on Ubuntu 11.04

Moonlight is a clone of Microsoft Silverlight for Linux. Ubuntu 11.04 has it in the repository.

Step 1 :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libmoon moonlight-plugin-mozilla moonlight-plugin-core


Step 2 :

Go to the official Mono site to download and install the addon for Firefox.

Mono site

Step 3 (Optional) :

Go to Hong Kong Jockey Club website to test the result of the installation. You may required to install Microsoft Video Media Codec. Just do so to install.

After that, restart your Firefox to make the addon works.

Remarks :

When the Firefox is updated to 5.0, the Moonlight is not supported. However, you can download "Add-on Compatibility Reporter" to overcome this problem.

Add-on Compatibility Reporter

That's all! See you.

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.