Remember Remember

martes, 2 de junio de 2009

Home server

So I got bored of thinking on serving from my home laptop. Let's do it:

I don't want to think too much, so I am gonna install the webserver in a chrooted slack

lvcreate VolumeGroup -L 1G -n JailRoot

From a previous post, I know that a good base for a chrooted Slack are the following packages
attr
coreutils
grep
pkgtools
aaa_base
bash
etc
gzip
tar
acl
bin
glibc
libtermcap

then



a="attr
coreutils
grep
pkgtools
aaa_base
bash
etc
gzip
tar
acl
bin
glibc
libtermcap"

wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.2/FILELIST.TXT

for j in $(for i in $a; do grep "/$i-" FILELIST.TXT ; done | gawk -F ' [.]/' '/tgz$/{print $2}'); do wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.2/$j; done


Now we can go and check slashdot for a while :.

Yes, there are some spurious packages, with a quick glance, we can do
rm bash-completion-20060301-noarch-1.tgz


As we are not necessarily inside a Slack to begin with, we will have to install the packages the good-ol' way:

mkreiserfs /dev/VolumeGroup/JailRoot
mount /dev/VolumeGroup/JailRoot /mnt/
mv *tgz /mnt
cd /mnt


NOTE, from now use a non super user account (I used root and almost crashed my system :) rm -Rf anyone?)

tar xf pkgtools-12.1.0-noarch-7.tgz
sbin/installpkg -root /mnt *tgz



now, back in business with root
chroot /mnt/

and we are in!

By now we have a ~250Mb bareboned installation of slack (I know, it can be done better, but this times disk space is not a big deal), now we can install the moin wiki:
wget http://slackware.mirrors.tds.net/pub/slackware/slackware-12.2/slackware/d/python-2.5.2-i486-4.tgz
cd opt
wget http://static.moinmo.in/files/moin-1.8.3.tar.gz
tar xf moin-1.8.3.tar.gz


try to run, and...

Traceback (most recent call last):
File "wikiserver.py", line 38, in
MoinScript().run()
File "/opt/moin-1.8.3/MoinMoin/script/__init__.py", line 138, in run
self.mainloop()
File "/opt/moin-1.8.3/MoinMoin/script/__init__.py", line 240, in mainloop
from MoinMoin import wikiutil
File "/opt/moin-1.8.3/MoinMoin/wikiutil.py", line 25, in
from MoinMoin.support.python_compatibility import rsplit
File "/opt/moin-1.8.3/MoinMoin/support/python_compatibility.py", line 90, in
import sha
File "/usr/lib/python2.5/sha.py", line 6, in
from hashlib import sha1 as sha
File "/usr/lib/python2.5/hashlib.py", line 133, in
md5 = __get_builtin_constructor('md5')
File "/usr/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5


a quick google points to openssl, then
wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.2/slackware/a/openssl-solibs-0.9.8i-i486-1.tgz
installpkg openssl-solibs-0.9.8i-i486-1.tgz


now another try and

2009-06-02 20:08:02,283 INFO MoinMoin.log:126 using logging configuration read from "/opt/moin-1.8.3/wikiserverlogging.conf"
2009-06-02 20:08:02,530 INFO MoinMoin.server.server_standalone:72 ThreadPoolServer serving on 127.0.0.1:8080
Traceback (most recent call last):
File "wikiserver.py", line 38, in
MoinScript().run()
File "/opt/moin-1.8.3/MoinMoin/script/__init__.py", line 138, in run
self.mainloop()
File "/opt/moin-1.8.3/MoinMoin/script/__init__.py", line 255, in mainloop
plugin_class(args[2:], self.options).run() # all starts again there
File "/opt/moin-1.8.3/MoinMoin/script/__init__.py", line 138, in run
self.mainloop()
File "/opt/moin-1.8.3/MoinMoin/script/server/standalone.py", line 131, in mainloop
run(Config)
File "/opt/moin-1.8.3/MoinMoin/server/server_standalone.py", line 636, in run
switchUID(config.uid, config.gid)
File "/opt/moin-1.8.3/MoinMoin/server/__init__.py", line 31, in switchUID
raise RuntimeError('will not run as root!')
RuntimeError: will not run as root!


Ok, this looks easier to fix.
Two options here: create users in the jail or use users from the machine. I am lazy (and I think it can be safer [citation needed :P], lets face it, I am lazy), therefore I am gonna create users inside:

wget http://slackware.cs.utah.edu/pub/slackware/slackware-12.2/slackware/a/shadow-4.0.3-i486-15.tgz
adduser user
su - user
python wikiserver.py


And PRESTO!, it is working now.

0 comentarios:

Publicar un comentario

Suscribirse a Enviar comentarios [Atom]



<< Inicio