I don't feel qualified a how-to just yet: my situation is very specific, I'm pretty new to Linux, and I have fairly limited applications for my old computer. Secondly, you wouldn't really trust a how-to from a guy who couldn't get his sound card to work, right? (that's the only major problem I'm still having).
First: if this post is too long, I apologize. Please tell me where posts like this best belong, and I will refrain from putting them into existing threads in the future. Still new in these forums (and forums in general).
Premise/Basic Ideas
I was interested in configuring an old computer to do some basic computing, and I didn't want to load it down with Gnome or KDE. I also wanted to drop to the honest-to-god command line to play Infocom games via frotz, and to learn how to move files and carry out other basic functions without a gui.
My computer has two usb inputs, a standard old cdrom and a floppy, an ethernet card, a 733mhz pentium III processor, @900mb ram cannibalized from other sources, and a 20gb hard drive (as it turns out, it's larger than I recalled). It is used by a single person with a single login on a wired home network wherein all pcs connect to the interwebs via a single router.
Here is the sequence of steps I use to set up a box using Ubuntu 8.04 Command Line install and the IceWM window manager. My directions may skip steps or prove unnecessary, but they've worked for me. Comments and clarifications are welcomed.
First, install Ubuntu 8.04 as a command line system. Do this by (1) downloading the alternate install CD from Ubuntu/Canonical and burning it to disc via some other functional computer, (2) inserting it into your cdrom and booting from it, and (3) selecting the other options/alternate installation option (press f4 or some other function key at the install menu), selecting "install command-line system," and then (4) telling the disc to install ubuntu. The exact menus may differ slightly, but this provides the general idea. Installation itself is fairly straightforward, and proceeds via a text-based interface.
Once the installer brings you to the partitioning/formatting stage, you have the option to create an encrypted volume for installing your system, which is one of the advantages of the Alternate Install disc. If you do this, you will have to create a volume password, which you will be required to enter during the early stages of booting--each and every time you boot.
When asked by the installer, choose username and password. Choose the password carefully: you will use it frequently for performing tasks as the superuser (via sudo). For the purposes of this discussion, the login name and home directory name will be "billy".
Once the system is up and running, log in. You will find yourself at the command line, and ready to begin configuring your system.
1. Edit the GRUB menu to your tastes.
Personally, I like to bypass the GRUB menu entirely and get on with a verbose, normal boot. If you ever have to do a system recovery, you can simply boot from a live cd and change the GRUB menu file to allow you back in to do a recovery boot. Here's what I do with my GRUB menu.lst file:
Use the nano text editor to edit grub to remove loading pause & make boot verbose.
Code:
sudo nano /boot/grub/menu.lst
You'll be prompted to enter your password, as with all sudo commands. In first boot entry near the bottom of the file, find the first boot choice. It will look something like this:
Code:
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,0)
kernel /vmlinuz-2.6.24-16-generic root=/dev/mapper/CLIbuntu-root ro quiet splash
initrd /initrd.img-2.6.24-16-generic
quiet
copy the kernel line, paste it, and edit it to choice. (copy: meta+6. paste: ctrl+u). Remove all items around the boot entry such as "quiet" & "splash" so that the block ends up looking like this:
Code:
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,0)
kernel /vmlinuz-2.6.24-16-generic root=/dev/mapper/CLIbuntu-root ro
#kernel /vmlinuz-2.6.24-16-generic root=/dev/mapper/CLIbuntu-root ro quiet splash
initrd /initrd.img-2.6.24-16-generic
#quiet
Press ctrl+o to save, and exit nano.
2. Set computer to set numlock key, clear screen upon login, and prevent screen from blanking after a period of time.
Code:
sudo nano /home/billy/.bashrc
Just above the final "fi", enter the following two lines:
Code:
setleds +num
setterm -powersave off -blank 0
clear
Save and exit.
3. Prevent your computer from ever making a beeping noise.
Code:
sudo nano /etc/modprobe.d/blacklist
add the line
to the end of the file. Save and exit.
4. Edit /etc/fstab to mount a second, ext3 hard disk at startup. (If you're using an ntfs, fat16, fat32, or other format of hd, you'll need to research what kind of fstab entry you'll need.)
Code:
sudo nano /etc/fstab
Add this line at the end:
Code:
/dev/sdb1 /media/ext3hd ext3 users,rw,auto 0 0
Save and exit.
5. create mount directories for second hard drive and your flash drives (the latter of which we'll talk about soon):
Code:
cd /media
sudo mkdir ext3hd
sudo mkdir usbflash
6. install desired programs and packages (for me, these include graphic interface [xorg and icewm], productivity software [openoffice progs, abiword, mousepad, evince-gtk{pdf reader}], internet browsers [firefox, dillo], ftp software [filezilla], newsgroup reader [pan], a lightish file manager [thunar], a program to set numlock once I enter Icewm [numlockx], and some games [kq, cuyo, bastet]).
Code:
sudo apt-get install xorg numlockx frotz thunar abiword mousepad icewm dillo pan filezilla deluge-torrent kq cuyo bastet evince-gtk firefox xfce4-icon-theme tango-icon-theme openoffice.org openoffice.org-writer openoffice.org-calc openoffice.org-impress
7. (OPTIONAL) Install & Configure podencoder (a program for converting movies into .mp4 files for the video ipod) and its required programs.
Code:
sudo apt-get install lsdvd mplayer mencoder gpac zenity
put podencoder script (from
HTML Code:
http://diveintomark.org/public/2007/06/podencoder.txt
) file in home directory. See
HTML Code:
http://diveintomark.org/archives/2007/06/07/howto-batch-encode-video-for-ipod-under-linux-2007-edition
for an explanation.
Create .podencoderrc in home directory, containing these lines:
Code:
outputdir=/[absolute path for your chosen directory for the mp4 files]
scratchdir=/[absolute path for your chosen directory for the work product of podencoder]
Add this line as an alias, so that you can podencoder it up from any directory:
Code:
alias podencoder='/home/[username]/podencoder'
8. (OPTIONAL) Add aliases for graphic user interface and for manually updating the "locate" command's database. This will allow you to type either "gui" or "startx" to go into your x-session, or graphical user interface, which should now default to the IceWM window manager. (Aliases are essentially different, often shorter, names for specific commands that you specify. If you had a long, complicated command that you used frequently, such as "sudo farkle -t aiden.000015.337 anaheim -SHOE => dev null," you could create an alias for it called "farkle.aiden", or anything else that's reasonably specific. This would allow you to type "farkle.aiden" and run the whole, lengthy command.) Anyway,
Add these lines near the end where you find other commented aliases:
Code:
alias gui='startx'
alias refreshdb='sudo /etc/cron.daily/mlocate'
9. Update "locate" command so you can effectively use "locate" to find files later on.
Code:
sudo /etc/cron.daily/mlocate
[or, if you've restarted already and created the "updatedb" alias, just use the updatedb command from your previously created alias.]
10. (OPTIONAL) Set your icon themes for the Thunar file manager.
add these lines:
Code:
gtk-icon-theme-name = "Tango"
#gtk-icon-theme-name = "Rodent"
#gtk-icon-theme-name="Gnome"
[as always, the lines starting with "#" are not read: they are commented out ]
11. Configure icewm.
11.1 Correct Ubuntu 8.04's problems with the icewm themes (e.g., the window button graphics issues you may notice if you login) by dropping a themes folder saved from a running Ubuntu 7.10 (Gutsy Gibbon) icewm install into /usr/share/icewm (after deleting the existing "themes" folder). You can also just use the themes I've saved and modified. Download the tarball (tar archive) at my skydrive public folder
HTML Code:
http://cid-3fba8b9436b5548e.skydrive.live.com/browse.aspx/Public?lc=1033
. Decompress the tarball by using the "tar" program from the command line, or using "7zip" or another archiving program in windows. Assuming you're using your new system to get my themes, (1) get into IceWM by typing "startx" or "gui" from the command line. Then, (2) go to Firefox, enter the url I've provided, and download the TAR file. It should save to /home/billy/Desktop (and remember: "billy" will be replaced by your username). Then, (3) open a terminal in IceWM by either clicking on it from the start menu, or pressing meta+t (meta=WindowsKey for many keyboards). Once in the terminal, get to your Desktop folder by typing
Code:
cd /home/billy/Desktop
Now, (4) decompress the tar file by typing
Code:
tar xf icewm.themes.tar
Now, in the same terminal window, (5) get yourself into a superuser file manager by typing
Code:
sudo thunar /home/billy/Desktop
You will likely find yourself in your Desktop folder, looking at a "themes" folder and the file "icewm.themes.tar." You can (6) delete that tar file now. Next, (7) right-click on the "themes" folder and cut it (or select it and press ctrl+x) to cut it. Next, (8) navigate in the same file manager to /usr/share/icewm/, where you'll see a "themes" folder there. (9) Right-click it, delete the whole folder, and now (10) right-click in the empty space and (11) paste your new themes folder.
Voila. Repaired themes. Log out of IceWM, log back in, and select your theme from the start menu.
11.2 Correct/edit menus pertaining to existing programs and icewm behaviors.
I won't go into a great deal of detail here, because everyone has different preferences with respect to how they want their menus to be configured; but I will tell you that you'll need to poke around in and work with the following files until you learn how the menu structure, syntax, and configuration of IceWM work:
Code:
/etc/X11/icewm/menu
/etc/X11/icewm/toolbar
/usr/share/icewm/menu
/usr/share/icewm/toolbar
/usr/share/icewm/preferences
/usr/share/icewm/winoptions
One thing I would recommend specifically is attending to the following lines in the file /usr/share/icewm/preferences:
Code:
# Show programs submenu
ShowProgramsMenu=1 # 0/1
Because I list most of my menu items in /etc/X11/icewm/menu instead of under the "Programs" folder, I change this as follows:
Code:
# Show programs submenu
ShowProgramsMenu=0 # 0/1
That way, the programs menu doesn't even show.
For convenience, I have almost every program I use listed in /etc/X11/icewm/menu. You'll need to find out where your actual program files reside, and then use that info to make your menus.
IceWM menus are a little formidable initially in terms of structure, but familiarity comes along rather quickly after a while. You can create any number of menus and submenus with different programs underneath, and you can specify icons to use with each. For simplicity, I create a few menus, pertinent program entries, and NO ICONS. The basic syntax of a menu containing a program is as follows:
Code:
menu "Shoe-related Applications" folder {
prog shoe shoe.xpm /usr/bin/shoe
}
Here, the first line tells IceWM to create a menu called "Shoe-related Applications" which contains all of the programs listed between its brackets {}. Each program goes on a separate line.
The program entry on line 2 is broken down as follows: header (prog), title ("shoe"), icon image (shoe.xpm), and program location (/usr/bin/shoe).
If your program title consists of two or more words, put quotation marks around it. E.g., if my program was called shoe pie instead of shoe, line 2 above would read:
Code:
prog "shoe pie" shoe.xpm /usr/bin/shoe
With respect to icons: evidently, there is a line in /usr/share/icewm/preferences telling IceWm where to look for image files. Because I don't use icons in my menus, I don't list image files: I just put a dash (-), and no image appears. If you do choose to use images, I believe they need to be in the xpm format.
In any case, as an example, here is the exact output of my /etc/X11/icewm/menu file:
Code:
# This is an example for IceWM's menu definition file.
#
# Place your variants in /etc/X11/icewm or in $HOME/.icewm
# since modifications to this file will be discarded when you
# (re)install icewm.
#
prog Terminal - x-terminal-emulator -ls
prog Thunar - /usr/bin/thunar
menu Productivity folder {
prog "Openoffice Writer" - /usr/bin/oowriter
prog Abiword - /usr/bin/abiword
prog Mousepad - /usr/bin/mousepad
prog "Openoffice Spreadsheet" - /usr/bin/oocalc
prog "Openoffice Impress" - /usr/bin/ooimpress
prog "Evince PDF" - /usr/bin/evince
}
menu "Interwebs" folder {
prog Firefox - /usr/bin/firefox
prog Dillo - /usr/bin/dillo
prog Filezilla - /usr/bin/filezilla
}
menu "Games" folder {
prog Cuyo - /usr/games/cuyo
prog KQ - /usr/games/kq
}
menu "Utilities" folder {
prog Clock - /usr/bin/xclock
prog Calculator - /usr/bin/xcalc
}
menu "Removable Media" folder {
prog "Mount CD" - /home/billy/a/scripts/mount.cd.x
prog "Unmount CD" - /home/billy/a/scripts/umount.cd.x
prog "Mount Flash Drive" - /home/billy/a/scripts/mount.usb.x
prog "Unmount Flash Drive" - /home/billy/a/scripts/umount.usb.x
}
11.3 Configure files & settings to read data CDs and Flash Drives
You may note in the printout above that the "Removable Media" section contains items that seem to point to script files. That's exactly right. In order to mount and unmount CDs and usb flash drives, I decided to create simple scripts with menu links to do the work rather than installing other programs. (Actually, I didn't know of any other programs).
I actually work with cds and flash drives in IceWM and from the command line, so I'll talk about how that goes.
11.3.a Create Aliases for working with CDs and Flash Drives from the Command Line.
From a command line, edit your .bashrc file:
Add the following aliases where the other aliases are:
Code:
alias mount.cd='sudo mount /dev/cdrom'
alias umount.cd='sudo umount /dev/cdrom'
alias mount.usb='sudo mount -t vfat /dev/sdc1 /media/usbflash'
alias umount.usb='sudo umount /dev/sdc1'
Your cdrom should be configured to mount its contents into /media/cdrom , so you shouldn't have to fuss with this. For CDs, all you'll have to do now in the command line is type "mount.cd" and then navigate to /media/cdrom to get cd contents. When you're done, type "umount.cd", and the cd will be unmounted. I'm not entirely sure that sudo is necessary for mounting and unmounting cds, but I believe so. I tend to sudo everything as a habit, which is probably not good.
For your flash drive, you'll recall that we created the directory /media/usbflash earlier for this very purpose. Flash drives seem to require mounting by root, and thus the sudo. All the command "sudo mount -t vfat /dev/sdc1 /media/usbflash" means is "mount the vfat partition on /dev/sdc1 in the /media/usbflash folder, and do it as though I was the superuser" (or something like that). Be aware, here and below, that I only mount one flash drive at a time on this machine, and it always appears as /dev/sdc1. In order to see what volumes you've got running in your machine in order to identify your connected flash drive(s), you can type
and read the screen output. This will list your connected filesystems, mounted and unmounted (so far as I know).
Anyway, you now have aliases for easily mounting and unmounting cds and flash disks from the command line.
11.3.b Create scripts for mounting cds and usb flash from the start menu.
In my user folder (/home/billy), I always create an "a" directory to keep my files separate from the config files in the /home/billy folder, as I turn on the "show hidden files" feature in Thunar. I then create the folder "scripts" for holding script files. Using an editor (mousepad, nano, etc), I create four script files: one to mount cd, one to unmount cd, one to mount usb flash, and one to unmount usb flash. I then connect those to the start menu using the menu entries listed above, and have one-click mounting and unmounting capabilities.
Be advised that this method (1) requires you to allow these scripts to run as programs, and (2) that it requires some alterations to your /etc/sudoers file.
MESSING WITH YOUR /etc/sudoers FILE CAN BE DANGEROUS, SO PROCEED WITH EXTREME CAUTION.
First, create your script to mount cds. Mine is at /home/billy/a/scripts/mount.cd.x , and it reads as follows:
Code:
#!/bin/sh
mount /dev/cdrom
wait
thunar /media/cdrom
exit
This mounts the cd, waits for the mount, and then opens the thunar file manager to display the cd contents.
Next, create your script to unmount cds. Mine is at /home/billy/a/scripts/umount.cd.x ,and it reads as follows:
Code:
#!/bin/sh
umount /dev/cdrom
exit
Next, create your script to mount usb flash drives appearing at /dev/sdc1 (as all of mine do). Mine is at /home/billy/a/scripts/mount.usb.x, and it reads as follows:
Code:
#!/bin/sh
sudo mount -t vfat /dev/sdc1 /media/usbflash
wait
thunar /media/usbflash
exit
Finally, create your script to mount usb flash drives appearing at /dev/sdc1 (as all of mine do). Mine is at /home/billy/a/scripts/umount.usb.x, and it reads as follows:
Code:
#!/bin/sh
sudo umount /dev/sdc1
exit
Now, you will need to change the permissions on these scripts to allow them to run as programs. In thunar, navigate to /home/billy/a/scripts (or wherever you're keeping them), click on their properties, go to permissions, and check "allow this file to run as a program" for each file.
So far so good. Now, we have to circumvent a problem pertaining to the USB-related scripts.
You will note in each that a "sudo" is required. Unfortunately, when these scripts run as programs, there's no place to enter your password: the program simply hangs or exits without doing its job. Accordingly, we have to tell BASH that it's ok for the command involved to run as sudo without a password.
At this point, please be advised: I have no idea how dangerous or insecure the following instructions might prove. Since my PC is used by a single person and is on a secure network, it's a non-issue for me: but you may need to ask someone who knows more about file permissions before trying this. In fact, if anyone reading this in this thread has any insights on this point, please post them, as I'm curious as to how this modification could potentially be exploited.
The way I allow the script to run is to edit the /etc/sudoers file.
Code:
sudo mousepad /etc/sudoers
At the very end of the file, I type:
Code:
billy ALL = NOPASSWD: /bin/mount, /bin/umount
Here, of course, you would substitute your username for "billy". The "ALL" evidently tells the OS that it's OK for Billy to do this on any PC in its jurisdiction, and the "NOPASSWD: /bin/mount, bin/umount" line lets it know that if billy ever tries to run mount or umount as the superuser, it shouldn't require a password.
There it is. I hope the foregoing proves useful to some, and I look forward to hearing of alternate methods and other issues pertaining to IceWM on Ubuntu command line 8.04.
This post was written on the same machine I configured as described above.
--VoTMagn
Bookmarks