Space Efficient Mysqldump Backups Using Incremental Patches

Update 2015-08-18: Boy do I feel silly! It turns out there’s a much simpler and much more robust way of doing what I’ve done with the scripts below. It turns out that, using any revision control system (eg. cvs, git, svn) that stores revisions as deltas (and most if not all do), all you need to do is copy anything into a revision control repository and commit it. Tada! The rcs takes care of the incremental part for you by its use of revision deltas (ie. patches). As a big fan of git I was hoping there was a way for it to fill this role. I had mistakenly thought that git stores whole files without diffs/deltas for every revision. This is true until git garbage collects as I found out with my Stack Overflow question: Can git use patch/diff based storage? There’s some great reading there, check it out. Simply garbage collect after adding and committing in git and you automatically get space efficient incremental backups with the bonus of the robustness and reliability of git (or whatever rcs you choose). Bonus: You can delta anything you can store in an rcs repository meaning files, binary or text, archives, images, etc. You still get the space savings! So, quite literally, my database backup is now something like this: (1) mysql dump, (2) git add dump, (3) git commit dump, (4) git gc. Simple, powerful, elegant, beautiful. As it should be!

Space Efficient Mysqldump Backups Using Incremental Patches

I’m now using Duplicity for super convenient one-liner style incremental backup commands in a simple shell script (seriously, it’s like three commands long) but what I’m missing is incremental space-savings on my database dump. Right now my mysqldump produces about a 40MB file, about 10MB compressed. It’s irked me for some time that there’s no simple way to do intra-file incremental backups. I’ve also wanted to do intra-day, not just daily, backups. Duplicity’s incremental backups allow for that but full database backups add up quickly. Well, I finally went ahead and wrote a shell script to do it and a recover script that can recover to any date in the series of backups – just like duplicity. The key was interdiff for incremental patches. Here’s how I did it…

Continue reading “Space Efficient Mysqldump Backups Using Incremental Patches”

How to Install MS TrueType Fonts on CentOS 5

I found the original post on how to do this over here at MS TrueType Fonts on CentOS 5 but just in case you’re intimidated by the rpm building commands I’ve decided to post the final RPM which is an easy install on CentOS 5 and you’re ready to go. Here’s the original excerpt from that post:

Microsoft TrueType fonts are used by most websites so it’s often useful to install them under Linux. No doubt due to licensing restrictions, there is no RPM to install them directly under CentOS, but it’s not that complicated [following] these instructions…

Instead of manually building an RPM, however, I’ve provided the RPM for download here.

  1. Download msttcorefonts-2.0-1.noarch.rpm
  2. Install RPM: rpm -ivh msttcorefonts-2.0-1.noarch.rpm
  3. Link up TrueType fonts for some apps: ln -s /usr/share/fonts/msttcorefonts/ /usr/share/fonts/default/TrueType

Done! Now, close and reopen any applications you may have open. If they can use the new font, like Firefox, and they’re not hard-wiring any specific fonts yet then they should start using the new fonts. For example, lots of websites using MS core fonts and Firefox will start using them if they’re available. There are so many graphics glitches than come down to pixel-width issues of the other fonts because you’re not using the MS core fonts.

Good luck and enjoy!

How to Install mod_pagespeed on CentOS

I was introduced to Google’s mod_pagespeed at my current place of employment. I dismissed it at first until I was tasked with adding it to one of our existing web apps that didn’t have it yet. Wow. KeepAlive + mod_pagespeed is fantastic. I know KeepAlive is old but it’s still off by default in Apache’s HTTPd config and, all by itself, it gives you a 3x savings in some cases I’ve tried. That, and mod_pagespeed brings you stuff like auto-bundling certain css and javascript into a single request, minifying javascript files and inline javascript, compressing images, generating optimized/rescaled images based on IMG tag width/height, etc. and it goes on. It’s a brilliant “best of breed” (forgive me for saying that!) compilation of all the best web performance techniques. Here’s how to install it…

Continue reading “How to Install mod_pagespeed on CentOS”

How to Install NVIDIA Drivers on CentOS 5 64bit

Okay, this is going to be really easy once you have the Elrepo repository. See my other post about installing third party repositories. Go ahead and get that setup then come back here for this:

yum install kmod-nvidia-304xx.x86_64 nvidia-x11-drv-304xx.x86_64 –enablerepo=elrepo

Hopefully it’ll modify your /etc/X11/xorg.conf file properly and then you can run nvidia-settings which should pop open a GUI for you that will help you setup even more.

It’s been a while since I set this up so let me know if I missed anything!

How to Install Third Party Repositories on CentOS

