Sunday, March 30, 2008

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
auto eth0
iface eth0 inet static
# dns-* options are implemented by the resolvconf package, if installed
/etc/init.d/networking start #add it into "/opt/" 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/"
===================Installing myDSL Softwares==================
9)Install mydsl apache(include php4.4):
StartMenu/Apps/Tools/myDSL Extension Browser/Net/apache-2.0.54/download
start apache:
or in xterminal window:
/opt/wwwroot/bin/apachectl -k start #add it into "/opt/"
10)Uninstall mydsl apache:
rm -R /opt/wwwroot
rm /home/dsl/.fluxbox/
vi /home/dsl/.fluxbox/menu
to delete "[include](.fluxbox/"
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:
In Synatpic:
install gcc
14)Install apache:
cd /usr/local/apache
wget #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 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/"
15)Setup apache:
vi /usr/local/apache/conf/httpd.conf
DirectoryIndex index.php index.htm
DocumentRoot "/var/www"
Options -Indexes
ServerLimit 1500 #from MaxClients 150
LoadModule php5_module modules/
AddType application/x-httpd-php .php
NameVirtualHost *:80

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

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 #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/
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
tar zxvf libxml2-2.6.27.tar.gz
cd libxml2-2.6.27
./configure --prefix=/usr/local/libxml2
make install
cd ..
rm libxml2-2.6.27.tar.gz
20)Install php:
cd /usr/local/php
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/
--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
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

1 comment:

Anonymous said...

Goldmine of information! Thanks!