Tuesday, October 30, 2007

DualBoot Windows XP and Ubuntu 7.04: Manual Partition

There have been a lot of how-to's written about the process of installing ubuntu onto a hard drive 'next to' XP, thus creating what is called a dual boot system. This one documents how I did it, with an emphasis on the process of partitioning, which is a beginner level thing but very important. Linux, and GParted in particular, allows a very advanced ability to partition and repartition your hard drive without destroying data. That being said, you should always back up before doing any kind of partitioning. I use acronis home, but there is a freeware program called <> which I am going to try soon. I also suggest using Mbrfix prior to making any changes in case there is some damage to the master boot record. Mbrfix will come in handy for the second part of this blog as well, wherein I will describe the process of returning the computer to a Windows boot and using a boot floppy to boot Ubuntu. This latter part is fairly unique, I think, and I had to play with the process to get it right because I could not find adequate documentation.

Having backed up your C: drive, it is time to create the partitions necessary for an Ubuntu Linux install. This blog assumes you have been playing with Ubuntu in a virtual machine. I highly suggest getting familiar with it, or another Linux distro, in this manner before making the leap to having it as your 'main' operating system. The advantages to doing this are well documented; I just like trying different things. From the boot up from the Ubuntu Live CD we will be using the Gnome Partition Editor to make the changes, located at System>Administration>GNOME Partition Editor (click on picture for full size image)

NOTE: BEFORE CONTINUING BACKUP YOUR WINDOWS OS AND ANY IMPORTANT DATA. I highly recommend familiarizing yourself and using BartPE, along with the MBRFix and DriveImage XML plugins (MBRFix is not exactly a plugin, rather it is a command line utility that must be run from a Windows environment, ie the BartPE disk). You should do this whether you are dual booting or not. Keeping your system backed up is always a top priority.

Now it is time to partition! You should be looking at something simliar to this:

In the top right corner is a pull down menu that will show all your hard drives, if you have more than one. You can choose by size, or by the fact that your Windows OS will always be on 'a'. In this case, the OS is on /dev/sda - and more specifically in the first partition /dev/sda1. You can see that the second partition is unallocated. I am going to shrink the Windows partition (sda1) and then add it to this one (sda2).

To shrink the existing partition: Highlight /dev/sda1 (or /dev/hda1 on some drives) then choose Resize/Move.

In the middle box enter the new size of the partition in MB, ie I took mine from 29GB, or 29000MB, to 24GB, or 24000 MB. Then click tab and Gparted fills in the next space for you. Click Resize, and then Apply. This operation could take awhile depending on the change in size and your processor speed.

Now, highlight to unallocated partition and Click New. Choose Extended because we are going to partition this little part up for a couple of new Linux OS's and some swap space, which Linux uses if you get low on RAM. Now click on the unallocated area again and choose New. Leave the first number as it is, type 1000 in the middle and then tab to let Ubuntu fill in the rest. Under File System choose linux swap. This sets aside 1GB of swap space for any linux distro that you run.

In the unallocated space left do the same as above, except choose enough space for the Ubuntu install and choose ext 3 for the file system; I chose 20000 (20 GB), and then leave about 10GB unallocated for another project later. You can do all this and then press apply, but I like to have the program do each step because there seem to be less errors that way, so I hit apply each time I make a change.

Now you are ready to install, as long as you have at least backed up your MBR using MBRfix, that is. The install of Ubuntu is going to insert a new "Bootloader" into your MBR, so be aware that upon startup things are going to look differently. This bootloader, called GRUB, will take care of things for you, providing you with a list of available operating systems to choose from: namely Ubuntu and Windows. So, with all that in mind, double click install and start the process. When you get to Prepare Disk Space, choose manual.

Click on the box next to the partition you set aside for Ubuntu, ext 3, and under mount point, choose the back slash.

Skip the "Migrate Docs and Settings", and choose a name and password you will remember. Finally, make sure the numbers correspond to the ones you want to install to (NONE OF THEM SHOULD BE 1; ie, you should not be installing to sda1 or hda1 because this is where your Windows OS is!!!!!)

Now you are ready to go! Install and restart. You will notice the new Boot menu, which gives you a choice of the Ubuntu OS or the Windows one. You can stop here, adding the programs I suggested in a previous blog, or go on to Part 2, where I will describe how to go back to the Windows way of booting up and then boot Ubuntu from a floppy disk.


Friday, October 26, 2007

OS on a Stick 2: Dressing up USB Puppy 3.01

Part 1: OS on a Stick: Puppy 3.01 on a USB Drive

