Varnish cache, munin-node and server-status

varnish-cacheOn my server running Ubuntu 12.04, I have Apache2 listening on port 8008 (20 virtual hosts) and Varnish on port 80. I use munin and monit to keep tabs on the various services running on the machine and they use the mod_status output to keep tabs on Apache2 processes. As mod_status is compiled into Apache2 by default and the module is enabled this means that the detailed information about your secure webserver is exposed for all the world to see. The mod_status configuation file allows you to lock access down to localhost access only which is nice.

munin

However, Varnish connects to the backend Apache2 server as localhost and so exposes the server-status page to the wild wild web. With the Varnish VCL I was using my server-status page was cached for an hour so it was still available but only provided a static status report that changed when the cache refreshed. Implementing a solution from serverfault.com made the live server-status available through Varnish as it passed it to the backend. This did not help. To secure my server-status I had to block access to the server-status URL but still keep it open for munin-node. Continue reading Varnish cache, munin-node and server-status

Replacing a failing HDD in RAID1 in Ubuntu Server

I have a software RAID1 (mirrored) setup with four partitions on two 160GB SATA drives. Munin started emailing me reports that a drive was failing with bad sectors.

This is what I did to get the system up and running again.

From advosys.ca I completed the following steps first in the terminal:

To make Ubuntu Server automatically boot when one drive in a RAID array has failed do the following:

From a running server, do a package update to make sure you have the latest kernel and boot loader

sudo apt-get update && apt-get upgrade

Reboot the server to ensure any new kernel and bootloader packages are in place.
From the command line run

sudo grub-install /dev/md0

to ensure GRUB is installed on all members of the boot RAID device.

When asked “Should mdadm run monthly redundancy checks of the RAID arrays?”, select either Yes or No (read the warning about possible performance impact and decide. “Yes” is the safer choice)

From the command line run

sudo dpkg-reconfigure mdadm

When asked “Do you want to start the md monitoring daemon?” select Yes.

Enter a valid email address to send warning messages to.

When asked “Do you want to boot your system if your RAID becomes degraded?” select Yes. Continue reading Replacing a failing HDD in RAID1 in Ubuntu Server

In My CUPS*

CUPS book
CUPS book

Ubuntu 10.04 server – Fedora 16 desktop – Snow Leopard 10.6.8 macbook – Brother DCP-195C printer scanner

Printer plugged into Server in the loft via USB. Desktop and Server connected by wired ethernet through Netgear router. Macbook connects through wireless.

Server runs CUPS 1.4.3, Macbook runs CUPS 1.4.7 and Desktop has CUPS 1.5.0.

Server is set up to share the Printer over IPP on port 631. Some machines can connect to http://server:631/ (i.e. the remote print server) and print a test page. The Macbook just connects but cannot print. All machines can connect to http://localhost:631/ (i.e. their own CUPS print server) and can see the remote Printer on the Server. Continue reading In My CUPS*

Farewell Kubuntu Mint, Hello Fedora 16

Fedora Logo
Fedora logo

I have been running Linux Mint 10 for ages and have hacked and patched and updated it with various repositories to make sure it was reasonably up-to-date. The application I use most often on the desktop is DigiKam. The development of DigiKam has accelerated recently to the point of a new release almost monthly. The repositories are all trying to play catch-up. Some dedicated individuals are rolling their own .debs/.rpms for different flavours of linux. All you have to do is connect to their repository and install. But it is never that simple as the newer versions of DigiKam required newer versions of all the dependencies and a simple install ends up pulling in loads of different packages. In the end I gave up and stuck with version 1.9 as newer versions required an updated version of KDE and it was getting to be a hassle patching everything together. Continue reading Farewell Kubuntu Mint, Hello Fedora 16

Upgrading Ubuntu Server 8.04 LTS to 10.04 LTS (Part II)

Upgrading over SSH by doing:

do-release-upgrade

issued a warning about doing it over SSH.

So I did it through Webmin and the Command Shell:

do-release-upgrade

This wrote a bunch of stuff to /var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log and then stopped when it appeared to run out of disk space.  Which is odd as I have more than 80GB free on the machine. Continue reading Upgrading Ubuntu Server 8.04 LTS to 10.04 LTS (Part II)

