Sunday, March 30, 2008

not start x server

/etc/inittab :

id:3:initdefault:

ref: DIYism

The smallest web server (lamp) in the world: damn small linux (DSL or DamnSmall), dsl-3.3.iso is only 50M.
While,it is also the smallest desktop linux.
============Installing to the Hard Disk==================
1)Boot up the DSL livecd.
2)Open up an xterminal window (click on the A:Terminal icon
or right-click on the desktop and choose a terminal) and type:
sudo -s
cfdisk /dev/sda #or cfdisk /dev/hda(in VMWare, to use IDE, not recommended SCSI)
create 2 new partitions:
hda1 Linux Swap Type 82, Size:at least 128mb
hda2 Linux Type 83, Size:the rest of the disk space, Flag this partition as bootable
In xterminal window, type:
sudo -s
mkswap /dev/sda1 #or mkswap /dev/hda1
swapon /dev/sda1 #or swapon /dev/hda1
3)In xterminal window, type:
dsl-hdinstall #in VMWare, to select grub, not lilo
4)Eject the livecd, reboot without livecd(bios setup)
===================Setup DamnSmall==================
5)Logon with user DSL
6)In xterminal window:
vi /etc/network/interfaces
add:
auto eth0
iface eth0 inet static
address 192.168.100.218
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
gateway 192.168.100.100
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.96.209.5
then:
/etc/init.d/networking start #add it into "/opt/bootlocal.sh" to start it while boot
7)StartMenu/System/Control Panel/Select Mirror/Select
or Start Menu/Apps/Tools/Mirror Selector,
choose an available address
8)Start ssh in xterminal window:
sudo /etc/init.d/ssh start #add it into "/opt/bootlocal.sh"
===================Installing myDSL Softwares==================
9)Install mydsl apache(include php4.4):
StartMenu/Apps/Tools/myDSL Extension Browser/Net/apache-2.0.54/download
start apache:
StartMenu/MyDSL/Apache-2.0.54/start
or in xterminal window:
/opt/wwwroot/bin/apachectl -k start #add it into "/opt/bootlocal.sh"
10)Uninstall mydsl apache:
rm -R /opt/wwwroot
rm /home/dsl/.fluxbox/mydsl.menu
vi /home/dsl/.fluxbox/menu
to delete "[include](.fluxbox/mydsl.menu)"
11)Install mydsl gcc:
StartMenu/Apps/Tools/myDSL Extension Browser/System/gcc1.dsl/download
StartMenu/Apps/Tools/myDSL Extension Browser/System/libc6-dev.dsl/download
===================Installing Source Softwares==================
12)Enable apt-get to install deb packages(some may break, for instance, the X servers):
In xterminal window:
sudo dpkg-restore
or StartMenu/Apps/Tools/Enable Apt
13)Install gcc(prepare for install source software):
StartMenu/Apps/Tools/myDSL Extension Browser/System/synaptic.dsl/download
#maybe need use mydsl-load and delete /tmp/noload
In xterminal window:
synatpic
In Synatpic:
install gcc
14)Install apache:
cd /usr/local/apache
wget http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz #don't use httpd-2.0, will fail
tar zxvf httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure --prefix=/usr/local/apache
make
make install
cd ..
rm httpd-2.2.4.tar.gz
cp bin/httpd /etc/init.d/httpd
/etc/init.d/httpd -k start #add it into "/opt/bootlocal.sh"
15)Setup apache:
vi /usr/local/apache/conf/httpd.conf
Modify:
DirectoryIndex index.php index.htm
DocumentRoot "/var/www"
#from
Options -Indexes
ServerLimit 1500 #from MaxClients 150
Add:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
NameVirtualHost *:80

ServerName labs.liba.com
DocumentRoot /var/www/labs
Alias /search /var/www/search/
#Sometimes you need "path alias"(similar to "virtual directory" in IIS), notice:alias without end "/" but realname with end "/", thus to make both "file alias" and "path alias" pointed to "path realname"
php_admin_value open_basedir /var/www/labs:/tmp


ServerName myliba.liba.com
DocumentRoot /var/www/myliba
php_admin_value open_basedir /var/www/myliba:/tmp

