Aug 17

Ahh, it’s been far too long since I have had anything to say here. I have to say that I have been *legitimately* busy this time. As many of you know, we have come to a close on the first season of The LinuxLink TechShow. That’s 365 (about) 2 hour long episodes over the course of the last 6 years. We are due to start our next 365 at the Ohio Linux Fest in a month. This leaves an enormous amount of prep work and a fair bit of reorganization to keep things exciting and help us start out with a bang.

One of the *surprises* in store brings me to my current topic at hand, my web workers toolkit.

People all have differing opinions about what you really need to do decent web work. As an old commandline jockey, I thought I would share my own.

1) Vim.
Quite possibly the best text editor in the world, I use vim for darn near everything. As a system administrator, it’s indispensable (for scripting) and I find it similarly necessary for web work. Vim has a fantastic (imho) syntax highlighting system which does quite well for html and php highlighting. The only caveat is to make sure to set “set background=dark” in your .vimrc file, unless, of course, you are one of those wierdos who uses a light background in your terminal.

2) tidy or the w3c validator.
I DEFY you to write good code without one of these. There is NOTHING as nice as standards compliant code and without a good validator, you will have nothing like standards compliant code. The reason I listed both of these is that tidy is a program you can use locally to check your code and the w3c validator will check any pages that are accessible via the web.

3) Many different browsers.
Unfortunately, all browsers are not made equal. You can be sure that all mozilla based browsers like Firefox, etc., will display things very similarly, and maybe even throw Google Chrome into that mix, but you may really want to check your code with Safari and IE to be sure things still look the way you had intended, and let’s not forget about a text browser like lynx or w3m to make sure your pages are readable and navigable that way too.

4) Lastly, for me, some good reference material.
One can hardly be expected to remember everything and having some reference material handy for those odd css commands and perhaps php/perl/python/someotherprogramminglanguage could really save you some time and frustration. Never underestimate keeping your old code around for example and never ever underestimate the power of the power of the Google Search!

In a nutshell, that’s generally what keeps me cranking out websites and webpages. What kinds of things do you use? What am I missing out on? Send a long a comment and let us all know what works for you! ( Unless, of course, you use emacs :D )

Feb 08

I decided that on my vacation I would do some catch-up work. I have many times mentioned that I am a consummate procrastinator, and if you combine that with me being just generally whooped tired after 12 hours away from home on any average day, you understand why my computers seem to go uncared for. I think it’s the same as the whole “the mechanics car is never fixed” thing.

I mentioned a couple days ago that I installed ESXi on one of my home servers (redundant servers) to fix a strange problem I had been having with VMware Server 2.x. That was the first job I needed to so, or at least the most important, and so far it has been doing beautifully.

Next on the list was Mint 8 on the old laptop. It has been running Mint 7 since the distro was released and it was time for an upgrade. Everything was working just fine on 7, I just wanted to catch up the latest/greatest. As expected, the upgrade was a no-brainer and it’s running gorgeously, as Mint does.

Today, so far, I decided to upgrade my desktop machine to Mint 8. This machine, a P4 3Ghz with 3Gb of ram runs like absolute crap. I don’t exactly know why, but it always has. Now I have replaced the cpu fan a couple times and also the power supply at least twice. The computer is noisy, whiny, but not physically broken that I can tell. It just seems to run slower than hell and always has. The installation of Mint 8 on it did make it prettier, but sure didn’t make it seem to run any faster. I think it just dogs over the dual display and craptasticly old Nvidia card. Perhaps if I bought it a new quiet power supply, a better working and quieter cpu fan, a new better video card and a new dvdrom drive (yeah that’s pretty broken too), I could resuscitate this thing so that I could stand using it again. But then again, I could probably buy a whole new desktop computer for what I would spend on repairs to this one. Dang.

So, what’s next? Well, I should install ESXi on my redundant server now that I am satisfied with how the other one is running. I should also upgrade to Mint 8 on my Acer Aspire All In One netbook (notice a pattern here). Other than that, I am not sure.. Maybe work on some code projects I have been stringing along for months and months.

So what kinds of great computery projects are you all up to? Or what SHOULD you be up to :-)

Dec 01

ubuntu
Yes, another post about Ubuntu 9.10. I know I tried it out before, but I put it on this new (old) laptop and am giving it a little better run this time. I still believe 9.10 (Karmic) to be a fine running distribution and this time I got to test out my method of installing all the codecs I want on there, along with messing with Grub 2 a little bit.

