Install Ode with lighttpd in Squeeze

Both Lighttpd and Ode are quite light weight. Lighttpd is a www server like Apache while Ode is a blog software like WordPress. They’re the best couple for simple personal blog especially installed on your laptop. In Debian Squeeze, you’ll need to tweak something to get it work.

1, Install lighttpd and change the default cgi-bin location

$ apt-get install lighttpd    # install lighttpd, it will run default when boot

The default cgi-bin scripts is in /usr/share/cgi-bin within Debian, but I wanna change it to /var/www, so create a directory and tweak the lighttpd configuration later.

$ mkdir -p /var/www/cgi-bin     # create directory

$ lighty-enable-mode cgi      # enable CGI module of lighttpd

$ vim /etc/lighttpd/conf-enable/10-cgi.conf  #relocate the cgi directory

$HTTP["url"] =~ “^/cgi-bin/” {
cgi.assign = ( “.cgi” => “/usr/bin/perl” )
}

Make sure the configuration have above such section.

2, Install Ode

$ wget http://ode-is-simple.com/downloads/ode_releases/ode_current.zip     # download ode

Unpress it and read the install manual carefully, after that move ode files to propriate location:

$ mv Part1/ode.cgi /var/www/cgi-bin/
$ mv -r Part3/ode_site /var/www/ode
$ mv -r Part2/data /var/www/ode/

Set the cofiguration:

$ vim /var/www/cgi-bin/ode.cgi          #set the location of ode configuration file
$config_dir_f = ‘/var/www/ode/data/’;
$config_filename_f = ‘ode_config’;

$ vim /var/www/ode/data/ode_config
$document_root = ‘/var/www/ode’;
  $document_root = ‘/var/www/ode’;

Set the right file permission:

$ ls -l /var/www/
drwxr-xr-x 2 root root 4096 Feb 12 13:12 cgi-bin
drwxr-xr-x 4 root root 4096 Feb 11 18:18 ode

 

 

 

 

Compile Mplayer in Debian

How to: Recompiling / Rebuild Debian / Ubuntu Linux Binary Source File Packages

by Vivek Gite on January 15, 2008 ·

Q. I’d like to rebuild a Debian / Ubuntu package called foo with additional option. How do I recompile .deb packages?

A. To build a Debian package, you need the following packages / software installed on system
[a] fakeroot : fakeroot package – runs a command in an environment wherein it appears to have root privileges for file manipulation. This is useful for allowing users to create archives (tar, ar, .deb etc.) with files in them with root permissions/ownership.

[b] dpkg-dev : package building tools for Debian

[c] Development environment – You need gcc, make and all other compiler collection installed on system. Under Debian / Ubuntu package build-essential takes care of everything.

Step #1: Install required packages

Type the following command
$ sudo apt-get install build-essential fakeroot dpkg-dev

Step #2: Install source code package

First, create a directory to store source package, enter:
$ mkdir build
$ cd build

Use apt-get command to install source code for a package called foo
$ sudo apt-get source foo
Install all build-dependencies, enter:
$ sudo apt-get build-dep foo
Unpacks Debian / Ubuntu source archives with Debian source package (.dsc) manipulation tool, enter:
$ dpkg-source -x foo_version-revision.dsc
To just compile the package, you need cd into foo-version directory and issue the command
$ dpkg-buildpackage -rfakeroot -b
If you want to pass custom additonal options to configure, you can set up the DEB_BUILD_OPTIONS environment variable. For instance, if you want pass option called –enable-radio –enable-gui, enter:
$ DEB_BUILD_OPTIONS="--enable-gui --enable-radio" fakeroot debian/rules binary
You can also pass some variables to the Makefile. For example, if you want to compile with gcc v3.4, enter:
$ CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-gui --enable-radio" fakeroot debian/rules binary

A complete example – mplayer

