PDA

View Full Version : CD-based Knoppix as webserver?



dave_sussex
01-13-2004, 12:45 PM
I have looked at Knoppix for a while to get the feel of it...Very Good!!
I like the idea of running the OS from CD, but want to use a HDD as host for my web pages. I can do it OK with MSWindows <washes mouth out> and several flavours of linux <redeems reputation>. But I dont see any clear info how to create and save links so that I can hold apache config on either HDD or FD and make it point to my HDD as the root directory of my website.
Has anyone else done this? & if so can you give me any pointers?
I hope this is the right forum; I did look at Networking but it seems to be about setting card & nameserver IP addies etc.
Also - does PHP and MySQL work ok for dynamic pages under Knoppix?
Thanks in advance for any help. It would mean I can set up intranets for voluntary groups.

sn0wflake
01-13-2004, 06:27 PM
I've only run Knoppix for 2-3 months now with various file systems and I've found no way to save on local harddisk when run from CD.
Maybe you could save one a net share or simply install Knoppix.

Stephen
01-13-2004, 06:52 PM
I have looked at Knoppix for a while to get the feel of it...Very Good!!
I like the idea of running the OS from CD, but want to use a HDD as host for my web pages. I can do it OK with MSWindows <washes mouth out> and several flavours of linux <redeems reputation>. But I dont see any clear info how to create and save links so that I can hold apache config on either HDD or FD and make it point to my HDD as the root directory of my website.
Has anyone else done this? & if so can you give me any pointers?
I hope this is the right forum; I did look at Networking but it seems to be about setting card & nameserver IP addies etc.
Also - does PHP and MySQL work ok for dynamic pages under Knoppix?
Thanks in advance for any help. It would mean I can set up intranets for voluntary groups.

You could try Kano's (http://www.kano.mipooh.net/) script to start Apache having changed the DocumentRoot in the /etc/apache/httpd.conf before starting the server, I'm not sure about the php & mysql never used them before.

dave_sussex
01-13-2004, 09:24 PM
Thanks for replies to date. I eventually came across a previous thread that started me on the road.
Progress so far:
a) created a directory on hard disk(/mnt/hda1) called apache and copied config file into it - httpd.conf .
b) created a directory on hard disk - /mnt/hda1/website and put some html files in it
c) modified httpd.conf to use /mnt/hda1/website as root & document root. Also to send logs and other useful files to /mnt/hda1/apache
d) Go to alt+ctrl+F2 and type in
'su' to run as root
then simply
'apache -f/mnt/hda1/apache.httpd.conf' to use the config file
e) alt+ctrl+F5 to return to KDE and fire up browser to look at localhost. WOOHOO!!! it worked.
I am now working on getting php & mysql working. I think php is automatic and mysql needs to be started as 'mysqld'+parameters.

I will keep you all posted on progress

dave_sussex
01-18-2004, 04:32 PM
Latest Progress:-
I cannot create an entry in /etc/hosts to create a location address without remastering. Is there anyway to spoof this? Using the ip address only, eg 10.0.0.99 doesnt work because one of the utilities on my website needs the FDQN of the site. I think the command 'domainname' only sets a local network name; similarly 'hostname', while 'dnsdomainname' can only report the current setting of the FQDN. I need to be able to do this so that my internal network points to the server within itself when I request, eg www.fred.net. DNS automatically picks that up as my external firewall & immediately asks me to supply userid & password so I can be admin for that. As far as I know I can only use hosts to change this. I have not found a cheatcode and Faq Network skips over this.

I have a suspicion that PHP will fall over even if I manage part one, it needs mods to the ini file to allow includes, the knoppix default being turned off.

Rootman
01-18-2004, 08:31 PM
Latest Progress:-
I cannot create an entry in /etc/hosts to create a location address without remastering. Is there anyway to spoof this? .

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've been working on a similar project. I've found that tou can use a script named knoppix.sh to overwrite files and directories on startup. I've created some static files on my HD for this purpose and used the knoppix.sh to copy over the links/actual files. It will not require a remaster but it will require making the knoppix.sh file, making it executable and then put the knoppix.sh in the KNOPPIX directory of the CD ROM - which can be done by mounting the ISO, copying the knoppix.sh file and then rewriting the ISO to a new CD. You could even do it in Windows :-(

Mine is something like this:

#!/bin/bash
# name knoppix.sh
mkdir /mnt/hda1
mount -t ext3 /dev/hda1 /mnt/hda1
cp -f /mnt/hda1/etc2/hosts /etc
Remember the knoppix.sh must go into the KNOPPIX directory to run at boot time. Adjust the spec of the above example to fit your situation.

dave_sussex
01-21-2004, 11:38 AM
I've found that tou can use a script named knoppix.sh to overwrite files and directories on startup. I've created some static files on my HD for this purpose and used the knoppix.sh to copy over the links/actual files. It will not require a remaster but it will require making the knoppix.sh file, making it executable and then put the knoppix.sh in the KNOPPIX directory of the CD ROM - which can be done by mounting the ISO, copying the knoppix.sh file and then rewriting the ISO to a new CD.