When you are travelling abroad where it’s legal to do so, as i was just the other day, you might want to have access to all those codecs that make life worth living on a linux box. Things like listening to your mp3s and watching your dvds and miscellaneous media files are very dificult without them.

I realise that Ubuntu has, for some time now, been able to detect that you need so and so codec to play so and so media and ask you if you really want it installed, but I find that particularly irritating. I like to already have that functionality there when I want to use it. To do that, I have a little script that I use that generally takes care of that for me, along with installing most of the programs I need to make my day to day use hassle free.

#!/bin/bash
sudo wget http://www.medibuntu.org/sources.list.d/karmic.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install mozilla-thunderbird php5-common php5-cli php-pear subversion openssh-server clusterssh imagemagick vim synergy smbfs curl vlc libdvdcss2 ubuntu-restricted-extras w32codecs mplayer mencoder build-essential sqlite dia expect mysql-client

Feel free to modify and use this, but basically I derived this from paying attention to the programs I need and use and making a list. It really does save a lot of time to do this.

The other thing I wanted to mention is Grub 2. For some reason, someone decided it was time to move from the original Grub to Grub 2. Time alone will tell whether that was a smart move or not. I know I certainly had a tough time of it for a day or two. Everything has moved and the methodology has changed as well. The short of it is you have some config files in /etc/grub.d that you can now manipulate, along with issuing a “update-grub”, that will build your /boot/grub/grub.cfg, which is pretty much the equivalent of the old /boot/grub/menu.lst file. The fun part is figuring out how all this works because, as it happens with open source many times, the documentation sucks.

What I needed to do was to add another linux distribution to grub so I could dual (or multi) boot it. This is accomplished in that /etc/grub.d directory. Now it’s worth mentioning here that if you do multiple OS installs on your machine and just issue a “update-grub” on your base Grub 2 enabled OS, it will (or at least mine did) auto detect this installation by default and add a boot option for it into the grub boot menu. The problem is, like mine, it probaly won’t boot your other OS.

The way to fix this is to go into /etc/grub.d and “chmod -x 30_os-prober”. After that you won’t be auto-genning entries. Next you can make a copy of the 40_custom file (I named mine 41_centos) and edit that file to have the correct boot parameters to boot your other OS. This is especially fun without having a good grasp of the correct syntax. For instance it took me hours to figure out that the “kernel” line that the old Grub used has been replaced with a “linux” line now. Other than that, though, just make sure that if you are booting another linux to use the correct root label and kernel and initrd image names and locations. My correct and working CentOS entry looks like this for reference:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the ‘exec tail’ line above.
menuentry “CentOS 5.4″ {
set root=(hd0,3)
linux /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-164.el5.img
}

Have fun!

Aug 15

In between bouts of making Linc’s World Famous Potato Soup, I had a few minutes to do some catch-up coding today on FreeLinuxBox. It desperately needed an rss feed, so that is what I coded up. How else are you supposed to know there is new stuff there right? Well, all finished and added the feed to LinuxPlanet.org, which you should be subscribing to if you aren’t already :-) If you are just looking for the FLB feed, you can find it at http://freelinuxbox.org/rss/rss.php.

Speaking of Free Linux Boxes, Russ, The Techie Geek, was the latest person to put a box up on FLB and he has a GREAT idea. He wants local pickup (because of weight no doubt), but he said he’d be wiling of delivering to the Ohio Linux Fest. Outstanding idea. If you, like me, have some boxes you are putting off giving out because of the hassle in shipping, perhaps following Russ’ example could be the answer!

Jul 12

Late last ‘week I noticed that my new nagios server was not responding anymore. Well, I checked it and it was down. Not only that, it was a vm on my test server and the entire server was down as well. Arrrgh.

Usually I use this as a foray to tell you all to remember to do your backups. Well, in this case I didn’t do them either. Hey, it’s a test vm server right? Yeah, well I am kicking myself about that anyhow. I just got nagios working really well the way I wanted. Oh well, I guess I get to practice some more right :-)

