25 November 2009

Slackware 12.2 - Moving to RAID-1

New RAID tools that come with Slackware 12.2 is "mdadm" not "mkraid".
I want to move my Salckware 12.2 had installed sata HDD to software RAID with RAID-1 (mirror).
Again, this is a my success story. Let's go.

Recent system
Hard disk 1 sata 160 gb with Slackware 12.2 installed.

I have installed Slackware 12.2 and he working fine. But its better if have backup system when HDD crash.
That is often situation can happen.
Partiton information:
d1 = /dev/sda
/dev/sda1 /
/dev/sda2 /user/local
/dev/sda3 swap
/dev/sda4 /home

New Harddisk recommended use same size or model:
d2=/dev/sdb
d3=/dev/sdc

Solution:
1.View Harddisk d1 (Slackware 12.2 installed)
#fdisk /dev/sdb
Device boot Start End Blocks Id System
/dev/sdb1 * 1 250 2150025 83 Linux
/dev/sdb2 251 1135 3500250 83 Linux
/dev/sdb3 1136 1452 2514575 82 Linux swap
/dev/sdb4 1453 2509 50251425 83 Linux

2.จัดเตรียม d2
make partition with the same structure of "d1" but set type to "fd (Linux raid autodetect)" to let Slackware auto detect RAID on start up.
#fdisk /dev/sdb
#fdisk /dev/sdc

Device boot Start End Blocks Id System
/dev/sdc1 * 1 250 2150025 fd Linux raid autodetect
/dev/sdc2 251 1135 3500250 fd Linux raid autodetect
/dev/sdc3 1136 1452 2514575 82 Linux swap
/dev/sdc4 1453 2509 50251425 fd Linux raid autodetect

3.Make RAID Drive from created partition:

#mdadm -Cv /dev/md0 -l1 -n2 /dev/sdb1 /dev/sdc1
#mdadm -Cv /dev/md1 -l1 -n2 /dev/sdb2 /dev/sdc2
#mdadm -Cv /dev/md3 -l1 -n2 /dev/sdb1 /dev/sdc4
Note:
-l = RAID level [0, 1, 5]
-n = Amount of disk
-c = Block size default 64 may be 128 if you want.

Start RAID:
#mdadm -A /dev/md0 /dev/sdb1 /dev/sdc1
#mdadm -A /dev/md1 /dev/sdb2 /dev/sdc2
#mdadm -A /dev/md3 /dev/sdb4 /dev/sdc4

4.Make file system:
# mkreiserfs /dev/md0
# mkreiserfs /dev/md1
# mkreiserfs /dev/md3

5.Copy Slackware system from /dev/sda* to /dev/md*
#mount /dev/md0 /mnt
#mkdir -p /mnt/usr/local
#mkdir -p /mnt/home

Mount other drive:
#mount /dev/md1 /mnt/usr/local
#mount /dev/md3 /mnt/home

Copy From old HDD:
#cp -a /bin /mnt
#cp -a /boot /mnt
#cp -a /etc /mnt
#cp -a /home /mnt
#cp -a /lib /mnt
#cp -a /root /mnt
#cp -a /sbin /mnt
#cp -a /tmp /mnt
#cp -a /usr /mnt
#cp -a /var /mnt

#mkdir -p /mnt/mnt
#mkdir -p /mnt/proc

6.Set to boot from RAID Device:
#vi /mnt/etc/lilo.conf
Edit or append the line that include:

#
boot = /dev/md0
raid-extra-boot = mbr
#..
#..
root = /dev/md0
#
#

Run lilo
#lilo -r /mnt

6.Reboot and Set BIOS
Set BIOS to First boot from /dev/sdb or secondary harddisk.
When login to Slackware you can check that Slackware working on raid?
#df -m
it should look like this:

/dev/md0 /
/dev/md1 /user/local
/dev/sda3 swap
/dev/md3 /home

7.Add /dev/sda in RAID to make spare harddisk.
Make partition like (1.)
#fdisk /dev/sda
#mdadm /dev/md0 --add /dev/sda1
#mdadm /dev/md1 --add /dev/sda2
#mdadm /dev/md3 --add /dev/sda4