To really experience the power of Puppy Linux run from a USB drive you need to add some of the great variety of applications that are available. The very first thing I usually do is get Firefox. This package and many others is available here. Scroll down to mozilla firefox and download it. I usually put it in /root/mydocuments/tmp. Then just click on it (remember - one click!) and install. To see it in the menu choices go to Menu>Shutdown>RestartJWM. This resets the desktop, which is much faster than completely rebooting. Then you will see an icon for firefox in the Menu>Internet.

Next go here and download the Gslapt Package Manager. As I mentioned earlier, the application availability for Puppy increased exponentially when the developer made it coincide with Slackware. This means that Puppy has all the same basic packages preinstalled as it's linux sibling Slackware, although fundamentally it is a very different OS. Follow the directions in this forum thread, and go ahead and bookmark this forum because most of your questions will be answered here.

Next you can install either the Flash9.pup or the Flash 9 plugin from the gslapt package manager (located in Menu>Setup). The Flash9.pup has been hard to find lately, so I went for the slackware package.

I like to keep track of my CPU use and Gslapt has a version of GKrellM which works nicely. Also, there a lot of themes available to give it a cool look.

Next I got MPlayer from Gslapt, which is a very nice video and music player that plays pretty much every format.

Finally to get the look you want you can download wallpapers to get your own background. Download the picture you want to /usr/share/backgrounds and then go to Menu>Desktop>Puppybackground image and choose which background you want.

Also you may want to put links with icons on your desktop. For firefox get the link from /usr/share/applications. Just drag it from the folder to your desktop then right-click the icon and choose Edit Item then change the name to just Firefox. For something like GkrellM just do a search (Menu>Filesystem>Pfind) and find the icon that when you click on it the program starts (/usr/bin/gkrellm) and drag that to the desktop. Find an icon you like and download a folder you create in /root/mydocuments called icons. If you need edit it to make it about 50px x 50px then do so. Next right-click on the desktop icon you want to change and choose Set Icon. Drag the pic from the folder to the box presented and Viola! you have your cool new icon. Here is a pic of my desktop (click on it to see full size):

There is so much more to this incredible little OS. Soon I will document what is called a 'frugal install', where puppy is installed to your computer's hard drive. The possibilities increase exponentially from there.....

Wednesday, October 24, 2007

OS on a Stick: Puppy 3.01 on a USB Drive

Puppy 3.01 is out and it is quite wonderful. It works better out of the box than any of the other versions and has some really great features, one of which is a compatibility with Slackware, which I will discuss more later.

I wrote previously about using Puppy in a virtual machine, mainly as an ssh server. The very first thing that attracted me to this unique and powerful Linux operating system, however, was it's ability to function off a USB drive, or Flash drive.

A Full Operating System That Fits in Your Hand!!

I would suggest using a virtual machine with a program like VirtualBox first, but once you begin to feel comfortable with it you should definitely try using it off a USB for a totally portable Operating System.

First, download the ISO from here. Virtual machines require the retro version, however the 'normal' version (look for puppy-3.01-seamonkey.iso) works just fine from a USB or LiveCD. Burn it to CD using a program like BurnCDCC, which is recommended on the Puppy download page. You can actually run the OS from this LiveCD, but I have found that it is much more portable off a USB drive. Start up the LiveCD by making sure your BIOS is set to boot from the CDRom. Choose your country's default keyboard and then go ahead and choose XVESA first and then your screen resolution. Once you are 'in' puppy, insert the USB you want to use. Then go to the Menu button in the bottom left (although this menu list can be accessed from anywhere on the desktop with a right click of the mouse) and choose Setup then puppy universal installer:

The first choice is for a Flash Drive, so click OK. Next you should see your usb device name, click ok. Now choose the top right install choice.

Make sure the info in the next box matches the size of your USB device (in MB) then click ok. At this point I usually choose mbr.bin. Like the author of the heading, it has worked consistently for me.

Next just hit OK and then Enter and the process begins!! Once everything is done the CD will usually eject and you will be running from the USB.

Now, the next stage is probably the most important. Go ahead and poweroff (Menu>Shutdown>Poweroff). You will be asked if you want to save a file. Choose yes and then the defaults until you get to the size. At this point consider this:

Puppy's 'C:' drive equivalent, just for illustration's sake because there really is no similiarity, is this pupsave file that you are creating. All the programs that you install and documents that you save within the puppy file system will exist within this directory. However, the actual size of these programs is surprisingly small, and most importantly, the size of the directory can always be expanded, but never reduced. Therefore, I always choose an option that represents about 25% of the drive, ie I use a 2 gig drive so I chose the 512mb option. You will find this to be more than enough. The number of M you see in the bottom right of your screen will represent how much of this memory you have left (until you create a pupsave file it represents the remainder of RAM).