Well, as it turns out, my server had a catastrophic drive failure. I did EVERYTHING to try and resuscitate this thing. To start with, it had no partition table at all. Luckily I bought 2 of these servers and they were identically configured, so I checked out the partition table of the one and used fdisk to apply it to the broken one. After that I was able to fsck one partition, but as it would happen, that partition was only boot. Feh. The other partition had lost all it’s superblock info. I couldn’t even use a backup superblock. Nada. I noticed that mkfs had a command line switch of -S, which writes the superblock info on a artition without formatting or touching the inodes. I tried that and it appeared to be successful. At leat I could run fsck on the partition now and it was fixing the inodes. YAY! except that after a few hours of fixing, I still got nothing but a few system files in a pile under the lost-n-found directory. Shortly thereafter the drive lost it’s partition info again anyway. That’s life I guess.

So, it was off to Microcenter to get a new hdd. I brought that home and did a fresh CentOS 5.3 32 bit install and played with it a bit and thought to myself, hey, maybe I should run some kind of burn-in test on this server before I go investing a lot of time into it again.

That is where Sys_Basher comes in. Sys_Basher is a multithreaded memory and disk exerciser. That’s what the website says. It makes a pretty good burn in program by continually testing your memory and disk (which pushes on your cpu as well) for any length of time you specify. I kinda like it actually, and that is a good thing because there are woefully few burn-in or stress test type programs available to the Linux community. In fact, if you are a programmer and looking for a great project, you could generate a lot of traffic and interest by making one. Not that I don’t like Sys_Basher, mind you, but variety is the spice of life and certainly the way of open source!

Anyway, I ran Sys_Basher overnight on my new machine which passed with flying colors. Then, this morning, I decided that maybe I should run 64bit Linux on this box. Some days I am so fickle, but I decided it would be in my best interest to change up the OS before building a bunch of new test vms on there :-)

Maybe this time I’ll even back the darn thing up too! Wish me luck and, btw, do your backups!

Jun 04

Here’s one for the book…:

I have a script that monitors a process and I want it to email my cellphone (to page me) if things don’t look just right. The problem is that just using “mail” or “mailx” in a script fails because my carrier divines whether or not my return address is real. Obviously a from field that looks like “root@localhost” is just not getting through.

What’s the solution? Enter “mutt”.

Mutt, it seems, will let you specify your from field in the ~/.muttrc file. Also, it works pretty much the same on the command line as mail or mailx. So, I set up mu ~/.muttrc like so:

set realname = "menotyou"
set from = "menotyou@myrealdomain.com"
set hostname = "myrealdomain.com"
set use_from = yes

And then, in the script I send mails like so:

echo "Wow I can send mail!" | /usr/bin/mutt -s "A present for you" myphoneaddr@provider.com

All in one line of course, but BINGO, all the sudden my cell phone springs to life at all hours of the night with information I don’t want to know :-)

Enjoy!

May 04

Even though I wrote and use OSM I also use Nagios at work (along with OSM). Actually, I administer Nagios there, however I have never actually installed and configured it. It was in place before I started there.

That being said, my manager asked me how to get it installed and running today, as he wants to try using it at home. This sort of spurred me into setting it up at home tonight. It’s really nice having a server that can handle a few test VMs, by the way :-)

I decided I would install it on CentOS, because I need to be able to get it running on RedHat for work, so off to Google I went. After a bit of searching I finally came across a WONDERFUL site which provides a quick and dirty script for getting Nagios installed and working lickety split. It works perfectly and the only adjustment I made to the script, other than changing the passwords in it, was to comment out the SELinux lines because I already have SELinux disabled.

That really was it. Pretty simple. Of course the rip here is actually getting Nagios to monitor your systems, and that is probably beyond the scope of this post, which was really meant as a reference for that install script. Configuring nagios by the command line is not for the faint of heart. The files you need to pay attention to end up in /usr/local/nagios/etc and /usr/local/nagios/etc/objects. Just keep in mind that the configs seem to reference eachother in a cyclical way and you really need to pay attention. I found a good starter-help at the bottom of this website for adding your first non-local machine. Once you get that working you’ll understand how to add more, but I still found it a bit of a frustrating experience for a few minutes.

I did note, however, that there are quite a few projects out there which claim to configure Nagios for you via a web interface. I hope to give them a shot or two in the coming days/nights. Let me know if any of you have tried any and how they fair.

Apr 06

CentOS

CentOS


Just a quickie tutorial on how to set up a web based subversion server on a CentOS server in a hurry.

