Calendar

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

Active supporter of WikiPedia
Support Wikipedia

Geocaching

Profile for uwezi

A new server

My old server

Last weekend my personal server at home broke down after more than four years of continuous operation. This server used to occupy the big tower case in which I bought my 386DX-33 in 1992. I still remember when I finally fetched that old computer from Karstadt in Kiel in the trunk of my friend Martin’s car. A week later the graphics card broke down and getting it replaced on warranty was a nightmare…

The case later housed newer computers as well up to my server which I set up around 2004/2005:

processor AMD K6-III/400 MHz
mainboard -to be looked up-
memory 128 MByte + 64 MByte
system hdd IBM Deskstar DTLA-307015
15.3 GByte
S/N YFT0H427
data hdd 3x Maxtor 6L160P0 in RAID5
OS OpenSUSE Linux 10.1

When I set up this server I decided to keep the operating system on a separate harddisk without RAID – partly because of the ease of setup, partly in order to make future transistions simple. And it was this system harddisk which after about five years of continuous operation (24/7) gave up. A couple of weeks ago I noticed some corruption in some system files, but since everything was still running fine, I didn’t bother too much.

Now this weekend, suddenly the Apache webserver was down when I tried to access my database through phpMyAdmin and I recognized that I would probably need to do something. I do not blame IBM as a manufacturer for the failure of the system harddisk: it was manufactured in May 2000 and hence was more than five years old when I installed it in my server. Also it is no server harddisk and hence not designed for 24/7-operation.

My new server

However, I needed to get my server up again! The easy way out for me was to convert another old computer which I didn’t use on a regular basis. I installed the current version of Ubuntu server and now I have the following system:

processor AMD Athlon (Barton) 1.3 GHz(?)
mainboard Zenith …
memory 512 MByte
system hdd SAMSUNG SP0411N
37 GByte
data hdd 3x Maxtor 6L160P0 in RAID5
OS Ubuntu Linux 9.10

Problems

Of course not everything was straight forward. I had expected some problems, but it took me three long evenings to get everything up and running again. I want to put the major obstacles down here in order to help me next time and perhaps even others. I decided not to install the LAMP server pack during the installation of Ubuntu, because I found recently on another server that the components of the LAMP server pack will not be listed in Synaptic for maintenance.

RAID5

I installed the Ubuntu server with my RAID array securely disconnected and stored away. Then I attached the RAID array and hoped that Linux would at least recognize it automatically. Well, not quite…

First I had to install mdadmin and manually start the RAID array. I then added /dev/md0 to /etc/fstab mapping it to /srv.

Webmin

I decided to give webmin a try and installed it according to a good description at http://www.ubuntugeek.com/3171.html.

Using it was quite easy to set up samba – one of the main features of my server where I keep all my digital photos and backups of all my important files. This was easier than I had expected.

MySQL

The next important thing was to install MySQL and phpMyAdmin. By default the data directories in the Ubuntu server are located at /usr/lib/mysql while I needed it to point to a subdirectory on /srv.

Changing the data directory for MySQL is easy and can be done

  • via webmin
  • via changes in /etc/mysqld/my.cnf

but neither way will leed to success in Ubuntu server! This is because Ubuntu server is secured by the – poorly documented – utility apparmor! Additionally to changing the directory in MySQL you also have to tell apparmor that it has to allow MySQL to access these new directories and files. The worst thing here is that the denial by apparmor does appear exactly like misplaced user rights under Linux and it took me quite a while to finally find the culprit and the solution:

sudo joe /etc/apparmor.d/usr.sbin.mysqld

-> look for the two lines:
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,

-> you want to mimick these two lines, so add:
/srv/mysql/ r,
/srv/mysql/** rwk,
/sys/devices/system/cpu/ r,
-> save the modified file

sudo /etc/init.d/apparmor restart

sudo /etc/init.d/mysql restart

I found this hint through Google in another blog: http://brainwreckedtech.wordpress.com.

…but still slow

So this worked fine, but whenever I tried to connect to MySQL from a Windows PC, it was soooo slow!

I mainly use MySQL in conjunction with ThumbsPlus – an image database. While my server was a 400 MHz computer from the late 1990s everything was working nicely and now with a computer with three times more memory and three times faster processor it became unusably slow? Something was weird…

The solution was difficult and I am not quite sure whether the solution I found is the final one. I tried logging all database activity from within MySQL and couldn’t find anything strange – my first suspicion was a corrupted database index or something alike…

Then I found a thread through Google where the reason of a slow access to MySQL through the network was blamed on MySQL performing continuous DNS queries about the connected clients! Especially if IPv6 is enabled on the server but not supported by the local network this would lead to locking conditions until the DNS query would time out. The solution came through Debian/Ubuntu Tips & Tricks. Find your MySQL configuration file (normally /etc/mysql/my.cnf) and add:

[mysqld]
…..
……
skip-name-resolve

And yes: it works and is faster than ever before!

6 comments to A new server

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>