run lilo to set mbr boot
#lilo

Wait RAID to syn untill 100% you can check by:
#mdadm --detail /dev/md0

More RAID command
Remove harddisk from RAID system of fail.
#mdadm /dev/md0 --fail /dev/sdb1 --remove /dev/sdb1
Or you can shutdown and remove harddisk and open again it will auto syn from spare hardisk.

Check all RAID information:
#mdadm --detail --scan

Check each RAID information
#mdadm --detail /dev/md0
#mdadm --detail /dev/md1
#mdadm --detail /dev/md3

### Good luck to you.###

20 November 2009

Setup Proftpd 1.3.2b to support mysql database account

I want to setup Proftpd 1.3.2b to support mysql database account.
There are many error during make and I try and try. Finally I sucess to install.

Environment
Slackware 13.0
mysql 4.0.26 (Binary install)
proftpd-1.3.2b

get proftpd-1.3.2b.tar.gz from proftpd.org the put on /usr/local/src/ and begin installation.
mysql installed on /usr/local/mysql/ its binary install that lib and include for mysql stay here.
But if you install by make default your lib may be place at /usr/lib and include at /usr/include you must find location of this files
mysql.h , mysqlclient.a.

$ tar -zxvf proftpd-1.3.2b.tar.gz
$ ./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
--with-includes=/usr/local/mysql/include/ --with-libraries=/usr/lib:/usr/local/mysql/lib/lib --with-zilb
$ make

### this state found error I can't remember in detail but may be like this ###
modules/mod_cap.o: In function `lp_add_cap':
mod_cap.c:(.text+0x1a): undefined reference to `cap_set_flag'
modules/mod_cap.o: In function `lp_set_cap':
mod_cap.c:(.text+0x6d): undefined reference to `cap_set_proc'
modules/mod_cap.o: In function `lp_free_cap':
mod_cap.c:(.text+0xda): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_post_pass':
mod_cap.c:(.text+0x150): undefined reference to `cap_init'
mod_cap.c:(.text+0x226): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x23d): undefined reference to `cap_to_text'
mod_cap.c:(.text+0x260): undefined reference to `cap_free'
mod_cap.c:(.text+0x268): undefined reference to `cap_free'
mod_cap.c:(.text+0x496): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_module_init':
mod_cap.c:(.text+0x507): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x514): undefined reference to `cap_free'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1

