The Noob to Linux

A new OS experience

2009-06-29

Decoding and Encoding With MEncoder

I use the following to encode DVD to AVI and rencode to a smaller DVD.

#!/bin/bash

# Two pass encoding from DVD to AVI using MEncoder (NTSC). The following
# two pass method rips the first title (dvd://1) from the DVD. This
# method will NOT encode the subtitles so it pulls only the main title
# which usually is title 1. The following method encodes an AVI using
# XViD codecs and generally will compress the data down to < 4GB.

# Pass 1 (no crop)
mencoder dvd://1 -dvd-device /media/dvd -aid 128 -sws 9 -ovc xvid -xvidencopts pass=1:bitrate=1300:vhq=1:max_bframes=2:threads=2 -nosound -noodml -o /dev/null

#Pass 2 (no crop)
mencoder dvd://1 -dvd-device /media/dvd -aid 128 -sws 9 -ovc xvid -xvidencopts pass=2:bitrate=1300:vhq=1:max_bframes=2:threads=2 -oac copy -noodml -o "movie.avi"

# Once mencoder is finished a file called movie.avi will contain the
# first title. If there are multiple titles as is the case of episodes
# you would have to run the above for each title. Next use ffmpeg to
# convert movie.avi into a DVD (NTSC) compliant MPEG. Followed by
# dvdauthor to create a DVD file system and mkisofs to turn it into
# a burnable DVD ISO.


# Use ffmpeg to convert AVI to DVD compliant MPEG
ffmpeg -i movie.avi -target ntsc-dvd -sameq -aspect 16:9 -y movie.mpg

# Use dvdauthor to create the simple DVD filesystem
dvdauthor --title -o myDVD -f movie.mpg

# Use dvdauthor to create the TOC
dvdauthor -o myDVD -T

# Create an iso to burn
mkisofs -dvd-video -o myMovie.iso myDVD/

# Burn the iso using growisofs. Make sure there is a DVD in the DVD
# burner. Note that the DVD will most likely work only on progressive
# scan DVD players. To burn the dvd use the following
growisofs -dvd-compat -Z /dev/dvd=myMovie.iso

# Perform cleanup, leaving only the iso files or make changes to
# keep only the files you need by commenting out respective lines

# Removing MPEG files
rm movie.mpg

# Removing AVI files
rm movie.avi

# Removing DVD directory
rm -R myDVD

MEncoder, FFMPEG, and DVD

OK, so I have some instructional and other non-commercial video DVDs which I thought would be necessary to archive. As a n00b I set out to find any Linux tools which could help with extraction and compressions of DVD filesystems for archival purposes. Since I run GNOME in Debian I was introduced to DVD95, which I found odd as a recommendation because of it's very name. As I did some more research on DVD filesystems (thank you Wikipedia) I found out that most DVDs are written on two layers, just over 8GB, this being DVD 9 format, while single layer DVDs can hold around 4.3GB, that is DVD 5. DVD95 shrinks a DVD9 to DVD5,hence the name DVD95. However, this software wasn't on the Debian repositories so I decided to compile from source.

Installing DVD95 (v1.5p2)

Converts DVD9 (8.4GB) to DVD5 (4.7GB)

wget http://softlayer.dl.sourceforge.net/sourceforge/dvd95/dvd95-1.5p2.tar.gz
tar dvd95-1.5p2.tar.gz
cd dvd95-1.5p2
# As Root install development tools not available from original installation
aptitude install --with-recommends intltool libgnomeui-dev libdvdread-dev libmpeg2-4-dev
./configure
make
# As Root
make install

That was pretty much it. The only problem I had as is noted, was the lack of development libraries which were easy enough to get so ./configure could proceed. According to the INSTALL file for DVD95 it is possible to configure with specific flags, but I had no need for them. So far it's working great.

Debian Lenny on an old Dell Inspiron 1505E

It's been a while since I added anything here, but since there are only two people reading this blog it is not a big deal. Truth be told, I got sidetracked with other projects and I just didn't have the time to write anything.

A couple of months back I was having some trouble with Ubuntu Hardy on my old Dell Inspiron 1505E laptop in terms of performance. With the laptop finally showing its age I decided to go with Debian, first Etch but soon enough Lenny was released so I upgraded to it and installing some additional software and such. Obviously, whenever I ran into something unexpected I used google and the guides of others, all of which I bookmarked.

1. Upgraded linux headers and installed build essentials

aptitude update
aptitude safe-upgrade
aptitude install linux-headers-$(uname -r) build-essential

2. Installed firmware to make wireless card work

echo "User added - b43-fwcutter to make wifi work" | tee -a /etc/apt/sources.list
echo "deb http://http.us.debian.org/debian lenny main contrib" | tee -a /etc/apt/sources.list

Alternatively the debian package can be downloaded at http://http.us.debian.org/debian/pool/contrib/b/b43-fwcutter/b43-fwcutter_011-5_i386.deb

2. Installed firmware to make wireless card work

echo "User added - b43-fwcutter to make wifi work" | tee -a
/etc/apt/sources.li$
echo "deb http://http.us.debian.org/debian lenny main contrib" | tee -a
/etc/ap$

3. Removed system speeker (annoying beep)

rmmod pcspkr
echo "blacklist pcspkr" | tee -a /etc/modprobe.d/blacklist


3. Removed system speeker (annoying beep)

rmmod pcspkr
echo "blacklist pcspkr" | tee -a /etc/modprobe.d/blacklist

4. Installed debian multimedia from http://debian-multimedia.org/

a. Download the debian multimedia keyring package at http://www.debian-multimedia.org/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2008.10.16_all.deb
b. As root run

dpkg -i debian-multimedia-keyring_2008.10.16.deb

c. Add the repository to the sources file

echo "# Debian multimedia repository - don't 4get to download keyring first" | tee -a /etc/apt/sources.list
echo "deb http://www.debian-multimedia.org lenny main" | tee -a /etc/apt/sources.list
echo "deb-src http://debian-multimedia.org lenny main" | tee -a /etc/apt/sources.list

d. Update and upgrade

aptitude update && aptitude safe-upgrade

e. Installed the w32codecs and libdvdcss2 for DVD support

aptitude install w32codecs libdvdcss2

f. Installed flashplayer 10 for Mozilla

aptitude install flashplayer-mozilla

Then open firefox/iceweasel > Tools > Addos > Plugins > Rightclich
Shockwave Flash plugin > Disable. Then open a terminal as root

cp /usr/lib/flashplayer-mozilla/libflashplayer.so /usr/lib/mozilla/plugins/


5. Installed fonts and fixed desktop fonts

aptitude install ttf-mscorefonts-installer msttcorefonts ttf-liberation
dpkg-reconfigure fontconfig-config

In the dialog choose "Autohinter", "Automatic", and "No". Then

dpkg-reconfigure fontconfig

Logg off and re-logg in


6. Installed Icedove/Thunderbird email client

aptitude install icedove icedove-gnome-support


7. Installed Java6 by adding to repository list

echo "# Sun Java6" | tee -a /etc/apt/sources.list
echo "deb http://http.us.debian.org/debian lenny main non-free" | tee -a /etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get install sun-java6-bin sun-java6-fonts sun-java6-jdk sun-java6-jre sun-java6-plugin

8. Installing Google Toolbar

a. On the address bar: about:config. Right click on general.user.agent.extra.firefox. Change Iceweasel to Firefox.
b. Download Google Toolbar. Click cancel at the prompt to download new version of Firefox.

9. Installed Media codecs and media manipulation tools

