Friday, November 27, 2009

Upgrade Slug

Well it has been some time since I installed my server. By the way it still goes as it should, no problem so for. Today, i needed to upgrade the packages on the slug, so I decided to write it in here too.

As it noted

apt-get -u upgrade


It's useful to run this command with the -u option. This option causes APT to show the complete list of packages which will be upgraded. Without it, you'll be upgrading blindly

After upgrading the packages on the system we may also need to check if there is a new debian version. Type:

apt-get -u dist-upgrade


Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-image-2.6.26-2-ixp4xx
The following packages will be upgraded:
apache2-mpm-prefork apache2-utils apache2.2-common apt apt-utils base-files bind9-host dbus dbus-x11 dhcp3-client dhcp3-common dnsutils gnupg gpgv
libapache2-mod-php5 libapr1 libaprutil1 libavcodec51 libavformat52 libavutil49 libbind9-40 libcurl3 libdbus-1-3 libdns45 libexpat1 libfreetype6
libgd2-xpm libgnutls26 libisc45 libisccc40 libisccfg40 libkrb53 liblwres40 libmysqlclient15off libnewt0.52 libpam-modules libpam-runtime libpam0g
libpng12-0 libpq5 libsasl2-2 libssl-dev libssl0.9.8 libvolume-id0 libvorbis0a libvorbisenc2 libvorbisfile3 libxcb-xlib0 libxcb1 libxml2
linux-image-2.6-ixp4xx linux-image-2.6.26-1-ixp4xx linux-libc-dev mt-daapd mysql-common openssl php5 php5-cgi php5-common php5-dev php5-gd
php5-sqlite screen tzdata udev wget whiptail x11-common
68 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 54.6MB of archives.
After this operation, 33.8MB of additional disk space will be used.
Do you want to continue [Y/n]?


Unfortunately that much of disk space is too much for me now. I only have 1 gb of flash as the main drive so it should wait for now. But you might need to upgrade ...

Happy slugging

Sunday, April 5, 2009

Lighttpd password protected folders

If you have followed these guides you should already have a Lihgttpd webserver with some funky things going on. In some cases you will want to password protect a directory. This is how it is done...

Edit /etc/lighttpd/lighttpd.conf
nano /etc/lighttpd/lighttpd.conf

Add "mod_auth" to server.modules section. It should look like...
server.modules = (
"mod_access",
"mod_fastcgi",
"mod_alias",
"mod_compress",
"mod_auth",


Then to the end of the lighttpd.conf add

$HTTP["url"] =~ "^/DIRECTORY_YOU_WANT_TO_PROTECT/" {
auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/home/PASSWORD_FILE.pass"
auth.require = ( "/DIRECTORY_YOU_WANT_TO_PROTECT/" =>
(
"method" => "basic",
"realm" => "Password protected area",
"require" => "user=aspedisca"
)
)



You should create a password file at the location you entered above. This file should include a line saying.
username:secretepassword

Change acording to your needs.You may add more than one user though. Make sure that the password file can be read by lighttpd.
chown lighttpd:lighttpd /home/PASSWORD_FILE.pass

Also change the part saying "/DIRECTORY_YOU_WANT_TO_PROTECT/". It should be relative to your www directory.
Finally, restart lighttpd server:
/etc/init.d/lighttpd restart


Test to reach your directory by using your beloved web browser and see if it works..

Friday, March 20, 2009

Choose the correct disk to boot...

I was having some troubles while booting the device as I have two more disks attached to the slug other than the booting flash drive. It was basically looking for the wrong drive to boot so it was hanging during the boot. You can actually solve the sittuation by mounting the drives after the boot as I did before but this is a server right :)

To avoid confusion boot without any other disk attached then find out the UUID's of your disk partitions. fdisk -l will help you to see your existing partitions. To find UUID's of your partitions write:
# vol_id /dev/sda1
# vol_id /dev/sda2
# vol_id /dev/sd...


I had a problem with my swap partition. I saw that it had no UUID. If you encounter a situation like this follow :

# swapoff -a
# mkswap /dev/sdXX
replace XX according to your system.I wrote mkswap /dev/sda5 for my system. Then type
# swapon -a
to make te swap partition active again...


Apply the vol_id /dev/sdXX for all your partitions and look for "ID_FS_UUID = ..." . The long alphanumeric string is important for us. After learning the UUID's of all your partitions modify your /etc/fstab as seen on the screenshot.

Almost done. You also have to modify the kernel as it looks for the booting device before fstab. To do this simply write. (backup your existing flash vefore this. Read previous post)
apex-env setenv cmdline 'console=ttyS0,115200 rtc-x1205.probe=0,0x6f noirqdebug root=/dev/disk/by-uuid/XXXXXX'

change the XXXXXX section with the UUID of your root partition. For my case I wrote :
apex-env setenv cmdline 'console=ttyS0,115200 rtc-x1205.probe=0,0x6f noirqdebug root=/dev/disk/by-uuid/e41f5b0d-1b1b-4e84-a2db-a70e2355c8db'


That is all.Plug all your drives and restart to see if it starts without any complain...