Customizing Ubuntu Linux 1
After installing Ubuntu Linux on my MacBook I need to add more software and to fix a number of setups to make everything run smoothly. In this chapter I will describe the process to make this Linux installation perfect for my needs. I had much help from reading the book Ubuntu Hacks by Jonathan Oxer, Kyle Rankin and Bill Childers. Here is a link to the Unofficial Ubuntu 7.04 Starter Guide.
Look for help
There are many places where you can look for help when you have a problem with Ubuntu Linux. Here are some places:
Software packages
One of Ubuntu's key strengths is the quality of the software packages that are included in the main distribution. They have been relentlessly tested, and come together to form a rock-solid Linux distribution. Although the main Ubuntu distribution is integrated and very solid, that stability comes at a price. Many of the optional packages you may want have been excluded from the main distribution. There are several ways to download and install packages. The most common way is to use the command <apt-get>. The use of <apt-get> and other ways of managing packages are well described in the book Ubuntu Hacks (see Package Management).
To install a new package use the following command :
sudo apt-get install <package-name> or use the use the Synaptic package manager found in the menu: System->Administration->Synaptic Package Manager
Here is a list of packages I have added and a description of what they are for:
| Package | Description |
| build-essential | GNU C compiler gcc, g++, make
|
| libx11-dev | Makes it possible to run X11 applications
|
| libdb-4.1 | Needed by Xilinx Coregen
|
| alien | Convert rpm package to debian package
|
sun-java5-jre
| Latest version of Java from SUN
|
sun-java5-plugin
| Latest version of Java plugins
|
mdns-scan
| Browse Zeroconf services
|
avahi-discover
| Zeroconf support
|
avahi-utils
| Zeroconf support
|
libdb-4.1 is an old package not easily found. I downloaded the file libdb4.1-4.1.25-9mdk.i586.rpm and then used the program alien to convert the rpm package to a debian package using the command: sudo alien -c libdb4.1-4.1.25-9mdk.i586.rpm. To install the debian package I used the command: sudo dpkg -i libdb4.1-4.1.25-10_i386.deb.
To install the latest version of Java use the following command:
sudo apt-get install sun-java5-jre sun-java5-plugin
To install Limewire read Torrentfreak.
Other must-have tools and programs.
Ubuntu Linux comes standard with the gedit text editor. My favorite text editor for many years is nedit. To download nedit go to Nedit home page. Click the download tab and in the download page click stable binaries and download nedit-5.5-Linux-x86.tar.gz
Just found out about a new text editor called jEdit. It is written in Java and runs on Mac OS X, Linux, Unix and Windows. I am going to try it.
Portable Document Format (PDF) is an open file format created and controlled by Adobe Systems, for representing two-dimensional documents in a device independent and resolution independent fixed-layout document format.
Xpdf is an open source PDF viewer for the X Window System and Motif. Xpdf runs on practically any Unix-like operating system. To download Xpdf go to the Xpdf download page. Ubuntu comes with the Evince pdf reader installed.
Default shell
In Ubuntu the default shell for /bin/sh is dash. If you want to use bash in your script files use /bin/bash.
Keyboard mapping
The MacBook keyboard is setup to run Mac OS X and many keys are not defined the way Unix keyboards are setup. It is possible to map the keys any way you want and there is not one standard setup. I will show my setup and you can modify it to fit your needs. The xmodmap program is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user's session startup script to configure the keyboard according to personal tastes. To map a key to a symbol you have to find the keycode and the keysum. To every key you can map up to four different symbols. To map key "9" to the four symbols : 9 ) }] you use the following command:
keycode 18 = 9 parenright braceright bracketright
To find out the keycode for a key you can use the program xev. Start xev and click in the small window, then hit a key and you will see the keycode and keysum displayed. Put all the mapping commands in a file called .Xmodmap and place this file in your home directory. When you login next time you will be asked to include the .Xmodmap file. You can also setup the mapping by running the command: xmodmap ~/.Xmodmap. To see the current mapping execute : xmodmap -pk. The keysum names can be found in the file keysumdef.h. Remove XK_ before you use the name.
Here is my keyboard mapping for my MacBook (I have a Swedish keyboard):
| Keycode | Default | Shift | Alt | Alt shift
|
64 (Alt left)
| Mode_switch
|
|
|
|
113 (Alt right)
| Mode_switch
|
|
|
|
11
| 2
| quotedbl " | at @ |
|
| 12 | 3 | numbersign #
| asciitilde ~ | |
| 13 | 4 | EuroSign €
| dollar $
| |
17
| 8 | parenleft (
| bracketleft [
| braceleft {
|
18
| 9
| parenright )
| bracketright ]
| braceright }
|
35 (¨^)
| backslash
| bar |
|
|
|
This is what my .Xmodmap file will look like:
! Map left alt key as mode switch
keycode 64 = Mode_switch
! Map right alt key as mode switch
keycode 113 = Mode_switch
keycode 11 = 2 quotedbl at
keycode 12 = 3 numbersign asciitilde
keycode 13 = 4 EuroSign dollar
keycode 17 = 8 parenleft bracketleft braceleft
keycode 18 = 9 parenright bracketright braceright
keycode 35 = backslash bar
Changing screen resolution
In the latest release of Parallels Desktop (build 3150) this problems has been fixed. Parallels will now set the screen resolution to match the display connected.
When you boot Ubuntu Linux for the first time on your MacBook the maximum screen resolution is set to 1024x768. What happens if you connect an external display with a higher resolution. I have a 23 inch Cinema display (1920x1200) hooked up to my MacBook and without changing the resolution I can't use the fullscreen mode.
It is not possible to set the resolution higher than 1024x768 from the menu System->Preferences->Screen Resolution.
To change the maximum resolution you have to run the program:
sudo dpkg-reconfigure -phigh xserver-xorg. After starting the program a window will be displayed and ask you for a video card driver, leave the vesa marked and then hit Return. In the next window you can enter the video modes to be used . Go down using the arrow down key and when you reach the resolution you would like to use mark it with the space key and then hit Return. The setup will be written to the file /etc/X11/xorg.conf. Next time you boot Ubuntu Linux you will have the maximum resolution changed.
File sharing between Mac OS X and Ubuntu
Parallels has not implemented the same simple file sharing system they have for Windows in Parallels Desktop. But there is a good substitute which I will show you here, the SharePoints program. The SharePoints program lets you setup one or more shared folders in Mac OS X that can be accessed in Ubuntu Linux. Here is a short descriptions on how to use SharePoints to setup file sharing. But first we have to enable personal file sharing and Windows file sharing in the Mac OS system settings:

- In Mac OS X download and install the SharePoints program.
- Start the program.

- Select a folder to used as a shared folder. I used the Public folder.
- Give it a name (ParallelsDesktop)
- Enable both AppleFileServer sharing and Windows sharing.
- Set the permissions in the popup window

- Allow Windows guests and set inheritance of permissions if needed.
- You may have to set group permissions to r/w to allow writing files to Mac OS X.
- Save the setup.
- Start Ubuntu Linux and open the Networks Server window in the Places menu
- Hopefully you will see the shared folder (SVEN-KE-ANDERSS).
- If you are using VMware double-click the WIndows Network icon.
- Double-click to look inside and read or write files from/to this folder. Voila!

File sharing using secure shell (ssh)
Secure Shell or SSH is a set of standards and an associated network protocol that allows establishing a secure channel between a local and a remote computer.
The first thing we have to do on the Mac side is to enable remote login (fjärrinlogging) and to find the ip-address (1x.z.1.y). We should also add the .ssh directory in our home directory.

Here is good description on how to setup and use ssh. Let's follow it.
- Open a terminal in Ubuntu Linux
- Generate a new key. Use the command ssh-keygen -d
- Copy the key to the Mac OS X host using the secure copy cammand.
- scp ~/.ssh/id_dsa.pub 1x.z.1.y:.ssh/authorized_keys2
- We are now ready to test the ssh command: ssh -X 1x.z.1.y or use ssh -X userid@1x.z.1.y to connect to user <userid>.
- We are now remotely logging in to the Mac OS X host and can do almost anything, copying files, starting programs and much more. The DISPLAY variable is automatically set to display windows in the Ubuntu desktop.
- If you execute the command echo $DISPLAY you should see something like this: loacalhost:10.0. If the DISPLAY variable is not set read this link to learn what to do.
- To exit the ssh session use the command: exit or logout
Printing using an Airport Express
I use an Airport Express for wireless printing in Mac OS X. Apple uses a technique they call Bonjour to allow printing using a usb printer connected to their Airport wlan hub. Bonjour lets you create an instant network of computers and and smart devices just by getting them connected to each other. It uses something called Zeroconf or Zero Configuration Networking to setup everything.
To print from Ubuntu Linux to a USB printer connected to an Airport Express we will ignore the Zeroconf method and use the standard Common Unix Printing System (CUPS) instead. To use CUPS we first have to find the IP address of the Airport Express unit. When we open the Airport Utility program under Mac OS X and scan the network for Airport Extreme and Airport Express units, we will see the following display:
The IP address of the Airport Express is 10.0.1.200. When we have the IP address we can scan this address to find all open ports. The port scan function built into the Network Tools (System->Administration->Network Tools) utility didn't display all open ports so I decided to install nmap instead. I downloaded and installed nmap-4.20-1.i386.rpm and here is the print out from the program:
==> nmap 10.0.1.200
Starting Nmap 4.20 ( http://insecure.org ) at 2007-03-05 17:30 CET
Interesting ports on 10.0.1.200:
Not shown: 1693 closed ports
PORT STATE SERVICE
53/tcp open domain
5000/tcp open UPnP
9100/tcp open jetdirect
10000/tcp open snet-sensor-mgmt
Nmap finished: 1 IP address (1 host up) scanned in 22.035 seconds
The port 9100 is used for printing and it uses a HP jetdirect printer driver. We are now ready to setup for printing to my Epson Stylus Photo 870. To add a new printer open System->Administration->Printing. Double-click the New Printer icon and follow the instructions.

- Select Network Printer
- Select HP JetDirect
- Enter IP address of Airport Express or Airport Extreme where the printer is connected.
- Port number should be 9100
- Click Forward

- Select printer manufacturer
- Select printer model
- Select driver type
- Click Forward

- Enter printer name or use default name
- Enter descriptive text
- Enter printer location
- Click Apply
Select the Stylus-Photo-870 and make it the default printer (Edit->Make D