Archive for the ‘HOWTOs’ Category

HOWTO dual-boot between Linux and Windows using GRUB

Tuesday, May 8th, 2007

When I first started out with Linux, I wasn’t aware of some of the issues that can arise with dual-booting Windows with another OS.  The following ramblings are some of my experiences/findings. (more…)

HOWTO install ScummVM on a Treo 650 (Palm OS)…

Monday, May 7th, 2007

INTRODUCTION

If you’ve never heard of ScummVM before?  Neither had I until a friend introduced me to it.  It’s a program that allows you to play old games by LucasArts, Sierra and the like.  Most of these games were written for DOS, so running them in today’s environments is next to impossible — but not with ScummVM!  Visit the main ScummVM site at http://www.scummvm.org/.

INSTALLATION

These are the instructions I followed to get ScummVM working on my Treo 650 (Palm OS 5-based phone).  I not only had the Treo 650, but also had a 2GB SD memory card in the phone.

First off, start off by downloading the latest stable version of ScummVM.  Once this is downloaded, you can sync the main ScummVM engine (When you unzipped the downloaded copy of ScummVM, it’s in the OS5 directory, the file called ScummVM-Frontend.prc) to your handheld or your card — whichever you prefer!  I sync’d it to both, although if my card’s not installed, having the engine won’t do me much good.

Next, download skin.pdb and sync it to your handheld.  This is crucial.  I missed this for awhile and couldn’t get it to work right!  Turns out that right now, this file is missing from the main ScummVM downloads, so you have to go to another site to get it (why, I don’t know).  Check out this ScummVM Forum for outside confirmation: http://forums.scummvm.org/viewtopic.php?p=15955&sid=d73b94ceba7b93a2a509825630d44172.  Now, if this URL ever disappears, the site that they’re linking to is http://capers.free.fr/ScummVM/download/arm.zip.  Download and extract this, but use only the skin.pdb file!

Now you’re ready to install the .engine files that you’ll be needing and the games you’ll be playing.

