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"