16)Install mydsl gnu-utils(prepare for mysql, need ps command):
StartMenu/Apps/Tools/myDSL Extension Browser/System/gnu-utils.dsl/download
In xterminal window(prepare for mysql):
apt-get install libz-dev
apt-get install libxml2-dev
17)Install mysql:
cd /usr/local/mysql
wget http://download.freelamp.com/LAMP/mysql-5.0.27.tar.gz #not use official, because of unstable version
tar zxvf mysql-5.0.27.tar.gz
cd mysql-5.0.27
./configure -prefix=/usr/local/mysql -with-charset=utf8 -with-extra-charsets=all #make character_set_database as utf8
make #wait for long time
make install
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql.server
cd ..
rm mysql-5.0.27.tar.gz
groupadd mysql
useradd -g mysql mysql
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --user=mysql &
/usr/local/mysql/bin/mysqld_safe --user=mysql #start mysql
/usr/local/mysql/bin/mysqladmin -uroot password xxxxx //set root password
vi /opt/bootlocal.sh
add: /usr/local/mysql/bin/safe_mysqld --user=mysql & #let mysql start with os
/usr/local/mysql/bin/mysql -u root -pxxxxx
create database db_app; #not lost ";"
grant all on db_app1.*,db_app2.* to db_user@localhost identified by 'xxxxx'; #to create or modify one user
18)Install flex and bison(prepare for php):
StartMenu/Apps/Tools/myDSL Extension Browser/System/flex-bison-libtool.dsl/download
In xterminal window:
apt-get install zlib1g
19)Install libxml2-(>=2.6.11):
cd /usr/local/libxml2
wget ftp://xmlsoft.org/libxml2/libxml2-2.6.27.tar.gz
tar zxvf libxml2-2.6.27.tar.gz
cd libxml2-2.6.27
./configure --prefix=/usr/local/libxml2
make
make install
cd ..
rm libxml2-2.6.27.tar.gz
20)Install php:
cd /usr/local/php
wget http://cn.php.net/distributions/php-5.1.6.tar.gz
tar zxvf php-5.1.6.tar.gz
cd php-5.1.6
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \ #create /usr/local/apache/modules/libphp5.so
--enable-sockets \
--with-config-file-path=/usr/local/php \ #set path to find php.ini
--with-mysql=/usr/local/mysql \ #add mysql client extension
--enable-so #must exist, else apache will report undefined symbol: php_escape_html_entities
--with-libxml-dir=/usr/local/libxml2
make #wait for while
make install
cp php.ini-dist /usr/local/php/php.ini
cd ..
rm php-5.1.6.tar.gz
21)Setup php:
vi /usr/local/php/php.ini
open_basedir = /var/www/html #restrict php activity area
error_reporting = 0 #avoid expose php code while errors
register_globals = Off #avoid post/get/cookie global variabal covering

Setup SSH

sudo /etc/init.d/ssh start #add it into "/opt/bootlocal.sh"

Thursday, January 3, 2008

decrease grub wait time

edit /boot/grub/menu.lst, modify
timeout 15 --> timeout 1

Install Level-One WNC-0301USB into DSL linux by ndiswrapper, iwconfig

All done with root privilage:
sudo -s

Download Driver from web with zd1211u.inf

Install Driver
ndiswrapper -i zd1211u.inf

Check Installation with
ndiswrapper -l

It will show installed drivers:
zd1211u driver installed, hardware present

Load Module into Kernel
modprobe ndiswrapper

The usb flash light once.

show the network status with ID wlan0
iwconfig

set wlan options, and bring dhcp up
iwconfig wlan0 key abcdef1234
iwconfig wlan0 key open
iwconfig wlan0 key on
iwconfig essid my_network
ifconfig wlan0 up
pump -i wlan0

check status by
iwconfig
ifconfig
ping www.google.com


To make wireless network auto load everytime dsl start:

Add Line to /etc/modules:
ndiswrapper

Add Line to /opt/bootlocal.sh
iwconfig wlan0 key abcdef1234
iwconfig wlan0 key open
iwconfig wlan0 key on
iwconfig essid my_network
ifconfig wlan0 up
pump -i wlan0





Actually, I perform the same procedual by DSL (Not DSL-N) but ehe keyboard lock-up after bring up network card by ifconfig wlan0 up, it may cause by the 4K stack problem (i don't know how to solve by Damn Small Linux), so I give up trying DSL (Althought I thought it is better) and use DSL-N instead.

Install Firefox into DSL

Because DSL does not load MyDSL extension automatically after reboot.

Download firefox-1.5.0.5.uci by MyDSL into /tmp, and move the file into /usr/local/lib
cp /tmp/firefox-1.5.0.5.uci /usr/local/lib



At the end of /opt/bootlocal.sh, add line to load firefox each time windows start:
mydsl-load /usr/local/lib/firefox-1.5.0.5.uci

To make my DSL-N display chinese (both TC & SC)

Ref: http://blog.extremepattern.com/articles/2006/09/04/modify-dsl-n-1.0RC4
Pre-Installed: firefox-1.5.0.5.uci

Procedure:
sudo -s
wget http://cle.linux.org.tw/fonts/FireFly/fireflysung-1.3.0.tar.gz
cd /home/dsl
mkdir .fonts
cd .fonts
tar -zxvf ~/fireflysung-1.3.0.tar.gz


After successful unpack the fonts, the firefox can display chinese properly, to check the existence of Chinese fonts, type the following command.
fc-listgrep Sung