The reason for not taking up your whole drive is the use of SFS files. These are packages that are placed in the 'home' directory - /mnt/home - out of which puppy operates and allow multiple packages to be installed, such as the openoffice.sfs file seen here. The size of the /mnt/home directory is the remainder of the usb drive from whatever you chose as the size for your pupsave file. There is a readme.txt file in the directory linked to above which explains how to use the SFS files. If you have any problems let me know.

Next blog I'm going to go through my favorite programs and tweaks for this Puppy.

Oh yeah - Puppy is very easy to back up! Just copy the pupsave file to another directory on your desktop/laptop - it contains all your settings and installed programs!!


Wednesday, October 17, 2007

VNC over SSH with Ubuntu (or any other OS)

Virtual Network Computing (VNC) allows a user to access his or her desktop from a remote location. It is somewhat analogous to Remote Desktop Computing, available on Windows XP Pro, except that Remote Desktop uses Remote Desktop Protocol (RDP), an encrypted form of information exchange whereas VNC is not encrypted. VNC requires a server on the host machine, ie the desktop being controlled, and client software that is used to access the server. With Ubuntu, the server exists by default. To activate it, go to System->Preferences->Remote Desktop and choose Allow others to view your desktop and Allow others to control your desktop. Since you are going to be at a different location deselect Ask for your confirmation and then select a password to use and close.

To access this VNC server I use TightVNC. Just download the windows viewer, which is a portable executable, i.e. you can take the vncviewer.exe program and put it on a USB drive and it will run from there, or anywhere else independent of your privileges.

The default port to access your desktop is 5900. For information port forwarding and networking with virtual machines, check out my previous blog. It is my understanding that you cannot change the default port used by vino - Ubuntu's default vnc server.

To use VNC: from another computer running windows double click the vncviewer.exe. You can leave the defaults as they are; however, I like to change the default little cursor to an arrow. To do this click on options, then click on the globals tab then under Local cursor shape choose Normal arrow and then OK.

Now it is time to connect to your Ubuntu desktop! NOTE: This is for testing purposes only. VNC is not a secure method of communication, meaning there is no encryption of the data passing from the remote client to the host. Therefore any information passed between the two, such as passwords, could be easily available to some outside interception. This is the reason for using the SSH tunnel to be described next. To connect to your Ubuntu desktop enter it's IP address in the blank field, followed by a colon and then the chosen port. For information about how to find your IP address check out this blog. If you are within the same network as your Ubuntu machine then use the network address, otherwise use the outside address.

You should be presented with a screen asking you for your password, after which you should see your nice shiny remote desktop presented on your screen! The quality of the experience depends heavily on the speed of the connection. With a good network connection I can hardly tell the difference when I'm on my laptop remote computing to my desktop. Now close the vncviewer.

Now to make it secure. I describe setting up Openssh server on Ubuntu here. In order to access the server you need an SSH client. I prefer PortaPutty. This along with tightvnc make a nice little portable package. Open up portaputty and type in your Ubuntu's IP address and port, as well as a name for the session under Saved sessions.

In the left column expand the Connection tab, click on Data, and in the Auto-login username field enter the username you use to login to your Ubuntu OS.

Now expand the SSH tab and click on tunnels. In source port enter the port for your vnc server. In the Destination field enter the IP Address of the server, a colon, and the port of the vnc server then click Add. Make sure the local button is filled. The result should look like this:

Now go back to the Sessions screen and click on Save to save all of these settings with the name you chose. To activate this session just double click the saved name and you will be presented with a command line looking box. Your username will be presented and then you will be asked for your password:

Finally you will be presented with a command prompt. Now you have established a secure, encrypted SSH tunnel through which to pass the VNC session. With the SSH session open, activate vncviewer.exe, but instead of your computer's IP address enter 'localhost', colon, and the port through which you are tunneling.

You should be presented with the same password request as earlier and then your remote desktop. Now you are Virtually Computing securely via an encrypted SSH tunnel!

Sunday, October 14, 2007

Bummed Out Out Back

I've taken the plunge from the software to the hardware tinkering - beyond replacing disk drives and upping memory to trying out my first build! I've been buying all the parts over the last 6-8 months and the other day I finally got the motherboard - an msi P6N SLI. This weekend I took some precious hours here and there and got everything together and.... well the title says it all. Turned it on, lots of cool lights, all the fans and disks start whirring, and nothing on the screen. No beeps, no video, no easy way to tell what's going on.