NOTE: Since I was cheap and didn’t have a card reader on the computer I’m sync’ng my Palm to, there’s a way that you can write files to the Palm via the sync software.  If you rename your files that you’re wanting to copy to your Palm with an .mp3 extension, the Palm software will let you sync them (to your handheld OR your card).  The only gotcha is that it dumps them into one directory, so you have to move them where you want them and also rename them.  A great program to use for renaming/moving files, etc. is Filez (download it from http://nosleepsoftware.sourceforge.net/)

Okay, here’s the basic file structure that works for me:

  • External Card
    • PALM
      • Programs
        • ScummVM
          • Games
            • QUEEN.1C
            • SKY.CPT
            • SKY.DNR
            • SKY.DSK
          • Mods
            • queen.engine
            • sky.engine

Notice in the above listing, I placed a couple of games there (Beneath a Steel Sky and Flight of the Amazon Queen).  If you don’t have any "old" games to load up, don’t despair — download these two games at the main ScummVM site (go to Downloads, then scroll down to the Extras, game downloads section).  Either way, you need to have the correct engine installed for the game(s) you’ll be playing.  If you’re going to play an old LucasArts SCUMM-based game, copy the scumm.engine file to your Mods directory, etc.

GAME CONFIGURATION

Now that you have the files all sync’d and copied, you have to set them up in ScummVM.  Run ScummVM.  If the screen looks like a regular Palm screen (same background color, same rounded buttons as a normal Palm program, etc.), then you don’t have the skin.pdb file installed properly.  Download and install it!

In the top-right of the screen, there’s an icon — click on it and select your memory card (assuming you’re using one).  ScummVM defaults to using your Palm’s internal memory, so this will tell it to use your SD card (again, assuming you’re using one).

Okay, assuming the GUI’s working right and all requirements are met, let’s setup Flight of the Amazon Queen.  Here’s what I use:

  • Entry name: FOTAQ
  • Path: /PALM/Programs/ScummVM/Games/
  • Game: queen
  • Engine: Flight of the Amazon Queen

Incredibly, that’s it!  I’ll bet you can guess what I use for Beneath a Steel Sky — that’s right, for the game, I type sky and choose the right engine (Beneath a Steel SKy).

From here, just click the game you’ve just created and click the "start" (looks like a play icon) button.  It should be good to go!

CONCLUSION

ScummVM runs great on my Treo 650 — the only problems I’ve experienced is an occassional freezing during gameplay, but a simple reset fixes this.  Doesn’t happen all the time and I don’t know what’s causing it, but it doesn’t happen enough to cause me woe.

I can have sound (not only voices, but sound effects and background music if I want).  I prefer not to have the sound on as it’s highly compressed and sounds kinda lousy on the Treo’s speakerphone.  I haven’t found a way to have the sound go over my Bluetooth headset — if someone else, let me know as I’d like to try this!

HOWTO install Windows XP Professional 64-bit (x64) on 32-bit Linux

Friday, May 4th, 2007

MY SPECS

  • 2 x AMD Opteron 240 (1.4GHz) – see this by running cat /proc/cpuinfo
  • 1GB RAM
  • Host OS: Xubuntu 7.04 (Feisty)
  • Guest OS: Windows XP Professional 64-bit (also referred to as x64)

BACKGROUND

This whole thing started when I got motivated to use Linux (Ubuntu) as my main OS, and Windows for what I absolutely had to have (the whole Office 2003 suite – Outlook, Visio – and some other work-related apps that only ran in Windows). Yes, there’s WINE out there, but I didn’t want to spend forever and a day configuring WINE to run a single application (yes, I’ve spent a considerable amount of time in the past trying to get Windows applications to run on Linux, and I’ve been rather successful, but it takes far too much time to justify it, in my opinion). Well, I have a Windows XP Pro 64-bit license (not a 32-bit — NOTE THIS). Turns out that the 64-bit and 32-bit licenses aren’t cross-compatible (same OS — go figure). I realize that there a massive amount of differences between 32 and 64 bit OSs, but still, it seems like the license should allow use of either (or at least backwards compatbility — ie. if you have the 64-bit, you can run either the 32-bit or 64-bit). Too logical of a solution, I guess because it’s not that way. I’m stuck with the 64-bit… I started off by trying to use VMWare Server (free download from VMWare), but my CPUs lacked certain required features. See http://www.vmware.com/support/ws55/doc/releasenotes_ws55.html#bb_64 to see if your processors are on the "approved" list. There are other options — BOCHS might do it, but it’s horrifically slow… I didn’t find much in the way of 64-bit support on KVM. There’s lots of other virtualization products, but most of them have the same requirements as VMWare Server. Bummer.

SOLUTION

When I thought I was out of luck, I found a solution. Welcome to QEMU! QEMU can be found on the web at http://fabrice.bellard.free.fr/qemu/. There’s lots of different features and lots of HOWTOs out there on using QEMU, so I’m not going to delve into that. I’m focusing on getting XP x64 to install and run on QEMU. IMPORTANT NOTE: You *must* download the latest version of QEMU (I’m currently running 0.9.0). Don’t depend on your distro’s package for this. You can try installing your distro’s package, but if it’s not a more recent version (I’d recommend nothing prior to 0.9.0), uninstall it and get the latest off the web. It’s said that 64-bit guest OS support is still experimental, so it can only be found in the latest version. Prior versions didn’t have support for it at all. FYI: I’m not covering KQEMU as my processors don’t support its requirements (same situation as VMWare above). If you’re wanting to use KQEMU, lookup a HOWTO on the Internet. If you have some performance specs between QEMU and KQEMU, I’d love to hear about it though (I can drool over it until I upgrade my system so I can run KQEMU). To start with, create the hard drive image you’ll be using for the virtual machine. In the directory you want the image to reside in, run the following command:

qemu-img create xp_64.img 3G

You can specify a larger disk image, but I wouldn’t go much smaller as Windows is a HD hog. NOTE: My first attempt, I created the virtual machine on an NTFS partition (I have two hard drives — one for Linux, one for Windows). I noticed a performance degredation with this as the NTFS drivers were sucking up a lot of resources. I’m not sure what NTFS driver was loaded at the time as I just scrapped that idea and loaded it on the native Linux ext3 partition. Problem solved. I’d recommend having an ISO image of your XP CD as this will be faster and won’t require you to mess with the physical CD. Google how to create an ISO from a CD in Linux if you don’t know how — I forget the link I used, but it involved using dd. Next, run QEMU as the following:

qemu-system-x86_64 -cdrom xp64.iso -hda /home/user/vm/xp_64.img -localtime -boot d -m 256 -win2k-hack

This will startup QEMU as follows:

  • 256MB RAM
  • CDROM drive using xp64.iso as the image
  • Hard drive using /home/user/vm/xp_64.img as the image for the hard drive
  • Boot off of the CD-ROM
  • Win2k (and XP) compatibility hack

Note the -win2k-hack was required for me to finish the XP installation — if this wasn’t supplied, it’d hang right towards the end of the final installation steps (it would hang when there were a couple of minutes remaining in the installation). When I passed this argument, it worked like a champ. After you’re done with the setup, you can use the -boot c argument (tell it to boot off of the hard drive, not the cd-rom).

NETWORK SETUP

The next challenge was getting the networking to work. Again, there are lots of HOWTOs on this, so I’m only going to share what I did and what worked for me. My goal was to have a unique IP address for the guest OS as well as the host OS (ie. two IP addresses consumed by my single, physical machine — one for each OS). You have to have several packages installed, none of which I have in front of me. Here’s a few commands that are needed — if you have an Ubuntu distro, if you type in some of the commands and the package isn’t installed, it’ll notify you of this so that you can install the correct package to get the needed program.

  • tunctl
  • brctl

Additionally, unless you’re logged into your system as root all the time (no, no, no!), I’d recommend changing your sudoers file so that you don’t have to type in your root password when you execute QEMU. Don’t manually edit the file — to edit it, run the following:

sudo visudo

This opens up an editor and checks the consistency of the file (for errors, etc.). Here’s what my sudoers file looks like:

# /etc/sudoers
#
# This file MUST be edited with the ‘visudo’ command as root.
#
# See the man page for details on how to write a sudoers file.
# Host alias specification

# User alias specification

# Cmnd alias specification
Cmnd_Alias QEMU = /sbin/ifconfig, \
                                        /sbin/modprobe, \
                                        /usr/sbin/brctl, \
                                        /usr/sbin/tunctl

# Defaults
Defaults !lecture,tty_tickets,!fqdn

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
user ALL=NOPASSWD: QEMU

See the Cmnd_Alias QEMU above? When linked with the user account "user" (bottom of the file), it allows the "user" account to execute the programs in the Cmnd_Alias QEMU without having to type in a password (ie. sudo ifconfig won’t prompt for a password — it’ll just run). Before continuing, make sure you have the necessary packages installed (try to run brctl and tunctl at minimum). Don’t continue until these programs run (are installed)! Let’s create the bridge that’ll be used right now…

brctl addbr br0 brctl addif br0 eth0

Obviously if you have a different ethernet interface, use it above (if you’re not sure, run ifconfig and look at the interfaces it defines — usually it’ll be something like an eth or eth0, eth1, etc.). Okay, now the QEMU startup script can be created… use your favorite editor to create the file /etc/qemu-ifup. Here’s the winning combination that I found works for me:

  • Change the permissions on /dev/net/tun so that you can read/write to it
  • Create the tunnel interface and make sure that it’s bound to your username
  • Bring up the tunnel interface (tap) in promisc mode…
  • Add the tunnel/tap interface to the bridge

Here’s what my /etc/qemu-ifup looks like:

#!/bin/sh

echo "Executing /etc/qemu-ifup"
echo "Configuring the tunnel so that permissions are correct…"
sudo chmod 777 /dev/net/tun
echo "Creating tunnel/tap interface $1…"
sudo tunctl -u user -t $1
echo "Bringing up $1 for bridged mode…"
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0…"
sudo /usr/sbin/brctl addif br0 $1

Lastly, you have to execute QEMU differently to let it know what kind of networking to use. When I installed XP, there are certain defaults that QEMU uses for the networking. The default NIC model didn’t show up in Windows, so I changed the model and am using the following:

qemu-system-x86_64 -cdrom xp64.iso -hda /home/user/vm/xp_64.img -localtime -boot d -m 256 -win2k-hack -net nic,vlan=0,model=rtl8139 -net tap,vlan=0,ifname=tap,script=/etc/qemu-ifup

After all of the steps we’ve done, the above should be pretty clear. If not, man it and google it! One last caveat: for some reason (I don’t know — if you do, email me and let me know!), the script doesn’t get called in the right order. If I don’t execute the /etc/qemu-ifup script first, then run QEMU, QEMU complains that the tap interface doesn’t exist — it’s like it checks for the interface first, then continues executing (and running the /etc/qemu-ifup script). Well, in my script the tap interface isn’t created until the qemu-ifup. Yes, I could rework it so that the tunnel’s created on startup, but I’m lazy. It’s easy enough for me to run two commands rather than one. I’m just glad I figured out how to get XP 64-bit to run as a guest OS on a 32-bit host Linux OS!

CONCLUSION

XP 64-bit does run on QEMU — I can vouch for it. It’s rather slow, but not unbearable. I guess it really depends what you’re doing on it. I wouldn’t consider it for any graphics (CAD/3D modeling), but for business apps, it’s sufficient (Outlook, Excel, Word, Visio) and meets my needs. Everything else I can do in Linux, so no need to deal with the sluggish behavior! As a side note, it does tend to suck up a lot of CPU. I have two CPUs — one of them is constantly pegged to the max when running XP x64 on QEMU. I’m not sure if that’s because I don’t have it configured right or some performance optimization that I haven’t done yet or what. If you have ideas, please let me know! One last thing: I’d turn off many of the "advanced" features of XP. I’m running the GUI in "old-school" (win2k) mode, I turned off all of the graphical effects and have turned off the fading in/out menus in Office 2003 (the fading in/out is *really* slow — the expanding menus work fine, but the fading is just too lousy on the virtual machine). If you have any experiences with this or would like to share tips/hints/thanks/*constructive* criticism from this article or about QEMU in general, feel free to contact me.

Installing OpenNMS on Fedora Core 2

Thursday, January 13th, 2005

OBSELENCE NOTE: This was written well over a year ago, so may be outdated (ie. may have broken links — if so, let me know and I’ll update).  Just because it’s old doesn’t mean that it’s not worth sharing!

Summary:

A quick how-to on setting up OpenNMS (and some of the needed libraries) on Fedora Core 2.

Instructions:

For those who aren’t familiar with OpenNMS, it’s a program mean to aid in the monitoring of a network(s) (see www.OpenNMS.org for more info).

Originally, I tried installing OpenNMS on Red Hat 9, but had a lot of issues with older library packages.  Being faced with upgrading a *ton* of libraries, I ultimately decided to install Fedora Core 2 (FC2).

Prerequisites

This how-to will assume the following:

  • Apache is installed
  • DB4 (Berkeley DB) is installed
  • Postgre SQL is installed
  • RPM management tools (the rpm program/script, etc)

When I installed FC2, I wasn’t low on space, so I pretty much told it to install most everything (not all packages from all four CDs — but the most common packages — the ones displayed in the package selection list).

 

Install Required Libraries

The following libraries need to be installed (to install, run: rpm -ivh <package name>):

  • net-snmp-5.1.1-2.i386.rpm (disc 1)
  • net-snmp-perl-5.1.1-2.i386.rpm (disc 3)
  • compat-libstdc++-7.3-2.96.126.i386.rpm (disc 3)
  • postgresql-jdbc-7.4.2-1.i386.rpm (disc 3)

All of the above libraries that have a (disc #) after them can be found directly on the FC2 CD specified.

 

Install J2SDK

To avoid plagarism and redundancy, see http://wiki.opennms.org/tiki-view_faq.php?faqId=1#q16 for where to get the correct J2SDK (along with how to use it).

 

Install Jakarta/Tomcat

Before you begin doing anything:

Step If this fails, try…
Check to make sure Apache is running

Make sure Apache is running:

[user@system src]# /etc/init.d/httpd status

If Apache is running, you’ll see:

httpd (pid # # # #) is running…
[user@system src]#

Otherwise you’ll see:

httpd is stopped…
[user@system src]#

 

If the httpd (Apache) service is running, go in a web browser to http://127.0.0.1/ on the local machine, or go to http://<machine IP> from another machine’s web browser.   You should see the default Apache page.  If you get an error, something’s messed up.  Fix the problem with Apache before continuing!

Check to see if httpd is configured to start with the system

 

No automatic startup:

[user@system src]# chkconfig –list httpd
httpd     0:off 1:off 2:off 3:off 4:off 5:off 6:off

To correct this:

[user@system src]# chkconfig httpd on
[user@system src]#

 

With automatic startup:

[user@system src]# chkconfig –list httpd
httpd     0:off 1:off 2:on 3:on 4:on 5:on 6:off

Follow the instructions found at http://wiki.opennms.org/tiki-view_faq.php?faqId=1#q14.  I found that this is also a good place to place the CATALINA_HOME environment variable.  My /etc/profile.d/java.sh file looks like the following:

[user@system src]# cat /etc/profile.d/java.sh
export JAVA_HOME="/usr/java/j2sdk1.4.0_02/"
export CATALINA_HOME="/var/tomcat4/"
declare -x JAVA_HOME="/usr/java/j2sdk1.4.0_02/"
declare -x CATALINA_HOME="/var/tomcat4/"
[user@system src]#

Note that as of now, there’s nothing in /var/tomcat4/, but we’re getting to that right now!  That’s where the Jakarta/Tomcat program goes — for now, save yourself a step later and put it in there.

Okay… moving on from the above stuff to check before installing Jakarta/Tomcat.  Go to jakarta.apache.org -> Downloads (Binaries link) -> Scroll down in the long list until you reach Tomcat 4.1.30 -> Download jakarta-tomcat-4.1.30.tar.gz (I usually save stuff like this in /usr/src/ — I’m going to assume you’re doing the same).  Go to /usr/src (cd /usr/src).  Run tar -xzvf jakarta-tomcat-4.1.30.tar.gz.  After it finishes expanding the tar:

[user@system user]# cd /usr/src
[user@system src]# tar -xzvf jakarta-tomcat-4.1.30.tar.gz
[user@system src]# mv jakarta-tomcat-4.1.30/ /var/tomcat4/
[user@system src]#

Okay, now you’ve got Tomcat (Jakarta — I’m calling it Tomcat from now on) where the OpenNMS RPMs expect it.  Modify the /var/tomcat4/conf/tomcat-users.xml file to add another user with admin/manager privileges, similar to:
         <user username="admintest" password="test" roles="admin,manager"/>

Let’s startup Tomcat:

[user@system user]# $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE:   /var/tomcat4
Using CATALINA_HOME:   /var/tomcat4
Using CATALINA_TMPDIR: /var/tomcat4/temp
Using JAVA_HOME:       /usr/java/j2sdk1.4.0_02
[user@system src]#

Go ahead and test it — go to 127.0.0.1:8080 (on the local machine) or <ip address>:8080 on a remote machine.  If you get the Jakarta/Tomcat welcome page, you’re good to go!  If not, go over the above steps again, search the net for the problem, etc.

 

Install OpenNMS

Go to www.OpenNMS.org -> Downloads (under Featured Links heading) -> download all three of the RPMs for Fedora Core 2 (once again to /usr/src/ ?):

  • opennms-1.1.3-2.fc2.i386.rpm
  • opennms-docs-1.1.3-2.fc2.i386.rpm
  • opennms-webapp-1.1.3-2.fc2.i386.rpm

Go to http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ and get RRDtool (Download -> Stable Release -> scroll down until you find the right RPM):

  • rrdtool-1.0.41-1.8.0.i386.rpm

Now install RRDtool:

[user@system user]# rpm -ivh rrdtool-1.0.41-1.8.0.i386.rpm
<a bunch of stuff will be shown here>
[user@system src]#

Note that if any errors are generated, you need to get them fixed (mainly missing dependecies) before continuing — if you get errors — fix them then retry this step.

Now install OpenNMS:

[user@system user]# rpm -ivh open*.rpm
<a bunch of stuff will be shown here>
[user@system src]#

Note that on my system, even though I had the necessary dependencies (modules) installed, I was still getting "missing package" errors.  To avoid that, I used the following command to install OpenNMS:

[user@system user]# rpm -ivh –force –nodeps open*.rpm
<a bunch of stuff will be shown here>
[user@system src]#

BE VERY CAREFUL USING THE ABOVE COMMAND — IT TURNS OFF ALL DEPENDENCY CHECKING AND WILL FORCE AN INSTALLATION, WHETHER IT WILL OR WILL NOT CAUSE PROBLEMS!!!  (use it only if you’re sure that you’re safe and know what you’re doing)

 

Before starting the service, you need to customize the IP range(s) that the discovery service will search/monitor.  Modify the file /opt/OpenNMS/etc/discovery-configuration.xml to include the IP range(s) that you want OpenNMS to monitor.  Refer to the HTML page at /opt/OpenNMS/docs/quick/book.html for more information on customizing this and other options.

At this point, if the above step didn’t generate any errors, you’re ready to start the OpenNMS service.  To do this:

[user@system user]# /etc/init.d/opennms start
Starting OpenNMS:                      [  OK  ]
[user@system src]#

If you have an error above (it would say FAILED instead of OK), look at the logs found in /var/log/opennms/ to try and see what’s causing the problem.

If the above started without an error, before accessing OpenNMS, make sure that all (or most of) the services are started:

[user@system user]# /etc/init.d/opennms status
OpenNMS.Eventd          : running
OpenNMS.Trapd           : running
OpenNMS.Dhcpd           : starting
OpenNMS.Actiond         : running
<blah, blah, blah — more services listed>
[user@system src]#

If the the services are good to go, in your web browser, go to 127.0.0.1:8080/opennms (local machine) or <ip address>:8080/opennms (remote machine).  The default login is admin/admin.  From there you can create new user accounts, etc.

That’s it!

 

Handy Directories to Know About

/var/lib/pgsql/ = Postgre SQL directory
/var/log/opennms/ = OpenNMS log directory
/usr/java/j2sdk-??? = Java SDK directory
/opt/OpenNMS/ = OpenNMS directory
/opt/OpenNMS/docs/ = OpenNMS documentation directory (HTML format)
/var/tomcat4/ = directory that OpenNMS RPMs looks for Jakarta/Tomcat in (during the setup, modifying the server.xml file)

 

FEEDBACK

Do you have some comments (errors, omissions, etc) about this brief (and somewhat disorderly) how-to?  Let me know!

Adding Context Options for All File Types in Windows

Thursday, January 13th, 2005

Summary:

I often times have the need to open a file and see what’s really inside it, not open the file in what it’s associated with in Windows.  Sometimes I might want to see the plain text value (ie. open the file in Notepad or some other text editor) or view it in a hex editor.  Either way, adding your favorite editor, or any other program you might want to open the file in is very easy.

(more…)