A fusion of technology, music, and geekyness.
Currently Browsing: SysAdmin

Server Update: Migration to Debian, Polyglot Projects, and More!

I am proud to announce that TechnoGeeks now has it’s own server in Atlanta, GA! I have officially migrated from Ubuntu to Debian in the process. I have finally scrubbed Ubuntu from my life for good!

Operating Systems of Choice
Server: Debian Squeeze
Desktop: Arch Linux
Phone: Android

I am starting to nerd out a lot more lately and will expand TechnoGeeks to be able to magically host several projects of mine. This includes web applications written in PHP, Ruby, and Lua! I started playing around with some of the Kepler Project frameworks (WSAPI, Xavante, and Orbit) and have a fully functioning Code Snippet library called Snippy. Orbit is ULTRA FAST but the documentation and code maintenance is VERY POOR. I really hope these guys clean things up as they have something really nice going here. More updates soon!

Update 12/5/2011:
I have several new projects and services that are now up!


Linux Distribution Roundup

Finding the Right One
Over the past year I have really got around when it comes to Linux distributions and even FreeBSD. This post is going to be a quick run down of my experiences with each and a reflection on my feelings about them. Please keep in mind that I have not touched Red Hat based distros since college so this post may seem quite biased. For this, I apologize in advance. I have not had the desire or need to try them and still had quite a ride without them as well. Please read on and I am sure you will agree.

Also, please keep in mind that these are solely the views of me and me alone. You may or may not agree with me and that is fine. I am simply giving you my opinions and feelings that I have after undertaking this epic journey.

February 2010 – Ubuntu
Ubuntu
At this point I just got a new job and my main desktop and server experience was with Ubuntu. The shop mainly uses Ubuntu for their work machines so it was the obvious choice. It was a typical Ubuntu install with the Gnome window manager.

Pros:

  • Things just work!
  • Company Supported
  • Comfortable Waters

Cons:

  • Bloated and Slow
  • Pulseaudio HATE!

April 2010 – Arch Linux
arch-linux-logo
A buddy of mine at work was highly influential, and still is. He was constantly raving about Arch Linux and eventually got me overly curious. He helped me struggle through the installation and I read through their absolutely amazing wiki docs and picked everything up quick. It is quite impressive. He also convinced me to try awesome window manager which is amazing once you get the key bindings down. However, I originally got fed up with Arch because it was so different and jumped ship.

Pros:

  • Minimalistic
  • Rolling release system
  • Choice of source (ABS) or binaries (Pacman)
  • Active and passionate community
  • Ability to easily recompile kernels

Cons:

  • Very different than the norm
  • Demanding initial installation
  • Prone to random breakage

June 2010 – Xubuntu / Lubuntu
xfce_logo
After using awesome with Arch I wanted to try something more lightweight than gnome so I went for Xubuntu. XFCE and LXDE basically provide most of the functionality of Gnome without the bloat. After a while I missed awesome and installed it and switched back to it but still was using apt packages. I coasted with the Xubuntu + awesome install for a long time as I had no real urge to switch until I started having the random urges to play with source code again.

Pros:

  • Lightweight
  • Ubuntu core with apt packages

Cons:

  • Missing ability to compile stuff from source easily

January 2011 – Gentoo
gentoo
I have had some bad experiences with Gentoo in the past due to lack of understand but I wanted to try a source based distro again. I finally got a sound understand of proper configurations and how to effectively use portage this time, but a little late. I was absolutely terrified to upgrade packages because I originally accepted ~amd64 for the first half of use and was scared what would happen after I started white listing on a package basis. I originally could not get some core needs to work, such as PPP with my USB EVDO card and the Ruby-GTK bindings with some applications I needed for work.

Pros:

  • Source based
  • Extremely easy to recompile kernel

Cons:

  • Could never get certain needs to function
  • Huge installation time
  • No option for binaries, packages take ages to compile

March 2011 – FreeBSD 8.2
freebsd_300x300
A buddy at work (yes, the same one) convinced me to try FreeBSD. I had issues with the installer and it took a while to figure out that I needed to load a kernel module so it would recognize my drive labels. After that, the install was a breeze and I really liked everything. The deal breakers this time is lack of compatibility with lots of 64 bit apps (virtualbox being a biggie). I also could not use Chromium, AFS, or my USB EVDO card. It was a fun two weeks though!

Pros:

  • Choice of source (Ports) or binaries (pkg_add)
  • Minimalistic

Cons:

  • Could never get critical needs to function
  • Poor 64 bit support

