Friday, March 27, 2009

MySQL tools and settings

MySQL tools
apt-get install mytop

ANALYZE TABLE;

SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED ;
SET sql_mode='TRADITIONAL' ;

SET AUTOCOMMIT = 0;
SET NAMES utf-8;
SET CHARACTER SET utf-8;

(or optionally: latin2 or cp1250, cp1251, etc.)

source: MySQL modes
source2: MySQL charset

Restrict Apache with .htpasswd

Setup

Create access file (.htaccess)
Create password files (.htpasswd, .htgroups)
Place the files to corresponding location

Required files

.htaccess
in your DocumentRoot
.htpasswd in the desired path
.htgroups (optional)


Create .htpasswd file

Create
your new own .htpasswd file:
htpasswd -c /home/user/www/.htpasswd my_user_name

Add user to existing .htpasswd:
htpasswd /home/user/www/.htpasswd another_user_name


Create .htaccess in your document root

.htaccess

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/user/www/.htpasswd
#
# Allow access only for user 'my_user_name'
Require user my_user_name
#
# Require user which belongs to particular group
AuthGroupFile /home/user/www/.htgroups
Require group GroupName
#
# Require any valid user mentioned in htpasswd
Require valid-user

.htgroups (optional)
GroupName: my_user_name

.htpasswd (just example)
my_user_name:mOF02rW7UXe0w

Sources
src: http://httpd.apache.org/docs/2.0/howto/auth.html
src: http://httpd.apache.org/docs/2.0/programs/htpasswd.html

Change default locale in Debian Linux

Change locale in Command line

Commands:
dpkg-reconfigure locales
locale-gen en_US.UTF-8


GNOME

Go to GNOME - System > Administration > Language Support


KDE

Go to KDE - System Settings > Regional & Accessibility > Country/Region & Language


Files
Default locale: /etc/default/locale
Generated locales: /etc/locale.gen
Available locales: /usr/share/i18n/SUPPORTED
/var/lib/locales/supported.d/local

Thursday, March 26, 2009

Build Debian package from source

Prepare build environment:
$ apt-get install debhelper graphviz pkg-config

Download source package:
$ apt-get source packagename
Downloads: a .orig.tar.gz, a .dsc and a .diff.gz.

Auto-build package:
$ apt-get -b source packagename

Build later:
$ cd package_directory
$ dpkg-buildpackage -rfakeroot -uc -b

Install package:
# dpkg -i file.deb

Source: Apt manual