Upgrading 8.04 LTS to 10.04 LTS

The Ubuntu Community Documentation recommends the following steps when upgrading the Long Term Support (LTS) version of its server operating system.  My server has been running 8.04 since April 2008 and has been a good and faithful server.  However, the time has come to upgrade it to new versions of the server software.  It is also an opportunity to completely clean out the accumulated cruft that happens when your development, test and live servers are one and the same.

Network Upgrade for Ubuntu Servers (Recommended) Continue reading Upgrading 8.04 LTS to 10.04 LTS

Handy things to know

I have just upgraded to 8.04.3 – the third upgrade to the LTS release of Ubuntu.  What linux kernel version am I running the server on?

uname -r

What version of Ubuntu Linux am I running?

lsb-release -a

or

cat /etc/lsb-release

Improving the speed at which my websites load

I host a number of sites on my server that have anything from 10 to 1000 requests a day. some sites are image heavy – galleries – and others have a load of javascript plug-ins to make them look nice and do cool things. I have been trying to find different ways of improving the speed of the site as a number of users had complained about the glacial slowness of some of the components.

So, what did I do?

  • upped the installed memory from 512MB 533MHz to 2048 667Mhz – single biggest improvement!
  • repaired and optimised all MySQL database tables for each site
  • disabled all unnecessary wordpress plugins
  • enabled WP-Super-Cache, a cacheing plugin to improve performance of popular pages, on all WordPress sites.
  • resized and optimised for web all photos in the photo galleries
  • installed the firefox add-on, YSlow, to my browser and used that to identify slow parts of the site.
  • enabled the Apache2 module, mod_deflate, to compress elements of the page before serving them.
  • tweaked mod_deflate like this:

From this:

<ifmodule mod_deflate.c>
    # compress content with type html, text, and xml
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
</ifmodule>

to this:

<ifmodule mod_deflate.c>
    # compress content with type html, text, xml, css, and javascript
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
</ifmodule>

Installing PHPSysInfo 3.0 RC8 on Ubuntu 8.04

I installed this the other day after running RC6 for a while and I wanted to see what improvements had been made. I used to run Nagios, Munin, Monit and AWstats on the server and they ground the machine to a halt.

  • rc6 picks up the server name and the internal IP address
  • rc8 picks up the apache virtual server name and the external IP address – changed with this line
    • define('PSI_USE_VHOST', true);
  • rc8 has an additional theme – cream – although I still prefer the
  • rc8 has memory usage section expanded by default
  • rc8 flickers when expanding the PCI Devices list. rc6 is smooth.

phpsysinfo 3.0 rc8The dynamic updating in rc8 seems to be faster / actually working. There also appears to be a lag in system uptime. The webmin front page and rc8 both match but rc6 is about 20 minutes behind.  I had to do a lot more tweaking of the config file in rc8 to get it to work than in rc6. As far as I can remember I just unpacked rc6 and pointed the browser at the appropriate URL.

These are the settings that I had to change in config.php rc8 as I kept getting XML errors about the PSI plugins and UPS settings:

define('PSI_PLUGINS', 'mdstatus,ps,psstatus,smart,quotas');
define('PSI_SENSOR_PROGRAM', 'LMSensors');
define('PSI_SENSOR_ACCESS', 'command');

If you want to download phpsysinfo 3.0 rc6 you can grab them here (rc6) phpSysInfo-3.0-RC6.tar and here (rc8) phpSysInfo-3.0-RC8.tar

Dell SK-8135 Multimedia Keyboard

Dell SK-8135I have a Dell SK-8135 multimedia keyboard plugged into my Ubuntu Jaunty desktop.  It’s the keyboard with a string of shortcut keys across the top and a large silver volume control knob.  I have spent countless hours trying to get it to work over the last 4 years and just tonight did I think to twiddle it when Banshee delivered up a song that was too loud.  Lo and behold!  It actually works.  And there is a volume notification in the top right of the screen to show me what’s happening.  That’s what I like – something just working out the box like it should.