aptitude install libtheora0 libtheora-bin libtheora-dev ffmpeg2theora gstreamer0.10-fluendo-mp3 gstreamer0.10-lame gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-dbg gstreamer0.10-plugins-good-dbg gstreamer0.10-plugins-ugly-dbg libgstreamer0.10-dev lame lame-extras libmp3lame-dev toolame sox libsox-fmt-all vorbis-tools mplayer mencoder transcode mjpegtools ffmpeg dvdauthor imagemagick dvd-slideshow jhead mpg321 mpg123

10. Installed OpenSSH client

aptitude install openssh-client openssh-blacklist

a. Setting up ssh on lenny client and ubuntu server

1. On the Server make sure you have installed the openssh-server. Also, modify the /etc/ssh/sshd_config file and change the following:
i. Change the port number to something other than 22
ii. Change the protocol type to 2
iii. Set PermitRootLogin to no
iv. Uncomment AuthorizedKyesFile %h/.ssh/authorized_keys
v. Restart the sshd server
2. On the client machine install the openssh-client. Modify the /etc/ssh/ssh_conf file
i. Uncomment Port and change from 22 to whatever is corresponded to the server
ii. Uncomment the Protocol 2,1
iii. As normal user do the following
a) ssh-keygen -t rsa # Generates the key. Enter the passphrase and accept the default locations
b) scp ~/.ssh/id_rsa.pub username@serverIP:/home/user/.ssh # Copies the public key file to the server and don't forget the colon after the IP
c) ssh user@serverIP # This loggs into the server
d) cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys # Copies the output of the public key file to the authorized keys file on the server
e) rm ~/.ssh/id_rsa.pub # Remove the public file (not necessary to do so)
f) chmod 700 ~/.ssh # Change folder permissions to very private
* File permissions are:
755 - general permissions
700 - extremely private data
500 - extremely private no write
775 - others can view and execute
750 - others view but nor write
777 - should not do, all access
600 - read and write to owner
* As such in octal notation:
0 --- no permission
1 --x execute
2 -w- write
3 -wx write and execute
4 r-- read
5 r-x read and execute
6 rw- read and write
7 rwx read, write, and execute
* Note: the order of file permissions is:
UGO = User, Group, Other
Example:
750 - User can read, write, and execute, Group can read and execute, and others have no access
g) chmod 600 ~/.ssh/authorized_keys
h) exit
3. Copying single files using scp (secure copy):
i. From client to server on servers home folder (don't forget the colon). To copy to another folder just add the full path to it (e.g. /home/user/documents)
scp file_from_client_to_server.txt user@serverIP:
ii. From server to client. Here you must specify the full path from server
scp user@serverIP:/home/user/documents/from_server_to_client.txt /home/client/documents
iii. To copy directories recursively use the -r switch:
* From server:
scp -r user@serverIP:/home/server_user/documents /home/client_user/
* From client
scp -r /home/client_user/documents user@serverIP:/home/server_user
4. Copying files using SFTp (secure file transfer protocol):
i. From client to server, make sure you cd to directory on client where files are located:
sftp > cd /home/server_user/documents
sftp > put file_from_client_to_Server.txt
sftp > mput *txt # copies all files non-recursively so no sub-directories will be copied. Use scp with the -r switch for that
ii. From server to client. Cd to directory on client where you want files to be copied to
sftp > cd /home/server_user/dcouments
sftp > mget *.txt

11. Installed mkisofs and cdrecord

aptitude install mkisofs cdrecord

12. Installed module-assistant and VirtualBox OSE

a. Module Assistant
aptitude install module-assistant

b. VirtualBox OSE

aptitude install virtualbox-ose virtualbox-ose-source virtualbox-ose-modules virtualbox-ose-modules-2.6-686 virtualbox-ose-modules-2.6.26-1-686
m-a prepare
m-a a-i virtualbox-ose
modprobe vboxdrv

c. Add unprivileged user to vritualbox

adduser yogi vboxusers

13. Installed GNU R for statistical computing

aptitude install r-base r-base-core r-base-core-dbg r-base-dev r-mathlib r-recommended

Additionally, installed the quantitative finance package which provides some tools for econometrics. For further information see http://cran.r-project.org/web/packages/AER/index.html and http://cran.r-project.org/web/views/Econometrics.html

aptitude install r-cran-rmetrics


14. Tools to convert RAW camera images

aptitude install dcraw ufraw gimp-dcraw libkdcraw-dev libkdcraw3

a. With DCRAW using verbose output:
dcraw -v image.nef
b. With UFRAW, using batch mode:
ufraw-batch --out-type=jpeg --out-path=/media/pictures/export --compression=85 --size=1280 /media/camera/pics/*.nef

15. Installed chkrootkit and rkhunter

aptitude install chkrootkit rkhunter

16. Setting up a simple firewall:

a. Create an iptables script (fw.start)and place it in /etc/network/if-up.d

#!/bin/bash

# Script name: fw.start
# Simple firewall ruleset for Debian
# Allows all outgoing connections - OUTPUT
# Denies all incoming connection - INPUT

echo "Starting iptables script /etc/network/if-up.d/fw.start"

# Clear IPTABLES
iptables -F
iptables -X
iptables -Z


# Local Loopback
################
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT


# Set Default Policies
######################
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP


# Accept All Related Connections
################################
iptables -A INPUT -i wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT


# Allow all OUT going connection
################################
iptables -A OUTPUT -o wlan0 -j ACCEPT
iptables -A OUTPUT -o eth1 -j ACCEPT


# DROP everything else
######################
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP
iptables -A OUTPUT -j LOG
iptables -A OUTPUT -j DROP

# SSH port - uncomment only if runnind ssh
iptables -I INPUT -p tcp --dport 41695 -j ACCEPT

# Block all incooming SMTP port connections - uncomment only if port is open
iptables -A INPUT -p tcp --dport 25 -j DROP

# EOF

b. Add the following (fw.start script) to /etc/network/interfaces:

post-up /etc/network/if-up.d/fw.start


17. Added second user

adduser user2
useradd user2
passwd user2
mkdir /home/user2
chown user2:users /home/user2

18. Added fluxbox

aptitude install fluxbox fbset fbpager fbdesk eterm

2008-12-19

Multiboot With Standalone GRUB

Yesterday I came to realize that I needed a simpler way to boot multiple OS-es on my laptop. My requirements were:

  1. Have an independent boot loader on the MBR
  2. Have a partition for swap
  3. Separate data partition for file storage
  4. Partitions for the multiple OS-es
To accomplish this task a simple menu file is created to chainload each respective OS. That way, should I decide to remove a distro, I could just reformat the drive and remove its entry on the main bootloader. Using an Ubuntu live CD, I accessed a terminal console and logged in as root.

First, I wrote zeros all over the drive to make sure there would be no conflicts or previous data read by the various partitions. Of course, I backed up any previous files I had. WARNING: this command will WIPE all the data on the drive!

ubuntu#: dd if=/dev/zero of=/dev/sda

Next I created a 512 byte MBR partition sector, again writing zeros for redundancy:

ubuntu#: dd if=/dev/zero of=/dev/sda bs=512 count=1

Next, I created the necessary partitions by accessing the fdisk utility:

ubuntu#: fdisk /dev/sda

For the first partition I allocated 1GB (1024M) of space to use as swap. The good thing about Linux is that you only need one of these which can be accessed by any distro installed:

  1. n to create a new partition
  2. p to make it a primary partition
  3. 1 to give it a designation number (as in /dev/sda1
  4. to accept beginning sector
  5. +1024M to set size and ending sector
  6. t to select partition type
  7. 1 to select the first partition
  8. 82 to designate it as Linux swap

Second, I created a small 100M partition for the boot loader:

  1. n to create a new partition
  2. p to make it a primary partition
  3. 2 to designate it as the second partition
  4. to accept beginning sector
  5. +100M to set size and ending sector

These first two partitions are primary partitions. The rest are going to be logical partitions, since you cannot have more than 4 primary partitions on a single drive. I want 4 partitions where I can install the OS-es and 1 partition to use as file storage:

  1. n to create a new partition
  2. e to make it an extended partition
  3. 3 to designate it as the third partition. This is just a container for the logical partitions. Also, logical partitions start from 5 and above
  4. to accept beginning sector
  5. to set size and ending sector of the rest of the drive.
  6. n to create a new partition
  7. l to make it a logical partition; it will be designated partition 5 (/dev/sda5)
  8. to accept the beginning sector
  9. +10240M to set the 10GB size
  10. n to create a new partition
  11. l to make it a logical partition
  12. 6 to designate it as the sixth drive
  13. +10240 to set the size of 10GB
  14. Do the same for partitions 7 and 8
  15. For partition 9 do steps 10, 11, and 12 (designate it as 9), but hit <> for beginning and ending sectors.
  16. Once done setting up the partitions, enter w to write changes to the MBR and make them permanent

Now that the partitions are set up it is time to install the OS-es. I chose:

  • Kubuntu 7.10 Gutsy
  • Kubuntu 8.10 Intrepid Ibex
  • Debian Etch
  • Slackware 12.2

With the exception of Debian which uses XFCE, the other three distros use KDE, which I must say looks sweet in its latest version 4.1.

The first thing to do is to get GRUB running. For this a live CD will do. Once the live CD is loaded, I copied the grub section from the boot section of the CD to the second partition, after formatting that partition.

kubuntu#: mkdir /mnt/sda2
kubuntu#: mount /dev/sda2 /mnt/sda2
kubuntu#: mkdir /mnt/sda2/boot
kubuntu#: mkdir /mnt/sda2/boot/grub
kubuntu#: mkfs -V -t ext3 /mnt/sda2
kubuntu#: find / -name stage1
kubuntu#: cp /usr/lib/grub/i386-pc/* /mnt/sda2/boot/grub
kubuntu#: grub
> root (hd0,1)
> setup (hd0)
> quit

After this it's time to create the custom GRUB menu file:

kubuntu#: nano /mnt/sda2/boot/grub/menu.lst
title
Kubuntu 7.10 Gutsy on /dev/sda5
root
(hd0,4)
chainloader +1
title
Kubuntu 8.10 Ibex on /dev/sda6
root (hd0,5)
chainloader +1
title Debian Etch on /dev/sda7
root (hd0,6)
chainloader +1
title Slackware 12.2 on /dev/sda8
root (hd0,7)
chainloader +1

Important: I had to make sure that during each installation I instructed the installer to install the boot loader on the root directory of the respective partitions and not on the MBR as it will override our above step. For (K)ubuntu go through the installation until the installer asks you if you're ready to install. Before doing so click Advanced, check install boot loader, and enter the GRUB location of the partition [e.g. for /dev/sda5 it's (hd0,4)]. Do the same for Debian and Slackware.



NOTE
: I got this how to from user saikee in justlinux.com forum.

2008-05-02

Image Magick Update

I couldn't find ImageMagick in the repositories, and the version I had was old:

$ convert --version

which returned ImageMagick-6.1.4

I downloaded ImageMagick 6.4.1 from their site and built it from source:

$ sudo tar -zxvf ImageMagick-6.4.1-0.tar.gz
$ cd ImageMagick-6.4.1
$ sudo ./configure
$ sudo make
$ sudo make install

and verfied installation:

$ /usr/local/bin/convert logo: logo.gif

This program is part of the requirement for dvd-slideshow.

DVD Creation

I have a bunch of mpeg-s I've been taking for some time, and in switching to linux I had no idea what to use. I've been searching around and the penultimate tools seems to be dvdauthor and it seems nearly every other tool to create video DVDs is based on dvdauthor. Alongside dvdauthor, a set of useful tools can be beneficial including Mjpeg Tools, FFMpeg, Toolame, Vrobistools, and Kino.

There are also tools out there that make it possible to create DVD slideshows such as dvd-slideshow. It's requirements are dvdauthor, Mjpegtools, ImageMagick, urw-fonts, ffmpeg, mkisofs, dvdrecord from dvdrtools, and the following codecs lame, oggdec, and toolame.

To preview and play the DVDs mplayer can be used, albeit a command line tool.

2008-04-10

Installed Anti-Virus, Firewall, and Rootkit Hunters

I decided to install an anti-virus for Linux since I use my flash drives on Windows systems as well. I am trying to be responsible and not spread any viruses. I chose Avast as I used it in Windows. To make the isntallation easy I chose the Debian package:

$ sudo dpkg -i avast4workstation_1.0.8-2_i386.deb

To start the program:

$ avastgui

or

ALT+F2 > avastgui

For the firewall and rootkit programs:

$ sudo aptitude update
$ sudo aptitude install chkrootkit rkhunter firestarter

Linux makes things too easy. I have no idea why so many people still stay away from it. I know what it is: fear of the command line.

2008-04-09

Got Wifi Working on My Desktop


I have a Linksys WUSB54G USB wireless adapter which I have been using for some time for my Windows PC. Lately installed Xubuntu 7.10 but I was having a rough time getting wireless to work. After some reseach I resolved the connectivity issue in just a short amount of time:

I downloaded the driver files from the Linksys site . I needed version 4, and after file extraction copied rt2500usb.inf and rt2500usb.sys to a local folder.

The next step was to blacklist the old driver.

$ sudo rmmod rt2500usb
$ sudo nano /etc/modprobe.d/blacklist

Added the following at the bottom of the file

# Blacklist old driver
blacklist rt2500usb

Installed the new driver with ndiswrapper and verified installation:

$ sudo ndiswrapper -i ~/tools/wifi/driver/rt2500usb.inf
$ sudo ndiswrapper -l

Installed the new module and made changes permanent:

$ sudo modprobe ndiswrapper
$sudo ndiswrapper -m

Added " ndiswrapper " (w/o quotes) to the bottom of the modules file

$ sudo nano /etc/modules

A quick check of iwconfig confirmed a wireless card. Afterward I edited the wpa_supplicant file, edited the /etc/network/interfaces file to add the new card and automate wpa_supplicant. The last step was the add dhclient to the begining of (and below the first line) /etc/init.d/rc.local file. A quick reboot put me in business. Hooray! I wonder if I'll ever get to use Windows on this PC. My wife might, so I'll leave it be.

2008-04-08

WUSB54G, Chmod,GRUB and a Brainfart

Ok, so I installed Xubuntu 7.10 on my 5 year old desktop yesterday and I was having a really hard time with internet connection. I only use wifi at home, with WPA2 encryption, but my usb wifi card, the infamous WUSB54G, was being a pain. To ge the card working I am using ndiswrapper and the rt2500 driver. Coincidentally, this driver, which is v4 for my card, comes with the Xubuntu installation. For whatever reason once I install the driver, it won't let me connect on system reboot, so I have to do it manually every time I reboot the system.

Later, I really had a brainfart. I had created a fourth partition for Linux files, but I didn't update permissions. I couldn't remember how to change read-write permissions, but after a little while all I had to do was:

$ sudo chmod -R 777 /media/hd6/whateverFolderorFile

where the -R option stood for recursive, as it pertains to folders, and 777 corresponds to chmod making the file writable.

To date, I haven't found a soultion to my wifi issue. Will check ubuntuforums and other linux forums to see if anyone has an idea about what's going on.

My first install of Xubuntu was problematic. Once I established internet connection and updated the repositories, I initiated a system update via Synaptic. Problem was, I received an error message indicating some files weren't installed properly. Rather than look at the log files, I rebooted the system without making a backup. On reboot, GRUB ingratiated me with an Error 15 / File not found message. After a long search online and a post on ubuntuforums.org , I found the problem: my initrd file was the one "missing." Good news was that a backup (.bak). This blog entry confirmed it, and all I had to do is look under /boot to figure out what the hell went wron. I used the initrd.bak to get in my system.

Cisco VPN Client on Linux

I was trying to connect to my network drive at UTA but I was unsuccessful. Yeah, I completely did not read the instructions at the IT department's website. It turns out, a VPN connection is needed when connecting to the student (or faculty) server off-campus. Taking a look at the instructions on that site, the VPN of choice was Cisco's VPN client (multi-platform). In order to download it from their site, you need a school ID, but one can find it elsewhere on the web, available vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz. Setting it up was trickier than I thought, and of course the college's IT instructions were a bit short in explanation. As is the case with anything regarding Linux, I found a great how-to on this wiki by Soft Ice. Based on the wiki, this is what I did:

I. Installation

1. Downloaded the vpnclient tarball from: http://www.govnet.state.vt.us/restricted/ciscovpnclient/

2. Checked the kernel sources are installed:

$ sudo ls /lib/modules/

3. Downloaded the kernel patch (my kernel is 2.6.22-xx):

$ sudo wget http://tuxx-home.at/projects/cisco-vpnclient/vpnclient-linux-2.6.22.diff

4. Extraced the tarball:

$ sudo tar -zxvf vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz

5. Applied the patch:

$ cd vpnclient
$ sudo patch -i ../vpnclient-linux-2.6.22.diff

6. Installed the vpn client:

$ sudo ./vpn_install

Accepted the default settings and moved on.

7. Confirmed vpnclient is installed:

$ ls /etc/opt

II. Configuration:

8. Started the vpnclient service:

$ sudo /etc/init.d/vpnclient_init start

9. Create a profile:

$ sudo nano /etc/opt/cisco-vpnclient/Profiles/mynewprofile.pcf

According to my college's IT department the minimum configuration of that file should be:

[main]
Host=vpn.uta.edu
AuthType=1
GroupName=default
GroupPwd=UTAsecret

10. Started the VPN session:

$ sudo vpnclient connect uta

where uta is the name of the .pcf file created under /etc/opt/
cisco-vpnclient/Profiles/mynewprofile.pcf


That was all there was to it.

2008-04-07

What To Do After Installing Ubuntu

I'm a student so for me the following work best:

1. Enable Additional Repositories:

system > admin > synaptic
settings > repositories


2. Add the medibuntu repositories:

$ sudo echo "deb http://packages.medibuntu.org/ gutsy free non-free" | sudo tee -a /etc/apt/sources.list

$ sudo wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update

3. Install audio, & video codecs:

$ sudo aptitude install gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly

$ sudo aptitude install mpg123 w32codecs libdvdcss2

4. Install media players:

$ sudo aptitude install amarok amarok-engine amarok-engines amarok-xine vlc vlc-plugin-arts vlc-plugin-esd vlc-plugin-ggi vlc-plugin-glide vlc-plugin-sdl vlc-plugin-svgalib mplayer mplayer-fonts mplayer-doc mplayer-nogui mplayer-skin mplayer-skin-blue mplayer-skins mplayerthumbs mencoder dvdauthor vcdimager mkisofs devede qdvdauthor qdvdauthor-db dvd+rw-tools dvd-slideshow ffmpeg ffmpeg2theora lame lame-extras k3b k9copy istanbul audacity avidemux wink gnash gnash-common gnash-cygnal gnash-tools swftools gs-common

5. Useful tools:

$ sudo aptitude install icedtea-java7-bin icedtea-java7-jdk icedtea-java7-jre icedtea-java7-plugin linuxdcpp acroread acroread-plugins acroread-escript kpdf pdfedit flashplugin-nonfree d4x d4x-common bittorrent bittorrent-gui amule amule-common amule-utils amule-utils-gui filezilla filezilla-common vpnc kvpnc p7zip p7zip-full unrar rar zip unzip chkrootkit rkhunter clamav clamav-base clamav-daemon clamav-data clamav-docs clamav-freshclam clamav-getfiles klamav mondo mondo-doc firestarter gkrellm gkrellm-bfm gkrellm-common gkrellm-hdplop gkrellm-i8k gkrellm-ibam gkrellmd gkrellmwho2 gkrellmwireless wine scite truecrypt easycrypt

6. Communication tools:

$ sudo aptitude install xchat xchat-common xchat-guile xchat-systray xchat-sys pidgin pidgin-plugin-pack thunderbird lightning lightning-extension sunbird

7. Graphics:

$ sudo aptitude install gimp gimp-data gimp-data-extras gimp-cbmplugs gimp-help gimp-help-common gimp-help-en gimp-refocus gimp-dcraw gimp-ufraw xpdf xpdf-common xpdf-reader xpdf-utils

8. Office:

$ sudo aptitude install openoffice.org openoffice.org-bundled openoffice.org-writer openoffice.org-calc openoffice.org-impress openoffice.org-draw openoffice.org-base openoffice.org-math openoffice.org-filter-binfilter openoffice.org-l10n-en-us openoffice.org-help-en-us openoffice.org-hyphenation-en openoffice.org-java openoffice.org-java-common openoffice.org-officebean openoffice.org-thesaurus-en-us openoffice.org-headless cupsys-bsd openclipart-openoffice.org gnucash gnucash-common gnucash-docs vym

9. Science and Math:

& sudo aptitude install gretl gretl-common gretl-data gretl-doc gnuplot gnuplot-doc gnuplot-nox gnuplot-x11 r-base r-base-core r-base-html r-base-acepack r-base-bayesm r-cran-cron r-cran-cluster r-cran-date r-cran-dbi r-cran-design r-cran-fbasics r-cran-fcalendar r-cran-fecofin r-cran-fextremes r-cran-fmultivar r-cran-foptions r-cran-fportfolio r-cran-fseries r-cran-foreign r-cran-lattice r-cran-latticextra r-cran-matchit r-cran-matrix r-cran-mcmcpack r-cran-misc3d r-cran-multcomp r-cran-mvtnorm r-cran-nlme r-cran-pscl r-cran-rcmdr r-cran-rpvm r-cran-rquantlib r-cran-strucchange r-cran-survival r-cran-tkrplot r-cran-tseries r-cran-xml r-doc-html r-doc-info r-doc-pdf r-mathlib r-recommended rkward speedcrunch
I did my best to spell out the commands as well as I could.

This post was inspired from the blog "Linux on Desktop" found at: http://linuxondesktop.blogspot.com/2007/02/13-things-to-do-immediately-after.html

2008-01-17

Using Fluxbox in Kubuntu

I couldn't resist installing Fluxbox on my laptop as part of my window manager options. I used Fluxbox previously when I was trying out Knoppix. Installation was easy, since I had almost all repositories checked:

$ sudo apt-get update
$ sudo apt-get install fluxbox

Once the installation was complete, all I had to do is try it out. Initially, the right click menu had no options available, but a quick menu update (while in KDM) took care of that:

$ sudo update-menus

Then I had to edit the Fluxbox menu:


$ sudo nano ~/.fluxbox/menu

which output the following:

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

Since I wanted to add Firefox the contents of my menu, I had to edit fluxbox-menu:

[submenu] (Internet) {}
[exec] (Firefox) {/usr/bin/firefox}
[end]

which I added under the Network submenu.

2008-01-08

Uh, How Annoying Thou Art Yee Ad Servers

Yep, whenever I visit a site I really get annoyed by those ads that are strewn
all over the damned page, so it seems. Instead of cursing my hardware and the
Internet gods, I decided to use a hosts file, rather than rely on my browser:

1) Copy the Ad Server list from:

http://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts.

There are many other sources out there, but i like this one.

2) Open and edit the hosts file:
$ sudo nano /etc/hosts

3) Paste it below the last line and save the file.

4) Reebot, and happy surfing.

Still, not every ad server is listed. If you run across one that is not on the
list simply add it to the hosts file. For a shared connection, such as the
one I have, it's a bandwidth saver. Besides, I don't like accidentally
clicking on a part of the page that sends me where I don't want to go.

Migrating from Windows to Linux

Yeeeey, I made the switch from Windows to Linux - Kubuntu 7.10 Gutsy to be
more exact. It was entirely an easy process. I decided to go with Kubuntu
because of the KDE desktop since I became familiar with it while toying with
Knoppix 5.1 Live CD. The following are my installation notes:

1. I backed up all the data that I had under the Win XP Home install to a few
DVDs. Then, using the installation disk I formatted the HDD (SCSI) using
Konsole, and prepared the MBR:

$ sudo dd if=/dev/zero of=/dev/sda bs=512 count=1

2. Using the "Install" option on the Desktop I created a SWAP partition of
1024MB and used the remainder to install the OS.

3. Amazingly enough, Kubuntu is very, very, very noob-friendly. It loads
almost all the drivers you need. The hardware I am using is a 3 year old Dell
Inspiron E1505 (6400), but the problem arose when I tried to connect to my
wireless home network. I needed to use the proprietary driver for my wifi
card. Kubuntu does have a few tools available, but ndiswrapper was not one of
them. I could use the aptitude tool but that requires internet connection to
download from the repositories, so I downloaded the following for manual
install: ndiswrapper, wpa_supplicant, wireless-tools, the wifi windows card
driver (bcmwl5.inf, bcmwl5.sys) - I transferred these to a USB flash drive.

4. Installing and configuring wireless:

a) Check and remove old driver from distro:
$ lsmod | grep bcm43xx
$ sudo modprobe -r bcm43xx
$ lsmod | grep bcm43xx

b) Check for ndiswrapper:
$ lsmod | grep ndiswrapper

c) To install files, build essentials are needed. Inserting the Kubuntu CD in
the drive:
$ sudo apt-get update
$ sudo apt-get install build-essential

d) Transferring ndiswrapper and windows driver to a directory under /home:
$ sudo cp /media/sdb1/ndiswrapper-1.51.tar.gz /home/Tools/Ndiswrapper
$ sudo cp /media/sdb1/WinDrivers/*.* /home/Tools/WinDrivers

e) Extracting ndiswrapper and install:
$ tar -zxvf ndiswrapper-1.51.tar.gz
$ cd ndiswrapper-1.51
$ sudo make uninstall
$ sudo make distclean
$ make
$ sudo make install
$ ndiswrapper -v

f) Installing the Windows drivers:
$ cd /
$ sudo ndiswrapper -i Tools/WinDrivers/bcmwl5.inf
$ ndiswrapper -l
$ ls /etc/ndiswrapper
$ sudo modprobe ndiswrapper

NOTE: If ndiswrapper does not load on startup, edit the /etc/modules file adding ndiswrapper:
$ sudo nano /etc/modules
Add the line "ndiswrapper" w/o quotes below the last module

g) Checking wireless configuration and bring up the card:
$ iwconfig
$ sudo ifconfig eth1 up

h) Since the home network is encrypted with WPA-AES I needed to use
wpa_supplicant to communicate with my AP. Luckily, Kubuntu 7.10 already comes
with wpa_supplicant. The WPA encryption is in HEX, so first:
$ sudo wpa_passphrase essid HOME willubethere4ever
Copy-paste the results and then:
$ sudo nano /etc/wpa_supplicant.conf
# Control interface - Do not change this line
ctrl_interface=/var/run/wpa_supplicant
# Allow only Root to read WPA Supplicant Config
ctrl_interface_group=0
# Allow wpa_supplicant to scan and select AP
ap_scan=1
# Begin detailing networks below
# Net1 - Associate with any open AP
network={
ssid=""
key_mgmt=NONE
}
# Net 2 - COFFEE SHOP Using simple WEP
network={
ssid="COFFESHOP"
key_mgmt=NONE
wep_tx_keyidx=0
wep_key0=6644565378
}
# Net 3 - HOME Using WPA AES with only CCMP
network={
ssid="HOME"
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
#psk="willubethere4ever"
psk=365342f8362524e1834abbd953edaf8979c4de38d7601fabb30a84d769953bb3
priority=2
}

i) Initiated wpa_supplicant and force IP :
$ sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i eth1 -D wext -B
$ dhclient eth1

j) Since eveything worked I made changes to ndiswrapper permanent:
$ sudo ndiswrapper -m

k) Time to blacklist the old driver:
$ sudo nano /etc/modprobe.d/blacklist
Adding as the last line:
# Blacklist old wireless driver
blacklist bcm43xx

l) I modified the network interface:
$ sudo nano /etc/network/interfaces
# Do not change this
auto lo
iface lo inet loopback

# Adding wireless card
auto eth1
iface eth1 inet dhcp

# Initiating wpa_supplicant on startup
pre-up wpa_supplicant -c /etc/wpa_supplicant.conf -i eth1 -D
wext -B

# Terminating wpa_supplicant on shutdown
post-down killall -q wpa_supplicant

m) Updating boot script to load dhclient and force IP association:
$ sudo nano /etc/init.d/rc.local
#! bin/sh
dhclient eth1
...

5) Time to reboot the system and get all the software and security updates
needed on boot.

That was it, and I couldn't believe how easy it was, relatively speaking.
Although it may seem like a lot of work, considering all the perceived
hassles one must go through, the upside to any Linux distro is the altering
perception on the noob since it allows you to learn and feel like you are in
control. Although Windows has similar capabilities, it must be said that most
of the time all things work easily, initially that is. Not to bring Windows
down, but I feel more in control with Linux - besides, I love to learn new
things.

2007-10-27

Knoppix Tips

From Knoppix for Dummies (for Knoppix 4). Some syntax has changed with the 5 realease:

No Subject
From:
Knoppix for Dummies
To:
Date:

1. Booting Knoppix DVD

At boot prompt hit "Enter"

If it doesn't boot (usually older BIOS) use: knoppix acpi=off noapic pnpbios=off pci=bios

2. Persistent Disk Image

Since Knoppix runs from RAM, all the changes made to the desktop will be gone once the system is rebooted. Knoppix provides a way to save the changes made to the hard drive or other storage media. The storage media has to be formated in FAT, FAT 32, VFAT, ext2, ext3, or ReiserFS:

K-Menu -> KNOPPIX -> Configure -> Create Persistent Disk Image

It will then ask the destination drivefrom there on.

3. Connecting to the Internet

3.1 Firewall Configuration

3.1.a First deny all traffic:

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

3.1.b Open the loopbak device (lo):

iptables -A OUTPUT -j ACCEPT -o lo
iptables -A INPUT -j ACCEPT -i lo

3.1.c Allow all outgoing communication:

iptables -A OUTPUT -m state --state NEW,RELATED, ESTABLISHED -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

3.1.d To allow secure shell (SSH) (not a good idea ) connections:

iptables -A INPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT --dport 22

3.1.e Save changes and set the firewall to turn on boot:

/etc/init.d/iptables save active
update -rc.d iptables defaults

3.1.f Manually starting a saved firewall:

/etc/init.d/iptables start
/etc/init.d/iptables restart

3.1.g Stopping an initiallized firewall:

/etc/init.d/iptables clear

4. Ndiswrapper and WPA_Supplicant

Once ndiswrapper is loaded and the wpa_supplicant.conf file configured you can initialize wpa_supplicant as

wpa_supplicant -D ndiswrapper -i wlan0 -c /etc/wpa_supplicant.conf -dd

where -dd is the debugging daemon mode. Alternatively you can run it in the background with the -B option

5 Cloning hard Drives

Cloning means to copy the files from the target drive bit by bit. Linux provides the dd-rescue program to perform this operation. This operation could take a very long time depending on the size of the disk. On Terminal:

5.1 To see the current disks in use:

df

5.2 To copy a windows NTFS partition, say to the USB disk use:

sudo dd-rescue if=/dev/hda1 of=/dev/sdb1 bd=512

To replace a new drive with the cloned one, reverse the above (i.e. from USB to HDD)

6. Anit-Virus and Drive Cleanup

6.1 Start Antivirus

sudo /etc/init.d/clamav-freshclam restart

6.1.a Update Antivir Database (must be connected to WWW)

sudo freashclam

6.2 Detecting Viruses

6.2.a Mount the target partition

mount /dev/sda2

6.2.b Scan the mounted partition

sudo clamscan /mnt/sda2

6.2.c Outputting only detected viruses

sudo clamscan /mnt/sda2/ | grep FOUND

6.2.d Send the virus detection results to a file

sudo clamscan /mnt/sda2>my.scan.results

6.3 Searching a single file or multiple ones

sudo clamscan help.doc

sudo clamscan *.doc

sudo myfile*

6.3.a Searching directories

sudo clamscan -r dir

Where -r conducts a recursive search and dir is the directory to be searched

6.4 Extracting the location of any infected files

grep FOUND my.scan.results

You can print the results directly

grep FOUND my.scan.results | lp

6.5 Removing Viruses under Windows

Boot into Windows safe mode with command prompt -> Administrator mode -> Delete each file using Windows del command:

del offending.file

Reboot computer

7 Removing Malware and Rootkits

To fix any intursion and rootkit issues in Linux run chkrootkit. This tool contains a good database of known root kit signatures, and it's often updated.

7.1 Run the current version of chkrootkit

sudo chkrootkit -r /dev/sda2

7.2 Download the latest version of chrootkit

7.2.a Go to www.chkrootkit.org/download -> Latest Source Tarball -> Save -> OK

7.2.b Check MD5 -> Open Terminal -> md5sum chkrootkit.tar.gz -> Number should match the one on the website

7.2.c Unpack the verified tarball

tar xzf chkrootkit.tar.gz

7.2.d Make sense and compile the chkrootkit plugins

make sense

7.3 Final Scanning

7.3.a Retrieve and install the latest version of chkrootkit (see online doc)

sudo chkrootkit-0.45/chkrootkit -r /dev/sda2

7.3.b Delete any files that are found

7.3.c Change all of your system passwords

sudo passwd root

8 Remastering Knoppix

8.1 Requirements

(1) Two CD/DVD Drives (The second one is required to burn the remastered disk). (2) Knoppix CD/DVD. (3) Minimum 15GB disk space (4) Writable Media

8.2 Meta View: The overall process

(1) Boot Knoppix and Create a Swap File - probably best to work from live CD, rather than permanent since there are no worries of deleting configuration files.
(2) Mount a Hard Drive partition - Need at least 16GB of HDD and a swap file for systems with less than 1GB RAM
(3) Create Knoppix source and target directory on HDD
(4) Configure the Knoppix source directory - Coppy the K noppix CD/DVD contents to the source directory
(5) Customize Knoppix
(6) Create an ISO image of the source/KNOPPIX directory in the Target directory
(7) Configure the Knoppix Target Directory
(8) Create ISO image of target directory
(9) Burn ISO image to CD/DVD

8.2 Booting Knoppix and getting strated

You want to boot in non-graphical mode (run level 2)

boot: knoppix 2

8.3 Create and mount a hard drive partition

Create space by repartitioning a drive or simply add another drive, IDE, SCSI, USB or otherwise.

Moun the partiotion

mount -o suid,dev /dev/sda2/ /mnt/sda2

8.4 Create directories

mkdir -p /mnt/sda2/knx/source/KNOPPIX
mkdir -p /mnt/sda2/knx/target/KNOPPIX

Configure the Knoppix Source Directories. This coppies the default Knoppix source file tree to the source directory

cp -Rp /KNOPPIX/ mnt/sda2/knx/source

8.5 Customize Knoppix

Here you modify the source directory you created previously. The following creates a simpler version of Knoppix, the basis of a server

(1) Change Linux's root directory to the Source directory

chroot /mnt/sda2/knx/source/KNOPPIX

(2) Create and mount the proc file systme

mount -t proc proc /proc

proc is a logical file system that interacts with the internal kernel structures. In our example we have to mount it to activate networking.

(3) Type the appropriate command to use a DNS for your network

If you use DHCP (automatically generated IP):

echo "nameserver 192.168.1.1" >> /etc/resolv.conf

If you don't use DHCP use:

echo "nameserver ip_address" >> /etc/resolv.conf

and substitute ip_address for whatever ip address you are provided

Since Knoppix is based on Debian you need to use Debian packages. To view the 20 latest packages:

dkpg-query -W --showformat='${Installed-Size} \ ${Package}\n' |sort -n |tail -20

You can use and select the packages you want

(4) Update your packages

apt-get update
apt-get upgrade

(5) Press enter when prompted on how to upgrade certain packages

(5.1) To remove any packages you don't want use

apt-get -y remove -purge package-name*

such as

apt-get -y remove -purge package-name \
apache* autofs* blue* cvs* emacs* gimp* hpijs* \
isdn* openoffice* samba* squid*

(5.2) To remove most of X windows system

apt-get remove --purge xfree86-common kde-base*

and all KDE dependencies

(5.3) Clean up after removing packages

apt-get remove 'deborphan'
deborphan | xargs apt-get remove

(6) Make it obvious you are running a customized version of KNOPPIX

touch /REMASTERED
echo "Welcome to My Knoppix Configuration" > /etc/issue

(7) Unmount the /proc file system

umount /proc

(8) Exit the chroot environment by entering exit

8.5 Configuring the Knoppix Target directory

The following shows hoe to create a cloop file which allows to include software on CD/DVD that normally requires much more space

(1) Copy the base Web page which automatically loads after booting Knoppix from the /cdrom file system to the Target directory

cp /cdrom/index.html /mnt/sda2/knx/target

(2) Copy all the files except the original KNOPPIX file from the /cdrom file system to the Target directory

cd /cdrom
find . -size -10000k -type f -exec cp -p --parents '{}' \ /mnt/sda2/knx/target/ \;

Explanation:
-The first (\) is a continuation mark
-The second (\) tells Bash to ignore the semicolon
-The find command's -size -10000k locates all the files smaller than 10MB
-The -type -f tells find to operate only on files, excluding directories, and soft links
-The -exec tells find to execute the subsequent text as a separate command.
-p preserves original file attributes
--parents tells cp to prepend the source directory path to the destination path
'{}' option is replaced by every file that find locates
/mnt/sda2/knx/target is the destination to copy the files to
\; tells find the cp command has stopped

(3) Make all the files on the target directory writable

chmod -R u+w /mnt/sda2/knx/target

(4) Remove the file containing the original Knoppix checksums

rm -f /mnt/sda2/knx/target/KNOPPIX/md5sums

(5) Create a new compressed KNOPPIX File

mkisofs -R -U -V "Knoppix remastered" \
-publisher "Knoppix Heavy Industries" \
-hide-rr-moved -cache-inodes -no-bak -pad \
/mnt/sda2/knx/source/KNOPPIX | \
nice -5 /usr/bin/create_compressed_fs - 65536 > \
/mnt/sda2/knx/target/KNOPPIX/KNOPPIX

Explanation: Here we are creating an ISO file from the source Knoppix directory, which isn't written but is streamed (piped) to the nice and create_compressed_fs utility. The last option creates a compressed file system, which in this case is the KNOPPIX file containing the compressed file system.

(6) Re-create the md5sums file

find /mnt/sda2/knx/target -type f \
-not -name md5sums \
-not -name boot.cat \
-not -name isolinux.bin \
-exec md5sums '{}' \; \
> /mnt/sda2/knx/target/KNOPPIX/md5sums

9 Create and ISO image

Create an ISO image of your customized Knoppix

(1) Change to the target directory

cd /mnt/sda2/knx/target

(2) Create the mastered ISO file

mkisofs -pad -l -r -v -V "KNOPPIX" \
-no-emul-boot -boot-load-size 4 \
-hide-rr-moved -boot-info-table \
-b boot/isolinux/isolinux.bin \
-c boot/isolinux/boot.cat \
-o /mnt/sda2/knx/myknoppix.iso \
/mnt/sda2/knx/target

10 Create a Bootable CD-ROM

(1) Insert CD-R/W into burner

(2) Show which device is the cd burner

cdrecord dev=ATAPI -scanbus

(3) Burn the remastered Knoppix ISO

cdrecord -v dev=0,0,0 myknoppix.iso

where 0,0,0 is the device number

10.1 Create a Bootable DVD-ROM

(1) Insert DVD

(2) Find DVD writer and write DVD

growisofs -dvd-compat -Z /dev/sdc=/mnt/sda2/knx/myknoppix.iso

2007-10-25

Student Expenses

It's bad enough we have to shell out vast quantities of money for our education, but imagine how much we, students, could save by using open source software. Below is an abbreviated table of the minimum software requirements just to provide some functionality:








































Windows XP Home 199.99
Office Home and Student 2007 149.98
MS Money 49.98
Microsoft Encarta 39.98
Adobe Photoshop CS3 299.98
Systat 12 279.98
McAfee Internet Security 59.98
Norton Student Backup 39.98
Total $1,119.85


Although the total reflects the total sum less student discount, one has to wonder why is it that colleges expect us to incur extra costs when we don't have to? I know, I know, people expect things to just work, but we attend college to learn something right? I've since migrated to Linux, and as an example, I am required to use MS Office and Systat 12. Of course, any office documents I produce are a result of Open Office, and I produce statistical models and graphs with R. All this costs me nothing, and since I am a nice guy I donate when I can. With an open mind and some elbow grease a student can take advantage of open source software to complement his/her education. After all, isn't computer literacy, above data entry, important in the job market?

Building from Source

My old desktop has an unsupported wireless pci card, and after some searching I found a windows driver that I can use via ndiswrapper. But Kubuntu 7.10 doesn't install ndiswrapper so I have to install from source. Hm, I never had to do that before, and after searching google I came across www.justlinux.com, an excellent site for newbies to Linux. They have some pretty good primers, as in the case of my current interest compiling software. The reason I have to do this is that my desktop is located in a room where I can't run CAT-5 cable easily, so wireless networking is the only answer. But the example they give at justlinux.com follows:


A Real Life Example

Now for a real life example. I downloaded a tarball called bar.tar.gz and saved it in /tmp.

Okay, so the tarball name is not real. But the procedure is. First I decide I want to install the files in /usr/local/programs/bar. So obviously, I will have to create the appropriate directories. Now I should mention that you do not need to be root to configure and build the software. However, you must be root when you are installing the software.

cd /tmp
tar xvzf bar.tar.gz
cd bar
./configure --prefix=/usr/local/programs/bar
make
make install

Now that my software is installed, I then edit my /etc/profile and append the following:

PATH=$PATH:/usr/local/programs/bar/bin
export PATH

Finally, I source my /etc/profile file and then I am ready to use my program. When I want to uninstall it, I can just run make uninstall, and if that does not work, I can just delete the subdirectory bar under /usr/local/programs.

2007-10-24

Ugh, boredom to no end

As I was listening to my professor drone on and on the Rules for Determining Whether Certain Obligations and Interests are Securities or Financial Assets (UCC 8-103) I decided I had enough. Thankfully, today I was late for class so I had to sit in the back row, so I fired up my laptop and began browsing the web, while my Olympus digital recorder kept a record of the professor's lecture. I was checking out reddit.com and digg.com but a lot of the articles and comments were making me laugh so much that I was worried I would disturb the class. There is something to be said about paranoia and the simply ridiculous reasons that motivate people to write the way they people who comment on those two sites do. Occasionally, I do come across some decent and well written articles or comments, which stand out rather clearly because of the prevalence of so much bad writing. But this is getting me off track.

Soon enough I got bored with reddit and digg, so I decided to play with Backtrack 2. Why not, the lecture was pretty boring too? The first step was to bring up my wireless card. As usual this is a point of some consternation for me, not induced by Linux, as my frustration is directed at the reasons behind manufacturer decisions not to support Linux and open source. Yeah, this is rather ironic seeing how I am sitting in Business Law I (see: § 1-103. Construction of [Uniform Commercial Code] to Promote its Purposes and Policies: Applicability of Supplemental Principles of Law. and Patent Law).

Anyways, since I have a Dell Inspiron E1505 (6400) laptop, I know that when the kernel loads it defaults the to the bcm43xx wireless driver. A quick check with lsmod | grep bcm43xx outputs the driver info. Before I do anything I need to find out if ndiswrapper installed so ndiswrapper -v returns the module and version number. Time to remove it so modprobe -r bcm43xx takes care of that, and a check with lsmod | grep bcm43xx returns no values. I already know that my wireless card uses a Broadcom driver and I already have saved the bcmwl5.inf and bcmwl5.sys in a folder called wireless. ls /mnt checks the mount points and cd /mnt/sda2/wireless changes location to the wireless folder so I can copy the files to root directory(~ i.e. tilde) as cp *.* ~. After changing back to root I installed the proprietary driver ndiswrapper -i ~/bcmwl5.inf and then I check to see if the driver is installed ndiswrapper -l. So I initiate the module modprobe ndiswrapper and then check to see if it is installed lsmod | grep ndiswrapper. iwconfig checks to see if my card is present and ifconfig wlan0 up brings up the card.

My college uses WEP encryption so I need to use WPA supplicant; checking to see if installed wpa_supplicant -v I get the module and version number. I already have a wpa_supplicant.conf file available with the network information in a folder on my drive, so I copy it to my /etc folder cp /mnt/sda2/Docs/wpa_supplicant.conf /etc/wpa_supplicant.conf. After that I invoked wpa_supplicant wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 -D wext -dd and wait for authentication.

Since my school uses DHCP I force the network to assign an IP to my card through dhcpcd wlan0. Now, I tried pump -i wlan0 and dhclient wlan0 since I used them in Knoppix and Ubuntu respectively which didn't work, but I remembered SLAX, hence dhcpcd. As dhcpcd didn't hang I pinged google.com and packets started streaming. Wifi is up and running.

But here's the stupid thing I did: I closed the terminal window, where I had wpa_supplicant running, so I had to kill all the processes associated with wifi using killall . Yeah, that was fun, and still I am unsure why I had to remove the drivers and start from scratch, but I have to google this.

All in all, this took me about 20 minutes and I am writing this while on Backtrack 2. Yet another thing got me thinking! How do I secure my computer and manage traffic in or out? In come Iptables after some goolging and running into a tutorial for iptables. Alas, time has run out. One thing that I needed to check was how to automatically reinitialize my wifi setup, but will have to check that out later, probably before reading on iptables. Then, using the aircrack tools it might be a good idea in auditing my home network and that WPA encryption I have on. Class is dismissed - gotta go.

The Economics of Linux and Free Software

Today, in a conversation with my Microeconomics professor on profit maximization I raised the question of Linux as a free alternative to Microsoft or Apple OS-es. Assuming a few things constant, such as demand for the products to be equal, it became clear that individual preferences are key as Linux, Windows, and Apple OS-es accomplish the same thing, albeit a few shortcomings. That is, in encouraging a consumer to move up or down the utility curve the OS has to cost less not only in monetary terms, but also in substitution value. Linux lacks the "plug-and-play" of many hardware specifically designed for Windows, but it allows greater flexibility in modifying the OS to your needs and perform various administrative actions with great modularity. In the case of Windows the OS costs quite a bit of money, it is not modular, and it is restrictive, yet for the consumer it is a familiar platform and requires a low learning curve to operate. The Apple OS on the other hand has a familiarity of use but upgrading the hardware is beyond the average consumer's abilities. Once could probably see the merits of predicting the consumer's preferences, say between Linux and Windows, in using game theory and the Nash Equilibrium. It might be interesting to revisit this topic at a later date.

2007-10-23

Kubuntu 7.10 Gutsy Gibbon

Alright, after trying Knoppix for a while, I decided I liked Linux enough to install the Kubuntu 7.10 Gutsy Gibbon distro on my old Windows 2000 machine. I must say, the installation was a pain, but that's because I messed up. First, during the installation I lost power, so I had to start all over again. But when I tried a reinstall (after manually formatting the drive via fdisk) my installation would fault at about 43%. I searched high and low, and after some time and a lot of frustration I found out that I had to fix the Master Boot Record (MBR) or simply delete it. This would fix my problems. Unfortunately, one option was to use fdisk /mbr which didn't help. Yet, the second option was to overwrite the MBR with a new one via dd if=/dev/zero of=/dev/hda bs=512 count=2. After, that everything went smoothly. My wireless card was recognized by the OS and the only thing I had to do was to set up wpa_supplicant. I used the package manager to download the software I use even under Windows as open source.

Another snag I hit was forcing dhcp to assign an IP to my card automatically. Under Knoppix I used pump -i wlan0, but for Kubuntu I needed dhclient wlan0 (coincidentally when I was using Backtrack 2.0 to asses my network encryption it required dhcpcd wlan0).

Using Backtrack though, dhcpcd kept hanging so I used killall and restart the module. Then, I closed the shell in which wpa_supplicant was running and away goes my network. Since I am no Linux whiz, I decided to start from scratch. I removed ndiswrapper and uninstalled the driver:
modprobe -r ndiswrapper
ndiswrapper -r bcmwl5

This way I could install the driver again. Phew!

2007-09-21

Dell Inspiron E1505, Knoppix LiveCD 5, and WiFi Setup

Ugh, Windows XP is getting annoying! I swear, the registry is a cluster f*** and my apps, including Firefox (hmmm?!) keep on crashing. I was getting ready to fling this laptop out of the window (pun intended) when I realized there are other OS-es out there that might lower my blood pressure, thus enter Knoppix!

So, inside my favorite coffee shop (Coffee Beanery, free wifi unlike Starubucks) and with a cup of coffee nearby I thought I'd check out this thing called Knoppix. Mind you, I am as green as can be when it comes to Linux, but after reading about the various distros, I was assured that Knoppix Live was one of the best choices for newbies out there. I have a Dell Inspiron E1505 (I6400) laptop with an Intel centrino (T1350) CPU running @ 1.86GHz, 512 MB RAM and about 25GB of HDD space. The rest of the hardware is generic Dell, assembly line kind of stuff. So nothing special here!

First things first, I downloaded Knoppix from Knoppix.org from one of the BitTorrent ftp sites. I chose the CD version, and obviously English because I don't speak a lick of German; besides I am just going to try this out.

After downloading the CD image (*.iso) I used InfraRecorder to burn the image on the CD and I used winMd5sum to check the integrity of the iso.

Since everything went well I booted the laptop with the Knoppix LiveCD in and it worked like a charm. Hell, I even loved the audible startup sequence! So I started browsing the desktop and so forth. Ooooh, it's pretty, and it looks so much cleaner than my Windows desktop. Don't get me wrong, I'm not throwing in the towel with Microsoft, I like using their software, and I have since a long, long time. But I like the idea of a free OS and being given the ability to tweak the system, even of only to learn something new. Anyways, soon enough I hit a snag: what the hell happened to my network connection?

I booted back into Windows and I logged on to the knoppix.net for some help, checking out the FAQ > Network. Yep, found out I had to get my card to behave under Linux. I won't get into the reasons why my card wasn't auto-detected by Knoppix, but here's how I resolved it, thanks primarily to the knoppix.net FAQ and a whole lot of googleing:

I boot Knoppix. I run konsole and after logging in as root su run iwconfig to check if what network cards/interfaces are available. But you may have to find out what kind wifi driver you have. In windows this can be done through the device manager.

In my case I have a Dell Inspiron (6400/E1505) laptop with a Dell 1390 minicard, driver located here. I'm only interested in the driver files themselves so I have to download the R151517.EXE and extract/install it to a temp folder I create. That's because I'm only interested in the bcmwl5.inf and bcmwl5.sys, which I'll save in a folder called wifidriver under c:\ .

Now it's time to get my wireless card to work.


  1. su - Login as root


  2. ls /mnt - Find out what drives are available

  3. mount -t ntfs /dev/sda1 -o ro,unmask=000 - Mounts the drive where c:\ is locate with read-only permission


  4. cd /media/sda1/wifidriver - change directory to the folder where the driver is located


  5. ls - List the files available in this folder. The bcmwl5.inf and bcmwl5.sys should appear



  6. cp *.* ~ - Copy the contents to the root directory


  7. cd ~ - Change to root directory


  8. ls - List files. The driver files we transferred should appear


  9. ndiswrapper -i ~/bcmwl5.inf - Here I'm using the ndiswrapper so I can use the windows driver.



  10. ndiswrapper -l - See if the driver is installed.


  11. modprobe ndiswrapper - Install the module, now wrapped with the windows driver


  12. lsmod | grep ndiswrapper - Check to see if installed


  13. iwconfig - Find out the network cards available. Mine shows uo as wlan0


  14. iwconfig wlan0 essid MySSIDName - I need to associate my wifi card with my network name


  15. I open up a new shell window; leave the first one open. I need to modify the wpa_supplicant.conf file because my network is encrypted (WPA-AES) so I complete the following steps:

    wpa_passphrase MyESSIDName MyPassword - This will return a network block needed to modify the wpa_supplicant.conf file. Leave this shell window open


  16. Open a third shell window:
    nano /etc/wpa_supplicant.conf - This will open an editor to let me configure the wpa_supplicant file


  17. I enter the following:

    • ctrl_interface=/var/run/wpa_supplicant


    • network={

      ssid="RMSG101"

      key_mgmt=WPA-PSK

      proto=WPA
      pairwise=CCMP NOTE: For AES use CCMP not TKIP

      group=CCMP

      #psk="MyPassword"
      psk=thehexadecimalrepresentationofmypassword from shell window 2

      }




  18. ifconfig wlan0 up - Bring up the wireless interface


  19. wpa_supplicant -c /etc/wpa_supplicant.conf wlan0 -D wext -dd - This will bring up the wpa_supplicant file to use the driver. I had to use wext here instead of ndiswrapper since it was giving me an error message.


  20. pump -i wlan0 - Force the AP to produce an IP



  21. ping www.google.com - Ping google. If it returns values, congratulations



So, that's pretty much it. I can configure the wpa_supplicant.conf file for multiple network blocks, depending on which one I need to use. Obviously, since Knoppix works off the RAM any changes to your network connection will be lost upon shutdown. Your configuration of the network and any other changes made to the desktop can be saved. For that you need a USB drive or you can save it on the hard drive:


  1. K menu > KNOPPIX > Save KNOPPIX configuration > specify where to save the file

  2. To boot Knoppix use:
    koppix config=/mnt/sda1 to boot from the hard drive

  3. Alternatively you can use:
    knoppix config=scan to scan all the available drives for the configuration file