You’ll have almost every CentOS package you could ever need with a few additional community run package repositories. Here’s instructions for installing three of the more popular ones: RPMForge, EPEL, and Elrepo.

Continue reading “How to Install Third Party Repositories on CentOS”

htpasswd limits passwords to 8 characters (or: read the manual dummy)

Turns out htpasswd limits passwords to 8 characters in length by default prior to Apache HTTPd v2.2.18. I run CentOS 5 with HTTPd v2.2.3. I don’t rely on .htaccess password access for anything serious but I do use it as an https ‘front door’ for one of my addresses which does have its own properly secured password access. I’ve been running it like this for years and I was sure something funny was going on entering the username/password combo in there. I swore I was noticing incorrect passwords getting through. Today I decided to test it out thoroughly.

Continue reading “htpasswd limits passwords to 8 characters (or: read the manual dummy)”

How to Install Amarok 1.4 on CentOS 5

Update 2014-11-11: I have fixed the instructions as I discovered the old instructions no longer work smoothly. This worked for me earlier today when I needed a fresh Amarok install.

How to Install Amarok 1.4 on CentOS 5

I love CentOS 5 particularly because of KDE 3.5, which I just can’t seem to get on without, and Amarok which is a great music player. Here’s how to install it with all the bells and whistles, including mp3 support..

  1. yum install gstreamer-plugins-bad gstreamer-plugins-ugly –enablerepo=rpmforge
  2. yum install xine xine-lib –enablerepo=rpmforge
  3. yum install amarok.x86_64 –enablerepo=epel

As you can see, you’ll need the EPEL and RPMForge repositories for CentoS 5.

These simple steps worked for me out of the box on a CentOS 5.10 x86_64 KDE Desktop OS install.

Note I personally disable all third party repos by default to avoid conflicts with CentOS packages hence the ‘enablerepo’ arguments. No ‘yum priorities’ were used on the repos.

Note also on an x86_64 install you might start getting i386 package dependencies installed which are not really needed hence I installed with a ‘.x86_64’ suffix where needed in the commands above.

How to fix CentOS 4 Yum Breakage after End-of-Life

If you still need CentOS 4 and your yum is currently broken due to end-of-life, here’s the fix: Edit /etc/yum.repos.d/CentOS-Base.repo, comment out the mirrorlist parameters and add a baseurl=http://vault.centos.org/4.9/os/$basearch parameter for each enabled section. Here’s the official instructions: Using Vault Repositories

If you still need CentOS 4 and your yum is currently broken due to end-of-life, here’s the fix: Edit /etc/yum.repos.d/CentOS-Base.repo, comment out the mirrorlist parameters and add a baseurl=http://vault.centos.org/4.9/os/$basearch parameter for each enabled section. Here’s the official instructions: Using Vault Repositories

CentOS 5 soft-raid1 mbr got wiped? You’re in luck!

I don’t know what happened but my CentOS 5 machine wouldn’t boot off the drive when I started it up today. I booted into the install CD’s rescue mode and followed these instructions. Remember to do it for both physical drives making up your raid1. That’s what made the fix work for me.

CentOS 5 + KDE 3.5 = A nice, productive desktop

In my travails to find a nice KDE 3.5 (as opposed to KDE 4) desktop, I’ve finally landed on CentOS 5 and, with a little tweaking, I think I can finally live with this distribution.

In my travails to find a nice KDE 3.5 (as opposed to KDE 4) desktop, I’ve finally landed on CentOS 5 and, with a little tweaking, I think I can finally live with this distribution.

I can’t deal with KDE 4. Not yet. I just hope KDE brings it up to the standards of KDE 3.5 and I hope the distros polish it quite a bit more.  Unfortunately, it has some regressions in the key areas that really affect me (konsole, kedit/kwrite/kate), etc.

One little nitpick against CentOS’s KDE which I never experienced in Gentoo’s KDE: Window focus issues. These issues come up seemingly randomly when switching between konsoles. Try quickly ALT-TAB’ing between konsoles. Quite quickly it gets “stuck”. This cascades into a mouse cursor and keyboard input problem. Clicking around the desktop or taskbar eventually gets you back but it happens frequently enough to be annoying.

But, I found an alleviation to this problem that fixes most of the issues: KDE’s Desktop Settings Wizard. Just run it and it will reset all your desktop settings (you’ve been warned). Select KDE behaviour when it asks. It does seem to have fixed window focus issues. At least they don’t happen as often as they used to.

So, if you’re a KDE 4 refugee looking for a KDE 3.5 desktop like I was, try CentOS 5. It’s probably the last long-term support distro to ship with KDE 3.5. Get it while you can!