April 2011 – Ubuntu 10.10
Went back to Ubuntu on a whim. Everything just works even better than I last tried but Gnome is just as bloated as ever. I also saw that btrfs is now native in Ubuntu and gave it a try. I would recommend holding off as I dont think it is quite ready yet. Extracting a tarball pretty much tanked the box and I noticed that btrfs requires about 20-25 processes to always be running for it to function. WTF? I then started playing with source packages. I wrote a script called snag that made the downloading, building, and extracting trivial. This, however, was not enough. I then pondered for a several days on which operating system is closest to my idea of the most ideal. My requirements were simple.

  • Minimal, lacking bloat
  • Capability to easily recompile kernel
  • Choice of binary or source packages
  • All of my core needs for work are possible (AFS, EVDO, virtualbox, wine, etc.)

If you peaked ahead you already know my choice. If you haven’t read ahead, can you guess before moving your eyes below which one I chose?

.
?
.
?
.
?
.
?
.
?
.
?
.
?
.
?
.
?
.

April 2011 to Current – Back to Arch!
You guessed it (I think)! I am heading back to Arch tonight and I can’t wait. It is the only distribution where everything I need has worked in the past. It is also the only one that meets all of the criteria that I have for what I consider an ideal operating system. I hope to make it last. Wish me luck!

arch-linux-logo


Now Learning Lua!

Lua For the Win!
I recently have randomly become quite interested in Lua. The reasoning is due to the fact that I interact with two things on a daily basis that are configured and/or scripted in Lua: World of Warcraft and the Awesome window manager. I have had a blast over the weekend learning the basics of the languages and WoW addons. You can find the entire first edition of a very nice guide to learning Lua on their website. In addition, I found the resources at www.wowprogramming.com to be quite helpful.

Some essentials:

  • WowLua – An addon that allows you to write and run Lua in game.
  • Warcraft Addon Studio – A Visual Studio (VB) like application to let you quickly build frames and export them to XML.

Celistine
The first mod I wrote was called Celistine, and was written to monitor my wife in game :D It allowed her to whisper me for auto-invites to a group, monitors her range and informs me if she is far, and spams her with whispers if my health gets lower than 25%.

celistine

Deeps
After that, I decided to modify an example I found in the book I am reading (World of Warcraft Programming) and create a simple frame that displays DPS and other facts as I am in combat. I decided to call it Deeps :) See below for the screenshots, code, and feel free to try it out yourself.

deeps

deeps2

-- Set up some local variables to track time and damage
local start_time = 0
local end_time = 0
local total_time = 0
local total_damage = 0
local average_dps = 0
local in_combat = false

function CombatTracker_OnLoad(frame)
	frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
	frame:RegisterEvent("PLAYER_REGEN_ENABLED")
	frame:RegisterEvent("PLAYER_REGEN_DISABLED")
	frame:RegisterForClicks("RightButtonUp")
	frame:RegisterForDrag("LeftButton")
end

function CombatTracker_OnEvent(frame, event, ...)

	if event == "PLAYER_REGEN_ENABLED" then
		-- This event is called when the player exits combat
		end_time = GetTime()
		total_time = end_time - start_time
		average_dps = total_damage / total_time
		CombatTracker_UpdateText()
		CombatTracker_ReportDPS()
		in_combat = false
	elseif event == "PLAYER_REGEN_DISABLED" then
		-- This event is called when we enter combat
		-- Reset the damage total and start the timer
		CombatTrackerFrameText:SetText("In Combat!")
		total_damage = 0
		start_time = GetTime()
		in_combat = true
	elseif event == "COMBAT_LOG_EVENT_UNFILTERED" and in_combat then
		local timestamp,log_event,source_guid,source_name,source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name, spell_school, amount = ...

		if string.match(log_event, "_DAMAGE") then
			if source_name == UnitName("player") or source_name == UnitName("pet") then
				--ChatFrame1:AddMessage(source_name .. " is doing teh hurt!")
				if amount ~= nil then
					total_damage = total_damage + amount
					end_time = GetTime()
					total_time = end_time - start_time
					average_dps = total_damage / total_time
					CombatTracker_UpdateText()
				end
			end
		end
	end
end

function CombatTracker_UpdateText()
	local status = string.format("%ds | %d dmg | %.2f dps", total_time, total_damage, average_dps)
	CombatTrackerFrameText:SetText(status)
end

function CombatTracker_ReportDPS()
	local msgformat = "Dished out %d damage in %d seconds (%.2f dps)."
	local msg = string.format(msgformat, total_damage, total_time, average_dps)
	if GetNumPartyMembers() > 0 then
		SendChatMessage(msg, "PARTY")
	else
		ChatFrame1:AddMessage(msg)
	end
end

Forward Network Traffic With Iptables