So more hours spent trying to diagnose - even going so far as taking the board out and running it outside the case. The video card worked in another computer so it's looking like a DOA motherboard - I can't tell you how bad that sucks!!!! Most problems should at least generate a series of beeps, so unless it is the video card, which should cause a specific set of beeps, then I got screwed. From reading the reviews it's not totally uncommon for any board and frankly I'm not surprised I'm one of the unlucky ones - I tend to have to learn things the hard way which in the end is better. Like next time I'm hooking the board up before I even put it in the case.

In the mean time, while I wait for the next board, Puppy 3.0 is out and I'll be taking that for a spin. When I get everything working I'll list all the components I'm using.

Friday, October 5, 2007

My Favorite Ubuntu Tweaks and Programs

First, I like to enable auto-login, which makes startup faster and makes controlling the virtual machine from the command-line much easier. To do this go to System->Login Window and choose the security tab, then enable automatic logon for your username.

Next I enable remote desktop. System->Preferences->Remote Desktop and check 'Allow other users to view your desktop' and 'Allow other users to control your desktop' then uncheck 'Ask for your confirmation' and check 'Require the user to enter a password'. Make this password very strong!

The first program I install is related to remote desktop - openssh server. Now we get to use some command-line goodness. There are several ways to install programs in Ubuntu. Most places seem to emphasize the command-line method. Go to Applications->Accessories->Terminal. Now here is a little beginners trick I have found most useful - right click and choose 'Add this launcher to panel'. You should see an icon appear on the top bar. You only have to click this once to activate it and it is a handy place for the programs you use most often. Open the terminal and type:

sudo apt-get install openssh-server openssh-client

this will install openssh server just like I did with puppy and cygwin. Remember to change the port from 22 by either using port forwarding or editing sshd_config. To do this open a terminal and type:

sudo gedit /etc/ssh/sshd_config

which should bring up the document in a notepad like format. Change the line that says 'Port 22' to Port XXX, where XXX is a random number usually between 30000 and 60000. Remember to forward the port!
Next, restart openssh by typing

sudo /etc/init.d/ssh restart

At which point you should see

*Starting OPENBSD Secure Shell Server

Verify that the server is running by typing

ssh localhost -p XXX -l username

where username is the name you use to sign in. You should be prompted for your password and a message about verifying the correct address and then after choosing yes you should get a command prompt! Type exit to stop the ssh session.

Next blog will describe how to VNC (remote desktop) securely over SSH.

Another program is gnome-commander. Go here and download the one titled gnome-commander 1.2.3-1 edgy1. Though there is a newer version it does not seem to work. It is very fast for file transfers and I like the interface.

I also use Deluge for my bittorrent. I successfully used the instructions in this blog. Check out #5 and just copy and paste them into a terminal and watch the magic happen!

If you are going to get serious with your torrenting I would also suggest Moblock. It is a good security measure to take. The instructions can be a little esoteric. I stopped mine from autostarting at bootup.

Last but not least is GKrellM (follow the instructions in the first post), a nice little app which monitors system functions like cpu cycling and ethernet traffic. I really like being able to keep an eye on my cpu usage, and this does a great job.

Note: when editing source.list use the same command as for sshd_config from the terminal. Ubuntu will not let you edit important files without acknowledging yourself as the root user and initially using your password.

There are a lot of packages to choose from out there, just google and go! Let me know if you have any favorites...

Tuesday, October 2, 2007

Unix on Windows: Cygwin and OpenSSH Server

Cygwin is a fantastic set of Unix programs/scripts that run in a windows environment. I use it almost daily now, especially when doing any kind of remote computing via the openssh server that is available through the the cygwin setup. Below are four articles from Lifehacker that got me going on this powerful little toolbox. It is a great way to get familiar with command line usage in a unix environment from inside windows. You can navigate through your file system via command line and check yourself in the familiar windows GUI.
I'll be detailing my favorite uses for the openssh server later on. Check out these articles and get cygwin for yourself. You'll be glad you did!

Intro to Cygwin part 1, part 2 and part 3.

Now you can set up an ssh server just like on Puppy. I have it set up on Ubuntu, as well, which will be listed in my favorite programs and tweaks for Ubuntu, coming up next!

For an ssh server on Windows using OpenSSH through Cygwin check out this Lifehacker article: How To Setup A Home SSH Server.