To start with you need a CentOS 5.x install with a working web server.
# yum install subversion mod_dav_svn
Pick a directory where you want to house your repo. We’ll say for argument mine is /home/svn.
# vim /etc/httpd/conf.d/subversion.conf

Location /svn>
DAV svn
SVNParentPath /home/svn
AuthType Basic
AuthName “Subversion”
AuthUserFile /etc/svn-auth
Require valid-user
/Location>

Note that the leading less-than symbols are not displayed on the “location” tags because wordpress is retarded.

Add yourself a user into your auth file:
# htpasswd -cm /etc/svn-auth
You’ll be prompted for your password couple times.
Add your directory and fix permissions:
# mkdir /home/svn
# chown apache:apache /home/svn
Create your first repo:
# svnadmin create /home/svn/test
Restart your web service:
# service httpd restart

That’s it! If you point your web browser to http://yourwebserver/svn/test you should get a “Revision 0″ notice.

Feb 16

On an rpm based system, say CentOS, first make sure that the rpm-build package is installed.

In your user account, not as root (bad form and all) make the following directories:


mkdir -p ~/rpm
mkdir -p ~/rpm/BUILD
mkdir -p ~/rpm/RPMS
mkdir -p ~/rpm/SOURCES
mkdir -p ~/rpm/SPECS
mkdir -p ~/rpm/SRPMS
mkdir -p ~/rpm/tmp

And create an ~/.rpmmacros file with the following in it:


%packager Your Name
%_topdir /home/YOUR HOME DIR/rpm
%_tmppath /home/YOUR HOME DIR/rpm/tmp

And now comes the fun part. Go to the ~/rpm/SOURCES directory and create a working package directory under that with the package name and a dash and the major revision number. For example, ~/rpm/SOURCES/linc-1. Now in that directory you will copy all the scripts/files that you wish to have in your package. For example, I might have a script in that directory called myscript.sh that I want to be installed as part of the linc package.

Once that is done, make a tarball of that directory in the ~/rpm/SOURCES directory named programname-revision.tar.gz. Using my previous example it would be:

tar czvf linc-1.tar.gz linc-1/

Now for the glue that makes this all stick together. Go to your ~/rpm/SPECS directory and create a spec file for your package. We’ll call mine linc.spec and it’ll look like this:


Summary: My first rpm script package
Name: linc
Version: 1
Release: 1
Source0: linc-1.tar.gz
License: GPL
Group: MyJunk
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
Make some relevant package description here
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/opt/linc
install -m 0755 myscript.sh $RPM_BUILD_ROOT/opt/linc/myscript.sh
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo " "
echo "This will display after rpm installs the package!"
%files
%dir /opt/linc
/opt/linc/myscript.sh

A lot of that file is pretty self explanatory except then install lines and the lines after %file. The install lines tell rpm what to install where and with what permissions. You also have to do any directory creation there as well (the one with the -d in the line). The things after %file are similar in that this tells rpm’s database which files are attached to this package. The %dir signifies a new directory, otherwise the files are listed with their complete paths.

Now that you have all that together. The last thing you need do is create the package. Just go to ~/rpm and do an “rpmbuild -ba SPECS/linc.spec”. You will end up with an ~/rpm/RPMS/noarch/linc-1-1.noarch.rpm if all goes well.

Jan 19

I mentioned previously that I was thinking of adding some new functionality to my BashPodder pages. I wanted something to help me keep track of information and new user contrib scripts there instead of me manually taking care of it all. The best solution I could think of was a forum. Then, I got thinking that I might just e able to use that forum to help me manage multiple software projects. A good idea was forming when Dann started to demand that I set everything up that way. Enough procrastination, he insisted. He wanted to jump right in and be the first to post HIS BashPodder modifications. I couldn’t go fast enough. If you know Dann like I know Dann, you realize you just don’t tell him no or “bad things may happen”.

I conceded and set everything up for Dann. The results can be found at http://lincgeek.org/lincware.

Seriously though, I set up a nice forum for a few projects that I work on regularly. You will be able to find information there for BashPodder, OSM, Rackspace and TivoGrab as well as others. Please wander over there and register if you use any of those projects. It will be a lot easier to keep things straight this way, not to mention being able to easily share information with not only me, but eachother as well.

preload preload preload