the itjerk

my adventures with technology

Monthly Archives: May 2014

linux box, clean install

Hardware all happy, it’s time to do a clean install of Ubuntu 14.04 LTS. The most important step before installing is to get a complete backup and a list of applications/settings etc. before tearing down the old computer! It’s also a good time to think about your new system, so consider what needs to be installed, and what needs to stay backed up, and what needs to be forgotten.

After installing from disk and running apt-get update/upgrade, there are a few usability tweaks I want to do right away:
1. Add packages nautilus-terminal, openssh-server, numlockx, update-motd, weather-util, landscape-common.
2. Setup ssh keys for my hosted server, and secure sshd!
3. Disable guest login in lightDM.
4. Import bookmarks and set panel applets (this could be a lot easier Canonical).
5. Fix writing to USB drives, then flash motherboard bios (F9 to F12)
sudo hdparm -r0 /dev/sdg

1. Configure router DHCP to give computer a fixed IP via MAC address.
2. Set privacy options in Unity. Include Imageviewer and Movie ;).
3. Install firewall (using gufw).
4. The fstab entries: Mount my new media hard drive. Side note here, always, always mount these things to /mnt/. The /media/ directory is not for anything in /etc/fstab. My backup directory (which is on a NAS drive), I have to enable cifs-utils, and set the cifs password.
5. Restore data from backup, sparingly.
6. Install applications, ditto.

Music stuff:
1. sudo apt-get install eyed facc lame flac vorbis-tools moc sox
2. I also installed Audex, Banshee, EasyTag, DeVeDe, Asunder, VLC, Audacious and Audacity.
3. Reinstall Logitech Media Server, located here.

1. Reinstall LAMP. You’ll be prompted to set MYSQL password, so be prepared with the one for your old databases!
sudo apt-get update.
sudo apt-get install tasksel
sudo tasksel install lamp-server

2. Create empty MYSQL databases, then restore backups. It’s as easy as:
mysql -u root -p
Create database databasename;

mysql -u root -p databasename < path/to/backup.sql
3. Copy website backup to /var/www (or wherever), fix permissions. Then set initial directory in sites-available/default.conf and restart apache2.
4. For Drupal, I need to install php5-gd and add cron.php to crontab. For clean urls, I need to enable mod_rewrite (a2enmod rewrite) and configure .htaccess by adding this to sites-available/default.conf:

<Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

5. Restart apache2.

Because I now have a speedy SSD drive (oh yes, it’s fast!), I read up on potential tweaks to improve performance and life of the drive. With 14.04, the trim command is executed weekly (/etc/cron.weekly/fstrim) by default. This is fine because my box is on 24/7, otherwise it should be moved to rc.local so it executes on boot. If you want to check if trim is enabled, try this script:
sudo hdparm -I /dev/sda | awk '/.*TRIM supported.*/{ if ($1 == "*") print "Yes, TRIM is enabled"; else print "No, TRIM is not enabled.";}'
1. Add noatime parameter to /etc/fstab for / to disable file read stamps.
2. Create a virtual file system with /etc fstab:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0
3. Then, move browser Firefox and Chromium caches to /tmp
4. Change swappiness? Actually I don’t use swap. RAM is cheap and faster!
5. Finally, I debated moving /home off the SSD, but couldn’t discern any benefit: I mean, every $$$ notebook ships with one, right? Easy to get sucked into all the tweaking… So I’ll opt for just paring down what’s in my home folder, and moving music, photos and videos to my /mnt/media drive. Heck I should buy another disk and create a RAID 1 for all that media…

Anyway, that’s got me up and running. Job complete.

byopc 2014

Hard to believe, but it’s been about 5 years since I rebuilt my linux box. With the arrival of 14.04 LTS, I decided it was time. My computer was getting older, but really I had the itch to switch to 64 bit OS, which required a clean install, which made the decision to start anew quite easy…

Here’s my budget box, all purchased at my local Microcenter: Intel Pentium G3240, a low-watt, 2014Q1 processor at $55; Gigabyte B85M-D3H motherboard with Intel Haswell chipset at $80, one (1) Crucial Sport DDR3 8GB at $55, a SanDisk 128GB SSD at $70, and a new 1TB Western Digital Red drive for my media, at $70. Total $330. Rest of the parts were reused, everything installed like a charm, and I got a one-beep post on first boot. The computer is fast, silent, and running a 64 bit OS. Now I’m faced with the daunting task of reinstalling everything from scratch. How liberating!?


Notes: I purchased a bracket for mounting the 2.5″ SSD into a 3.5″ bay, and will be off to get a new case fan because the new mobo needs one with four-pins, the old one has three… weird. Also, I’ll have to come up with a solution for optical spidf, because my old bracket has a three pin connector, while the mobo has a two pin header (the third is +5V to power the light). Of course, I could just get a 75K Coaxial Audio cable, but where’s the fun in that?

UPDATE: Found a pulse width modulation (PWM) case fan at Microcenter, $15. Had to modify my SPIDF optical backet by slicing the red power wire and connecting it to +5v pole on a molex adapter from the power supply. Then I had to install Gnome ALSA mixer in order to get simultaneous output from both my digital and analog outputs (doesn’t survive on reboot however).


FINAL WORD: It’s a great machine, well worth the $350 or so I invested into it. Fast, modern, and sporting a clean install from disk, performance is fantastic. Possible tweaks? 1) Bumping it up to 16GB RAM, and 2) adding a second WD Red disk to RAID1 my media drive.

Ubuntu LTS the only way to go

When I first configured my cloud server, I was under the impression that I would just be trying it out, a test environment. It didn’t occur to me that I’d actually put it in production. Flippantly, I chose 12.10 instead of opting for 12.04 LTS, which is supported through May 2017. Well, 13.04 was already out of service by the time I got my notice that 12.10 was end-of-life, so the upgrade path was 12.10 -> 13.10 -> 14.04 LTS. Good news is that was easy enough to do. Bad news was 13.10 broke Apache’s Auth_MYSQL, which is used with AWSTATS in iRedMail. 

Like a good itjerk, I didn’t panic, went straight from 13.10 to 14.04 LTS, and would worry about the mess from there. Ends up that Auth_MYSQL isn’t supported in Apache 2.4.x, which is what 14.04LTS ships with. So I had to switch to Auth_DBD instead. Zhang at iRedMail was very helpful, and I got everything back up and working. BTW, Denyhosts is no longer supported in 14.04 LTS, that package had to be purged.

Apache2.conf needs this:

DBDriver mysql
DBDParams "host= port=3306 dbname=mail user=mail pass=xxxx

While awstats.conf needs:

AuthType Basic
AuthName "Authentication required"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s"
Require valid-user

Then, do this:
a2enmod auth_dbd
apt-get install libaprutil1-dbd-mysql
service apache restart

Moral of the story: Use LTS. Always. 

iPad2 repair #2

iPad2 repair #2

Second time I’ve had to replace the digitizer. Didn’t bother replacing the plastic mid-frame bezel, so not worth the effort. And this time rubber bumper is being ordered before the kids get it back