Thanks for that feedback - I hadnt realised that using the 'force' parameter allowed pseudocopy of a file. I played around <whoops, i mean researched & trialled :) > and found there is no need to remaster or write to CD...just set up the PC & then use the knoppix utility to save configuation to /ment/hda1 or whatever. On reboot the config comes back with ip address & FQDN... Next stop is to get PHP & MySQL configured & autorunning. I'm really getting orgasmic on this one.
What an excellent product Knoppix is! - I'm more impressed by the minute

A. Jorge Garcia
01-21-2004, 02:07 PM
Why not just install to hdd with knoppix-installer?

Regards,

Rootman
01-21-2004, 02:31 PM
Why not just install to hdd with knoppix-installer?

Regards,

This wasn't addressed to me but since I am going down the same path I thought I'd answer.

I have a small home server that I built years ago. I got fancy and used removable hard drive cages so I could make exact disk duplicates of my HD as a backup and swap them out when needed. I've found over the years that the HD's develope bad sectors and other problems, pretty much making my disk dup efforts for naught. I've also seen bit rot creep into the system (a Mandrake system) and now the RPM database is totally hosed. I also find it difficult to get a small OS system from the major Linux distro's. They are just packed with junk.

I am after a rock solid OS loader that will not change and that is minimal in size. I happen to be trying to remaster Morphix Light to start out with a smallish system. With the OS on CD I can make multiple copies - I even plan on putting the saved configuration (as a template), the basic web data and tools I used to remaster right on the CD so swaping the entire server out or making another remaster would be a snap.

I guess the short answer is; portability, unchangability, small size and possibly that ability to run from RAM (toram option) to allow the HD to spin down once in a while. Plus I just want to do it :wink:

dave_sussex
01-21-2004, 08:43 PM
Why not just install to hdd with knoppix-installer?

Regards,

I want to be able to set up old pcs as servers for organisations for intranets. I want to be able to create a uniform operating system that I can hand to them, but at the same time I want to make it so that they can over-ride some of my controls, eg put the website files on a second HDD, or even be able to swop boxes quickly if they get a hardware failure. And think of all those 400Mb disks that can have an extended life while using the best modern operating system.
It would mean I could email them a small batch of configuration files & just send the latest OS on CD without them having the hassle of installing it - so far knoppix has worked from the cd on all the boxes I've tried. And there is no backward migration needed if they dont like the new version or it doesnt work on their configurations.
Developing countries as well?
Plus, of course, its an amusing exercise!

A. Jorge Garcia
01-23-2004, 12:06 AM
K, points taken!

Regards,
AJG

locutus
01-23-2004, 03:58 AM
once you get all you apache configurations set up, build a script to do this at boot-time with knoppix.sh and test it with "knoppix myconfig=scan"

When that works, there are two ways that I know of that can automate this at boot time:
1) Start LTSP with "knoppix-terminalserver start" from a system on the LAN and change the /tmp/tftpboot/pxelinux.cfg/default so that "myconfig=scan" is the default for any LTSP booted computer. Then, network boot your webserver machine and add your knoppix.sh file to it's HDD and reboot. You an create a boot disk for network booting if it's not NIC PXE aware.

2) remaster the Knoppix CD so that "myconfig=scan" is defaulted boot option and put you knoppix.sh file on the HDD of your webserver system. Then reboot.

dave_sussex
02-17-2004, 02:07 PM
Hope the following may be of use to somebody...
Heres where I now am. The webserver runs direct from an original knoppix CD - no remaster needed even though the website and updated files are on hard disk. I have set up a shell file to copy config files as needed so they overwrite the original distro ones. I have a folder called knoppixmods in my hard drive that contains these mods.
You dont need to copy the apache(httpd) config file because you can start it with the -f option to point to the config file. I havent found a way to do similar with mysqld. Has anyone any clues? Also the mysql.host file needs rebuilding every time i reboot so am looking into that.

modified files list:
fstab
hosts
httpd.conf
modules.conf
my.cnf
php.ini
smb.conf

The my.cnf file sets up pointers to the database directories on hard drive plus a few odds & s**s.
httpd.conf sets up pointers to the website directory, its FQ name and a few other bits & bobs.
Both config files redirect logs to the hard drive so they can be analysed if the system falls over.

The code is as follows - including red herrings I followed. I found I didint need to chmod all originals, in fact if you make /etc 777 you cant do a sudo to get the system working. I've no doubt 'overkilled' the apache and mysql modules, but it seems to work.
Samba doesnt work properly this way, but doing it from the knoppix menu does. I'm looking into that


cd /
sudo chmod -R 777 /var
# sudo chmod -R 0440 /etc
sudo ln -s /home/knoppix/b4g
sudo cp -fs /home/knoppix/knoppixmods/hosts /etc
# sudo cp -fs /home/knoppix/knoppixmods/httpd.conf /etc/apache
sudo cp -fs /home/knoppix/knoppixmods/my.cnf /etc/mysql
sudo cp -fs /home/knoppix/knoppixmods/smb.conf /etc/samba
chmod 555 /etc/mysql/my.cnf
sudo killall apache
mysqladmin shutdown -u root -pkingkong
sudo killall mysqld
# sudo mysqladmin shutdown
# sudo chmod -R 777 /var
sudo apache restart -f /home/knoppix/knoppixmods/httpd.conf
# sudo /etc/init.d/apache start
/etc/init.d/mysql restart
# mysqld
# sudo chmod -R 777 /var

#mysql -h host -u user -p
# mysql -u root -p
/etc/init.d/samba restart