************************************
: undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x116): In function `my_compress_alloc':
: undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x18d): In function `my_uncompress':
: undefined reference to `uncompress'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
************************************

Solve:

$ vi Make.rules

****************
edit the line that include:
LIBS=-lsupp -ldl -lcrypt -lm -lmysqlclient -lpam

replace with:
LIBS= -lsupp -ldl -lcrypt -lm -lz -lcap /usr/local/mysql/lib/libmysqlclient.a

Note: if you run ./configure again you must edit Make.rules again.
***************

$ vi contrib/mod_sql_mysql.c

Search to found the line that include:
#include

Delete the line and insert 2 line below:

#include
#include

OK, Make again:
$ make
$ make install

It should be no error.

Modify some thing.

$ ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd
$ ln -s /usr/local/var/proftpd.pid /var/run/proftpd.pid
$ ln -s /usr/local/etc/proftpd.conf /etc/proftpd.conf

Create database and provide data to test.

$ mysql -u root -p
create database ftpdb;
grant select, insert, update on ftpdb.* to proftpd@localhost identified by 'password';

use ftpdb;

#
# Table structure for table `ftpgroup`
#

CREATE TABLE ftpgroup (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';

#
# Dumping data for table `ftpgroup`
#

INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpguest');

# --------------------------------------------------------

#
# Table structure for table `ftpquotalimits`
#

CREATE TABLE ftpquotalimits (
name varchar(30) default NULL,
quota_type enum('user','group','class','all') NOT NULL default 'user',
per_session enum('false','true') NOT NULL default 'false',
limit_type enum('soft','hard') NOT NULL default 'soft',
bytes_in_avail int(10) unsigned NOT NULL default '0',
bytes_out_avail int(10) unsigned NOT NULL default '0',
bytes_xfer_avail int(10) unsigned NOT NULL default '0',
files_in_avail int(10) unsigned NOT NULL default '0',
files_out_avail int(10) unsigned NOT NULL default '0',
files_xfer_avail int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `ftpquotatallies`
#

CREATE TABLE ftpquotatallies (
name varchar(30) NOT NULL default '',
quota_type enum('user','group','class','all') NOT NULL default 'user',
bytes_in_used int(10) unsigned NOT NULL default '0',
bytes_out_used int(10) unsigned NOT NULL default '0',
bytes_xfer_used int(10) unsigned NOT NULL default '0',
files_in_used int(10) unsigned NOT NULL default '0',
files_out_used int(10) unsigned NOT NULL default '0',
files_xfer_used int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

#
# Table structure for table `ftpquotatallies`
#

CREATE TABLE `ftpquotatallies` (
`name` varchar(30) NOT NULL default '',
`quota_type` enum('user','group','class','all') NOT NULL default 'user',
`bytes_in_used` float NOT NULL default '0',
`bytes_out_used` float NOT NULL default '0',
`bytes_xfer_used` float NOT NULL default '0',
`files_in_used` int(10) unsigned NOT NULL default '0',
`files_out_used` int(10) unsigned NOT NULL default '0',
`files_xfer_used` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

# --------------------------------------------------------

#
# Table structure for table `ftpuser`
#

CREATE TABLE ftpuser (
id int(10) unsigned NOT NULL auto_increment,
userid varchar(32) NOT NULL default '',
passwd varchar(32) NOT NULL default '',
uid smallint(6) NOT NULL default '5500',
gid smallint(6) NOT NULL default '5500',
homedir varchar(255) NOT NULL default '',
shell varchar(16) NOT NULL default '/sbin/nologin',
count int(11) NOT NULL default '0',
accessed datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY userid (userid)
) TYPE=MyISAM COMMENT='ProFTP user table';

INSERT INTO `ftpuser` VALUES (1, 'testaccount', 'ftppasswd', 5500, 5500, '/home/testdomain.com', '/sbin/nologin',0,'','');

exit;

************************

Create user and group for proftpd:
$ groupadd -g 5500 ftpgroup
$ useradd ftpuser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup

Config proftpd file /etc/proftpd.conf

$ vi /etc/proftpd.conf

## Begin proftpd.conf ##

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName "ProFTPD Default Installation"
#.ServerType standalone
#.Set Proftpd to run with /etc/inetd.conf
ServerType inetd
DefaultServer on

# Port 21 is the standard FTP port.
Port 21

# Don't use IPv6 support by default.
UseIPv6 off

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30

# Set the user and group under which the server will run.
User nobody
Group nogroup
#User ftpuser
#Group ftpgroup

SystemLog /var/log/proftpd.log
TransferLog /var/log/xferlog

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#.DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite on

# Bar use of SITE CHMOD by default

DenyAll


# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire section.
#.
#. User ftp
#. Group ftp

# We want clients to be able to login with "anonymous" as well as "ftp"
#. UserAlias anonymous ftp

# Limit the maximum number of anonymous logins
#. MaxClients 10

# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
#. DisplayLogin welcome.msg
#. DisplayChdir .message

# Limit WRITE everywhere in the anonymous chroot
#.
#. DenyAll
#.

#.


DefaultRoot ~
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*


# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo ftpdb@localhost proftpd yourpassword


# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftpuser userid passwd uid gid homedir shell

# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftpgroup groupname gid members

# set min UID and GID - otherwise these are 999 each
SQLMinID 500

# create a user's home directory on demand if it doesn't exist
#error 2009-11-20
#SQLHomedirOnDemand on

# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser

# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

# User quotas
# ===========
#QuotaEngine on
#QuotaDirectoryTally on
#QuotaDisplayUnits Mb
#QuotaShowQuotas on

#SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail,

bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"

#SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used,

files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

#SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1},

bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4},

files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies

#SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies

#QuotaLimitTable sql:/get-quota-limit
#QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

RootLogin off
RequireValidShell off

## End proftpd.conf ###
***********************************
++++++++++++++++++++++++++++++++++

Chang permission for ftp directory.

$ chown -R ftpuser:ftpgroup /home/testdomain.com

Couse we run proftpd with inetd then will edit /etc/inetd.conf
$vi /etc/inetd.conf

Uncomment the line that include:
ftp stream tcp nowait root /usr/sbin/tcpd proftpd

And now all look like good its the best to restart. Then test ftp tranfer with local linux account and mysql account.
I pray it should work. |o|

11-2009

11 November 2009

Ubuntu 9.10 and Canon PIXMA MP145


I have MP145 connected to Windows now I want to use with Ubuntu 9.10.

First time I can not found match drivers then I try to change driver nearly siries.

I found Canon MP145 can working with Canon PIXMA MP150 - CUPS+Gutenprint v5.2.4 driver that provide by Ubuntu 9.10.

Wow I can print with low cost printer Canon MP145 and it easy to install.

Good luck.

08 November 2009

FPS game on Ubuntu 9.10


System: Ubuntu 9.10

Hardware
CPU: Xeon 2 cpus
RAM: 4 Gb.
Hdd: 40 Gb IDE
VGA: nVidia MX400

Game: Urban Terrer4.1 (Websit: http://www.urbanterror.net/)
The games is FSP (First Person Shooting) playing with multiple online players.
I like to play FSP games on Windows I love Half-life Counter-Strike so much.
When I think to switch-off Windows the switch-on Linux for desktop environment.
I found Ubuntu is fit to me, Ok let go to have fun with games.

Download for free from http://www.urbanterror.net/page.php?6

File: UrbanTerror_41_FULL.zip
-Extract to any location you prefer recommend home directory.
-explore on UrbanTerrer direct you will see ioUrbanTerrer.i386 then set permission to executable.
-Now you should ready to the war.

OK, Sh0ot them up

...

Ubuntu 9.10 use windows fonts

With GNOME on Ubuntu system font pretty no more for other language like Thai. If you want to use truetype fonts like windows.
I had the way for this.

1 logon windows XP then copy windows font locate in c:\windows\fonts (copy "fonts" folder) may be put it your flash drive or other removeable drive.

2 plug-in your flash drive to Ubuntu and copy to some place such home directory and rename to winfont or any you prefer.

3 copy winfont directory to /usr/share/fonts/
$sudo cp -r winfont/ /usr/share/fonts/

4 chang permission of winfont directory to 755
$sudo chmod 755 /usr/share/fonts/winfont

5 it's the best way to restart

6 change GNOME font.
goto System -> Desktop preference -> Apperence
click tab font and set all font to Tahoma or other that you love.

7 reboot again

you system font will not diff from XP. Try....


.

06 November 2009

ubuntu run windows application with wine

I run desktop linux "Ubuntu 9.10" and try replace windows.
But I cannot disconnect from windows, couse my friend and family still jailed with windows.
With ubuntu 9.10 I found pretty way to run windows application with "wine"

you can get more information at www.winehq.org , it look like hard to install wine, but it has the way to easy.
If you running firefox with ubuntu just click link click > click ok > you must connected internet > install will in progress.
Now you ready to install and play with application. some application can't run with wine for more information visit www.winehq.org on AppDB section. Good Luck


03 November 2009

CentOS 5.3 flash 10 plugin install solve

update flash player 10 plugin on firefox 3.0.15

If install not success or malfunction.
remove with :
- Program / Add / Remove Software
- Remove firefox
- Re-install again with flash plugin

may be key to install not success.

Slackware root password reset

I install slackware 12.1 few month and lost root password. and I show you how reset root password.

- boot from Live cd look like new installation.

- mount to root partition "/" if not sure try what device.
#fdisk -l
#mount /dev/sda1 /mnt

- Now edit /etc/shadow it the best way to backup this file first.
#vi /mnt/etc/shadow

root:[set to blank]:14550:0:99999:7:::

and save by :wq

- take off you cd and reboot
- when login prompt type username as root and blank password.
- change root password with
#passwd

I success with slackware 12.1 and I think it will work fine with other linux.