From time to time I come across something truly amazing that I just must share no matter how tired I am. Even though they are typically very simple it helps me remember in the future and I hope it also helps others out wfhen they have the same problems that I do. I recently migrated a server from Slicehost to Linode and I wanted to find a quick and easy way to forward web traffic on various ports to the new server while DNS caught up. The answer was simple… iptables. I found this in an article here.

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 1.2.3.4:80
iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to-destination 1.2.3.4:3306
iptables -t nat -A POSTROUTING -j MASQUERADE

Linux Disk Imaging with Clonezilla and PXE

Now that I finally have a file server at home I got curious again with disk imaging solutions. After doing some research I found a pretty awesome tool called Clonezilla. After downloading the live CD and playing around for a while the first thing I wanted to do was test it out in a PXE boot fashion. Here was my quick and hackish approach. My test run was on a VirtualBox VM in Xubuntu 10.04 with a bridged adapter.

1. Install TFTP server

sudo apt-get install tftpd-hpa
sudo start tftpd-hpa

Ensure /var/lib/tftpboot exists. If it does not:

mkdir -p /var/lib/tftpboot

Ensure that the values in /etc/defaults/tftpd-hpa match.

2. Install DHCP server

sudo apt-get install dhcp3-server
sudo vim /etc/dhcp3/dhcpd.conf

Add something similar to the following…

default-lease-time 86400;
max-lease-time 604800;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.15;
        filename "pxelinux.0";
        next-server 192.168.1.121;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.1.255;
        option routers 192.168.1.1;
}
sudo service dhcp3-server start

The next-server option needs to be the IP of the TFTP server. Everything else should be self explanatory.

Before proceeding verify both services are listening.

sudo netstat -upan | awk  '{print $6}'
2008/dhcpd3
582/dhclient
3627/in.tftpd

3. Install syslinux if it is not already (it should be). Copy over pxelinux.0 into the appropriate location.

sudo apt-get install syslinux
sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot

4. Download latest clonezilla zip from SourceForge.

sudo unzip clonezilla-live-*.zip
sudo cp live/vmlinuz /var/lib/tftpboot/
sudo cp live/initrd.img /var/lib/tftpboot/
sudo cp live/filesystem.squashfs /var/lib/tftpboot/
cd /var/lib/tftpboot
sudo touch boot.txt
sudo mkdir pxelinux.cfg
sudo touch pxelinux.cfg/default

Your tree should end up looking something like this in the end:

├── boot.txt
├── filesystem.squashfs
├── initrd.img
├── pxelinux.0
├── pxelinux.cfg
│   └── default
└── vmlinuz

5. Create configs

sudo vim boot.txt

I made my menu look something like the following…


========================================================================

 .d8888b.  888                                    d8b 888 888
d88P  Y88b 888                                    Y8P 888 888
888    888 888                                        888 888
888        888  .d88b.  88888b.   .d88b. 88888888 888 888 888  8888b.
888        888 d88""88b 888 "88b d8P  Y8b   d88P  888 888 888     "88b
888    888 888 888  888 888  888 88888888  d88P   888 888 888 .d888888
Y88b  d88P 888 Y88..88P 888  888 Y8b.     d88P    888 888 888 888  888
 "Y8888P"  888  "Y88P"  888  888  "Y8888 88888888 888 888 888 "Y888888 

======== Boot Options: ================================================

>> clonezilla ......... Regular Boot
>> clonezilla_safe .... Failsafe Mode

=======================================================================

And finally the pxe config…

sudo vim pxelinux.cfg/default

Looked something like this:

DISPLAY boot.txt

LABEL clonezilla
	kernel vmlinuz
	append initrd=initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=tftp://192.168.1.121/filesystem.squashfs

LABEL clonezilla_safe
	kernel vmlinuz
	append initrd=initrd.img boot=live union=aufs noswap noprompt vga=normal nomodeset nosplash fetch=tftp://192.168.1.121/filesystem.squashfs

PROMPT 1
TIMEOUT 0

Please note that the IP address should be the IP of the TFTP server!

Now testing with a Dell Latitude E6410 I hit F12 on the BIOS screen, Select Network Adapter, and SUCCESS! You should see your boot.txt with a “boot:” prompt. Please share your experiences and alternative implementations on how you solved this issue. I would love to hear them!

My Test results:
250 GB (239.9 GB after formatting)
67.7 GB in use
175.2 GB free
Transfer Rate: Started at 900 MB/min at first, peaked at 1.91 GB/min, ended at 1.72GB/min, average 1.7 GB/min
Time elapsed: 37 minutes, 41 seconds


« Previous Entries

Powered by Wordpress | Designed by Elegant Themes