Let us see how to rebuild mplayer media player package with –enable-radio –disable-ivt options:
# sudo apt-get source mplayer
# sudo apt-get build-dep mplayer
# dpkg-source -x mplayer_version-revision.dsc
# DEB_BUILD_OPTIONS="--enable-gui --enable-radio --disable-ivt" fakeroot debian/rules binary

Now wait for some time as compile procedure going to take its own time. To install the newly-built package, enter:
# dpkg -i ../mplayer_version-revision_arch.deb

Compiling wireless driver for rtl8191SEvB on Squeeze

Background:
1, OS: Debian Squeeze, kernel-2.6.32
2, Host: Thinkpad SL510, Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller

Program:

  • 1, install linux-headers-`uname -r`;
  • 2, download realtek driver package and compile it;
  • 3, finally reboot

Details:
1, install linux-headers-`uname -r`

apt-get install linux-headers-`uname -r`

After that see if there is a file named ‘build’ in /lib/modules/`uname -r`/, if not,then

cd /lib/modules/`uname -r`

ln -s /usr/src/linux-headers-2.6.32-5-686 build

 

2, compile the realtek driver
download driver package from here: http://drivers.mydrivers.com/download/420-168232-Realtek-RTL8191SE-VA2-RTL8192SE-0019.120/
install required tools for compiling, then just go to compile it.

3, reboot and WOW Cheers!!

P.S: Maybe there will need to install firmware-realtek

How-to kill a process by its name

How to terminate a process in Linux without knowing its process id? -use PKILL

When various daemons or processes freeze or hang up, they need to be forcefully terminated in order to stop the illegal operation or harm they may be causing to your system. The general procedure to kill or terminate any process on Linux is to first find out it’s pid (Process Id) using a grep command on the ps -A command. This will tell us the pid of the process to be killed. Then this pid is passed as a parameter to the kill command to terminate the process.
But this is a very lengthy process involving two steps. A process can be easily terminated in just one single step, using the pkill command. You just need to know the name of the process to be killed. All you have to do is pass this process name as a parameter to the pkill command to kill or terminate your process. Simple enough, eh?
原文链接:http://digitizor.com/2009/05/18/how-to-kill-a-process-in-linux-without-knowing-its-process-id/

How-To create a MySQL database and user

要给mysql创建用户和数据库时,一直不喜欢用图形化前端工具,如phpmyadmin,很麻烦,其实用命令行敲几下就OK了,下面是具体步骤。

In order to be able to use a database, one needs to create: a new database, give access permission to the database server to a database user and finally grant all right to that specific database to this user.

This tutorial will explain how to create a new database and give a user the appropriate grant permissions.

For the purpose of this tutorial, I will explain how to create a database and user for the music player Amarok. In order to index its music collection, Amarok quand use a mysql backend.
The requirement for this set up is to have access to a database. We are going to create a database called amarok which will be accessible from localhost to user amarok idetified by the password amarok….

1,Obviously, we need to to have a mysql server installed as well as amarok:

$ sudo apt-get install mysql-server amarok

2,On a default settings, mysql root user do not need a password to authenticate from localhost. In this case, ou can login as root on your mysql server using:

$ mysql -u root

If a password is required, use the extra switch -p:

$ mysql -u root -p
Enter password:

3, Now that you are logged in, we create a database:

mysql> create database amarokdb;
Query OK, 1 row affected (0.00 sec)

4, We allow user amarokuser to connect to the server from localhost using the password amarokpasswd:

mysql> grant usage on *.* to amarokuser@localhost identified by ‘amarokpasswd’;
Query OK, 0 rows affected (0.00 sec)

5, And finally we grant all privileges on the amarok database to this user:

mysql> grant all privileges on amarokdb.* to amarokuser@localhost ;
Query OK, 0 rows affected (0.00 sec)

6, And that’s it. You can now check that you can connect to the MySQL server using this command:

$ mysql -u amarokuser -p’amarokpasswd’ amarokdb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

原帖链接:http://www.debuntu.org/how-to-create-a-mysql-database-and-set-privileges-to-a-user