bookmark_borderInstall and Configure Folding@home on Ubuntu Server

Folding@home is a distributed computing project started by Stanford University to help understand protein folding, misfolding, and related diseases. The project uses the idle processing resources of thousands of personal computers belonging to people that have installed the Folding@home software on their systems. In this post I will describe how to install and configure the Folding@home client software on Ubuntu server. All steps assume that the Apache http server on Ubuntu server is installed and operating correctly.

Software versions used in this post were as follows:

  • Ubuntu server 16.04.3 LTS
  • fahclient_7.4.4_amd64.deb

So let’s get started…

Download and Install

First, update your package list:

Then download and install the latest 64-bit version of the Debian-based Folding@home client to a location of your choice. In this example we’ll use the user’s home directory:

Note that fahclient_7.4.4_amd64.deb was the most current version of the client at the time this post was published. You may need to update the file name in this command in order to fetch the most recent version of the software.

Now lets install the client:

The installer will request you to enter a Folding@home donor name, team number, passkey (optional), whether the client should be automatically started at system boot, and how much of your system resources should be used (See Figures 1-5, repectively).

If you have an existing Folding@home donor name enter that name here, else enter a new donor name:

Screenshot showing the install message regarding the folding at home user name

Figure 1

If you’re joining an existing Folding@home team, enter that team number here, else simply enter 0 for no team:

Screenshot showing the install message regarding the folding at home team number

Figure 2

The Folding@home passkey is a unique identifier that ties your Folding@home contributions directly to you (not just those with your username). The passkey uniquely identifies you as an individual donor and is associated with the results that you have completed. If you have an Folding@home passkey and would like to use it enter it here. If you don’t have a passkey and would like one, you can request one from Folding@home. Else simply select “Ok” here to move to the next screen:

Screenshot showing the install message regarding the folding at home passkey

Figure 3

Choose whether or not you want the Folding@home client to startup automatically when the Ubuntu server boots:

Screenshot showing the install message regarding the folding at home start up

Figure 4

Finally, you can select how aggressively the client uses your system’s CPU resources:

Screenshot showing the install message regarding the folding at home resource use

Figure 5

The installer will finish and automatically start the Folding@home client. You can verify that the client is running using the following command:

You can now delete the installation Folding@home package fahclient_7.4.4_amd64.deb from your home directory, if desired.

Configure

Now that the Folding@home client has been installed it’s time to configure Web Control, Folding@home’s graphical interface. Web Control is the default control program for monitoring your Folding@home client via an easy to use web page.

First, stop your running Folding@home client:

Then use sudo and your favorite editor to append the following lines to /etc/fahclient/config.xml, which will grant access to the Web Control dashboard to a specific IP address. Unfortunately Web Control can only grant access to a single IP address. In this example we’ve chosen to grant access to the host with the IP address 192.168.10.100:

Finally, restart the Folding@home client:

You should now be able to access the Folding@home Web Control dash board at http://your-ubuntu-server-IP-address:7396/ (See Figure 6)

Screenshot showing the folding at home Web Control dashboard

Figure 6

Conclusion
There you have it. A few minutes of your time and you can easily have Folding@home up and running on your Ubuntu server. I think Folding@Home is a great cause and have created my own Folding@Home team to contribute some of my spare CPU cycles. How about you? If you have a few cycles to spare how about dedicating some to Folding@home’s efforts? You’re also welcome to join join my team. To join, simply enter the team number 78746 when you install folding@home.

References
https://en.wikipedia.org/wiki/Folding@home
https://foldingathome.org/support/

bookmark_borderHow To Access Your VirtualBox Guest VM From The Host Using SSH

(20180430 — The steps in this post were amended to address changes in recent versions of software — iceflatline)

Recently I had the occasion to spin up a Ubuntu server Virtual Machine (“VM”) in VirtualBox on a Windows-based host machine. Those of you who have performed a similar excercise know that the default window size that VirtualBox provides to command-line-based VMs, like *BSD and Ubuntu server, etc., is rather small, somewhere in neighborhood of the standard VGA resolution of 640 x 480 pixels. Normally the fix for this, of course, would be to install what VirtualBox calls “Guest Additions,” which consists of device drivers and other applications that optimize the guest operating system for, among other things, the ability to enlarge the window size. However, getting Guest Additions to install and run properly on command-line-based guest VMs is a monumental pain in the ass. One work-around that seems to work fairly well is to switch the VM window to “scale mode” (View->Switch to Scale Mode or Host+C), resulting in what is essentially a magnified version of the window and its contents. An even better solution, in my opinion, is to configure the VM so that you can connect to it directly from the host machine using Secure Shell (“SSH”), giving you full control over the window and text size of the guest VM.

This post explains how to access a VirtualBox Ubuntu server guest VM from the VirtualBox host machine using SSH. It then goes on to explain how to accomplish the same task when using a FreeBSD guest VM. The software versions used in this post were as follows:

  • FreeBSD 11.0-RELEASE
  • Ubuntu Server 18.04 LTS
  • VirtualBox 5.2.6

Let’s get started…

First, let’s add a new “VirtualBox Host-Only Ethernet Adapter” in VirtualBox. This new adaptor will allow us to enable a private network consisting of our host machine and our guest VM. The host can connect to any guest VMs configured to use this adaptor, and they can connect to each other, but nothing outside of this virtual network will be permitted access.

Navigate to Files->Preferences->Network and click on the “+” icon to add new adaptor. You’ll see that VirtualBox creates a new adaptor called “VirtualBox Host-Only Ethernet Adapter #2” (See Figure 1).

Screenshot showing the creation of a VirtualBox Host-Only Ethernet Adapter in VirtualBox

Figure 1

Right now you might be thinking “but couldn’t I just use the existing default VirtualBox Host-Only Ethernet Adaptor?” You absolutely could; however, setting up a second one allows you to customize it to your liking, leaving the default adaptor in its default configuration as a fallback.

Now, double-click the new adaptor (or highlight it and select the edit icon) and note the IP address and subnet mask (e.g., 192.168.135.1 and 255.255.255.0) that VirtualBox has arbitrarily assigned under the “Adapter” tab. You may change these network parameters if desired, however, it is preferable to retain “1” as the value of the last octet in the IP address (See Figure 2).

Screenshot showing the IP address and subnet mask assignment in the VirtualBox Host-Only Ethernet Adapter #2

Figure 2

Optionally, you may configure a DHCP server on the VirtualBox Host-Only Ethernet Adapter #2 so that the guest VM obtains an IP address automatically at boot time. This can be accomplished by navigating to Files->Preferences->Network, double-clicking the new adaptor (or highlighting it and selecting the edit icon), selecting the “DHCP Server” tab and the selecting “Enable Server”. You’ll then need to modify the various DHCP server parameters (e.g., Server Address, Server Mask, etc.), keeping in mind that they should encompass the IP address configured for the adaptor, else the IP address should be modified so that it lies within the DHCP server parameters you’ve configured. When finished, select “OK” (See Figure 3). Note: I typically forgo using the DHCP server, electing instead to use a static IP address. That way, I can consistently use the same address each time I want use SSH to connect to the guest VM.

Screenshot showing the DHCP server configuration tab in the VirtualBox Host-Only Ethernet Adapter #2

Figure 3

Let’s configure our Ubuntu server VM so that it will use the new VirtualBox Host-Only Ethernet Adapter #2. Shutdown the Ubuntu server VM if it’s running. Right-click on the VM and select Settings->Network. Select the “Adapter 2” tab, then select “Enable Network Adapter”. From among the options under “Attach to:”, select “Host-Only Adapter”, then select “VirtualBox Host-Only Ethernet Adapter #2” from among the options under “name:”. Now select “OK” (See Figure 4).

Screenshot showing the selection of VirtualBox Host-Only Ethernet Adapter #2 for use by the Ubuntu server virtual machine

Figure 4

Now start the Ubuntu server VM. After the system has fully booted, login to the VM at the VirtualBox console window and execute the command ifconfig -a to list all network devices. In addition to your primary network device, enp0s3 (in this example), you should now see a second network device listed, enp0s8 (in this example). If you chose to setup a DHCP server when creating VirtualBox Host-Only Ethernet Adapter #2, then enp0s8 should already have an IP address assigned to it from among the pool of addresses you chose to use with setting up the DHCP server, in which case you should make a note of this address and use it to connect to the Ubuntu server VM using SSH.

If you elected not to setup a DHCP server when creating VirtualBox Host-Only Ethernet Adapter #2, then you’ll need to assign a static IP address to network device enp0s8. First, install the package ifupdown:

Then open /etc/network/interfaces as the root user and add the following lines, making sure to change the values shown in this example so that they fall within the IP subnet parameters chosen when creating the new VirtualBox Host-Only Ethernet Adapter #2:

Now start the interface so that it obtains the new network parameters:

At this point you should be able to connect to the Ubuntu server VM via SSH using this static IP address.

FreeBSD Guest VM

A similar approach can be taken for a FreeBSD guest VM. The setup and configuration of the VirtualBox Host-Only Ethernet Adapter in VirtualBox is identical to what has been described thus far for the Ubuntu server VM. However, in order to assign a static IP address to the new network interface, em1 in the case of FreeBSD, you’ll need to open /etc/rc.conf as the root user and add the following line, making sure to change the values shown in this example so that they fall within the IP subnet parameters chosen when creating the new VirtualBox Host-Only Ethernet Adapter #2:

Then restart the interface so that it obtains the new network parameters:

Conclusion

The default window size that VirtualBox provides to command-line-based guest VMs like BSD and Ubuntu servers is typically very small, resulting in a poor user experience for those administrators trying to perform work beyond just a few quick simple commands. Fortunately, VirtualBox can be configured so that the user can connect directly to a guest VM from the host machine using SSH, giving the user full control over window and text sizing.

bookmark_bordercron Howto

(20170327 — The steps in this post were amended to address changes in recent versions of software — iceflatline)

cron is a time-based job scheduler in BSD, Linux and other Unix-like operating systems. It is commonly used to schedule system maintenance or administrative tasks, however it can also be used by system users to schedule their own tasks.

Tasks scheduled to run from cron are typically referred to as “cron jobs.” A “crontab” (cron table) is a configuration file which contains one or more “cron job” entries (i.e., commands and/or scripts to be run at specified dates and/or times.

This post will discuss the use of cron in FreeBSD and Ubuntu server, including the location of cron-related files. The software versions used in this post were as follows:

  • FreeBSD 11.0 RELEASE
  • Ubuntu 16.04.2 LTS

Using cron

There are several different ways to use cron. In the /etc directory in many Linux distributions, for example, you’ll likely find some sub-directories called cron.hourly, cron.daily, cron.weekly, and cron.monthly. If you place a command into one of those directories it will be run hourly, daily, weekly or monthly, respectively. If you require more granularity, you can add cron job entires directly to the system-wide crontab file /etc/crontab. Editing this file directly however is usually discourage as it can be overwritten when the system is upgraded.

A second type of system-wide crontab can often be found in /etc/cron.d/. Within this directory are small named crontabs. The directory is often used by packages, however system users can also place a file here containing cron jobs. The file must share the same name as the user so that the system knows which user is to be associated with the commands contained within it.

Perhaps a better solution though is to create your own crontab. User crontabs allow individual users to schedule tasks without the need for root privileges. Each user can have their own crontab, and cron jobs in a users’ crontab run with the permissions of the user who creates the crontab. Although the system-wide crontab /etc/crontab is usually associated with root, the root user can also have an independent crontab just like any other user. When created, user crontab files are saved in various locations under /var. These files are not intended to be edited directly, however, but rather by using the crontab command. Here’s the crontab command’s basic syntax:

-u – Specifies the name of the user whose crontab is to be created or edited. If this option is not given, crontab examines “your” crontab; i.e., the crontab of the person executing the crontab command.

-l – Displays the contents of the crontab file.

-r – Removes the current crontab file.

-e – Creates a new crontab file (or edits an exiting one) using the users default command line editor specified in the environment variables. After you successfully save and exit from the editor, the modified crontab file will be installed automatically. Note that if you are running the crontab -e command inside of su you will create or edit the crontab file of the root user. Likewise if you use the command sudo crontab -e.

Each line in a crontab file contains seven fields from left to right:

Minute – Any integer from 0 to 59.

Hour – Any integer from 0 to 23.

Day – Any integer from 1 to 31 (must be a valid day if a month is specified).

Month – Any integer from 1 to 12, or the abbreviated form of the month; e.g., jan, feb, etc.

Day of week – Any integer from 0 to 7, where 0 or 7 represents Sunday, or the abbreviated name of the week; e.g, sun, mon, etc.

User – Specifies the user under which the cron jobs are run

Command – the command to execute (the command can either be a command or the name of a script containing one or more commands)

There are also several ways of specifying multiple values in a field:

  • Using a comma specifies a list of values, for example: 1,3,4,7,8. Using a hyphen specifies a range of values, for example: 1-6, which is equivalent to 1,2,3,4,5,6.
  • Using an asterisk specifies all possible values for a field; e.g., every hour or every day.
  • The forward slash can be used to skip a given number of values. For example, “*”/3 in the hour field is equivalent to the hours 0,3,6,9,12,15,18,21. The “*” specifies “every hour” but the “/3” means that only the first, fourth, seventh,…etc hours starting at midnight are used.

Here’s some example cron job entries using the rsync command. As you can see, you could add one or many cron job entries to your crontab depending on your needs:

cron will email to the user all output of the commands it runs. To silence this, the output can be redirected to a log file or to /dev/null. Note also that individual users’ crontab files (i.e., those edited via crontab -e, sudo crontab -e or under su for root’s), omit the user field since the system understands that crontab file belongs to the user. The /etc/crontab and the files in /etc/cron.d and /etc/cron.{hourly, daily, weekly, monthly}, however, do require a field for the user.

cron in FreeBSD

  • cron daemon: /usr/sbin/cron
  • cron start script: /etc/rc.d/cron
  • crontab command: /usr/bin/crontab
  • System-wide crontab files: /etc/crontab
  • crontab file location created using crontab -e (The crontab file name = the user name): /var/cron/tabs/
  • Log location: /var/log/cron

cron in Ubuntu server

  • cron daemon: /usr/sbin/cron
  • cron start script: /etc/init.d/cron
  • crontab binary: /usr/bin/crontab
  • System-wide crontab files: /etc/crontab and /etc/cron.d
  • Other crontab locations: /etc/cron.{hourly, daily, weekly, monthly}
  • crontab file location created using crontab -e (The crontab file name = the user name): /var/spool/cron/crontabs/
  • Log location /var/log/syslog

Conclusion

Um… cron… ’nuff said.

References

http://ss64.com/bash/cron.html

http://www.freebsd.org/doc/handbook/configtuning-cron.html

http://www.marksanborn.net/linux/learning-cron-by-example/

https://help.ubuntu.com/community/CronHowto

bookmark_borderInstall and Configure Ubuntu Linux on the Lenovo T410 Laptop

Title: Install and Configure Ubuntu Linux on the Lenovo T410 Laptop
Keywords: install, configure, ubuntu, lucid, lynx, 10.04, LTS, lenovo, t410, t-series, laptop
Description: The post descibes how to install Ubuntu on the Lenovo T410 laptop, the challenges that were encountered, and how those challenges were overcome.
Categories: linux
Tags: Hardware Linux ubuntu
Related:
Install and Configure CrunchBang Linux on the Lenovo T410 Laptop
My Conky Configuration
How to Dual Boot Windows 7 and Linux using BCDEdit

I recently purchased a Lenovo ThinkPad T410 laptop. This post will describe how I installed and configured Ubuntu Desktop Edition version 10.04 LTS – Long Term Support (32-bit) for use on this machine, the challenges that I encountered, and how those challenges were overcome.

Following are the specifications for the laptop I purchased:

  • Windows 7 Professional (x64)
  • Intel Core i7-620M processor (2.66 GHz)
  • Elpida RAM 4MB (1066 MHz)
  • Seagate 300GB HDD (7200 RPM)
  • Intel 82577LM Gigabit Ethernet adapter
  • 11b/g/n wireless LAN Mini-PCI Express Adapter II
  • NVIDIA NVS 3100m Graphics Adapter

For those of you who may still be contemplating the purchase this laptop, you may want to consider carefully the wireless adapter choices offered by Lenovo. While the Lenovo 11b/g/n wireless adapter (Realtek is the OEM) is supported in Ubuntu 10.04, that was not the case when using many other Linux distributions on this laptop, which required me to compile and install a driver from Realtek. If you plan on using other Linux distributions on this laptop, I would recommend you consider purchasing the machine with the Intel Centrino-based adapter option instead. This adapter is supported in Ubuntu 10.04 as well as many other distributions.

In addition, if you choose to purchase the laptop with the Nvidia graphics option, be aware that Ubuntu 10.04 utilizes an in-kernel graphics driver known as “Nouveau” for this GPU. This driver generally works well, however its performance in 3D-based games or desktop effects that require hardware graphics acceleration is limited. I prefer to use the proprietary Nvidia driver; and with some configuration I am quite happy with its reliability and performance. Understandably though some users may not want to use proprietary software.

Installation

Among my goals when purchasing the T410 was to be able to dual-boot between Windows 7 and various Linux distributions or *BSD. The following steps describe how I reduced the size of Windows 7 and partitioned the remaining space in order to install Ubuntu. The Window 7 Boot Configuration Data Editor (BCDEdit) was used to configure the Windows 7 bootloader to display a menu at boot time that allowed me to choose between Windows 7 and Ubuntu. If you’re not interested in preserving your existing Windows 7 install, or plan to install Ubuntu on a virtual machine application such as QEMU or VirtualBox then simply skip these steps and proceed with installing Ubuntu directly to the physical or virtual disk.

While I’ve never encountered a situation where the following steps destroyed existing disk data, you should make sure you backup any files you feel are critical before proceeding.

    Reducing the Windows 7 Partition

The first thing that I needed to do was reduce the size of the Windows 7 partition. I found Windows 7’s own Disk Management tool to be the most efficient method for accomplishing this task. The Disk Management tool can be accessed by using Win+r and entering diskmgmt.msc. I right-clicked on the Windows 7 partition (C:) and selected “Shrink Volume.” Then I entered the amount of space (in Megabytes) that the partition should shrink (which in turn becomes the amount of space available to install Ubuntu), then selected “Shrink” (See Figure 1). Ubuntu Desktop Edition needs a minimum of 15 Gigabytes (GB) of free disk space. I chose 26 GB (26000 MB), in which I will create a 20 GB partition for Ubuntu, a 1 GB partition for Linux swap, and a 5 GB FAT32 partition that will be used to share files between Ubuntu and Windows 7. Then I exited out of the Disk Management tool and rebooted the system, eventually arriving at the Windows 7 logon screen. Along the way I saw Windows perform a disk check – that’s normal, and only occurred once as a result of this procedure.

Screenshot showing the Windows partition reduced using the Windows Disk Management tool

Figure 1
    Partitioning for Ubuntu

To partition the newly created free disk space, I downloaded the latest stable release of GParted Live and burned it to a CD, then boot the system using the GParted disk. After accepting the default settings for keymap, language, and X-window configuration, I arrived at the GParted desktop (See Figure 2).

Screenshot of the GParted desktop

Figure 2

I could see the 26 GB of free disk space that I created currently labeled as unallocated. The hard drive is limited to four primary partitions, so in this unallocated space I created a new extended partition by left-clicking on this space to highlight it, then selecting “New” to create a new partition. I made this partition an Extended Partition, then selected “Add” (See Figure 3).

Screenshot showing the creation of a new Extended Partition in GParted

Figure 3

Once the new extended partition was created, I left-clicked on its unallocated space to highlight it and then selected “New” to create a new partition. I made this partition a Logical Partition and the file system ext4. I reduced the size of this partition to ~20 GB by moving the slider to the left until I reached the desired size (alternatively you can do this by typing in the value in the New Size field) then selected “Add” (See Figure 4).

Screenshot showing the creation of a new Logical Partition in GParted

Figure 4

In the remaining unallocated space, I created two additional logical partitions following the steps above. One was a linux-swap file system and sized to ~1 GB, the second was a FAT32 file system consuming all remaining unallocated space. When completed, I had a partition layout that resembled Figure 5.

Screenshot of new Ubuntu partition layout created using GParted

Figure 5

After review the newly created partition layout, I selected “Apply All Operations” and GParted proceeded with writing the changes to the disk. After a few minutes I could see the re-partitioned drive (See Figure 6).

Screenshot of New Ubuntu Partitions with Device Names Assigned by GParted

Figure 6

GParted retained the device designations /dev/sda1, /dev/sda2, and /dev/sda4 for Windows 7 but had now also assigned the appropriate device designations to each of my newly minted extended and logical partitions:

/dev/sda3 – (Extended partition)
/dev/sda5 – ext4 (Logical partition)
/dev/sda6 – Linux-Swap (Logical partition)
/dev/sda7 – FAT32 (Logical partition)

I exited out of GParted and reboot the system, confirming that I could see the FAT32 partition that I had created (E:) in Windows 7.

    Installing Ubuntu

To install Ubuntu on to the partitions I created using GParted, I downloaded a copy of Ubuntu and burned it to a CD, then boot the system using the Ubuntu disk. I double-clicked the “Install Ubuntu 10.04 LTS” button to get started, and continued through the installation process until I arrived at “Prepare disk space.” I then selected “Specify partitions manually (advanced)” to advance to the “Prepare partitions” screen (See Figure 7). This is where I instructed Ubuntu which mount points and file systems to use on the partitions I had created.

Screenshot of the Ubuntu partition preparation screen

Figure 7

I left-clicked to highlight /dev/sda5 and then selected “Change.” On the pop-up screen I selected the ext4 file system and the checkbox instructing Ubuntu to format the partition. Device /dev/sda5 will serve as the root partition for Ubuntu so I set the mount point to / from the list of choices in the drop-down menu, then selected “Okay” to accept the changes (See Figure 8).

Screenshot of the Ubuntu prepare partition screen

Figure 8

Following similar steps, I moved set the mount point for /dev/sda6 to linux-swap. There was no need to format this partition. The FAT32 partition located at /dev/sda7 was left alone for the moment. I will add this partition to /etc/fstab in a later step so that Ubuntu will automatically mount it at boot time. After doing a final review, I selected “Forward” to continue. I then worked through the “Who are you?” and “Migrate documents and settings” screens until arriving at the “Ready to install” screen (See Figure 9).

Screenshot of the Ubuntu confirm partition screen

Figure 9

Ubuntu needs to be told where to install its bootloader GRUB. It should NOT be installed on /dev/sda, as that would overwrite the hard drive’s Master Boot Record, nor should it be installed on /dev/sda1, as that is used for the Windows 7 bootmanager files and boot configuration data. Instead, GRUB should be installed on partition that will contain the Ubuntu operating system – in my case /dev/sda5. To do this, I left-clicked on the tab that says “Advanced.” This brought up a pop-up screen where I could specify a location for the GRUB bootloader installation (See Figure 10).

Screenshot of the Ubuntu bootloader install screen

Figure 10

After making sure the checkbox for installing the bootloader was checked, I chose /dev/sda5 from the drop-down list as the device for the GRUB bootloader installation, then selected “Okay” to continue with the Ubuntu installation. When the installation completed I was asked to reboot the system where I once again arrived at the Windows 7 logon screen.

    Configuring for Dual Boot

With the partitions created and Ubuntu installed, it was time to set up the system so that it could boot to Windows 7 or Ubuntu. This involves copying the Master Boot Record of the Ubuntu boot partition to a file and copying that file to Windows 7, then using Window 7’s BCDEdit utility to create a new entry in its BCD store that will point to that file. Windows 7 will then display a menu at boot time that will provides a choice between Windows 7 and Ubuntu.

I once again booted the system using the GParted disk, then opened a terminal and made a mount point:

I mounted the device containing the FAT32 partition to this mount point:

Using the venerable dd command, I wrote the first 512 bytes of the Ubuntu boot partition to a file and copied that file to the FAT32 partition:

Then I exited GParted and reboot to Windows 7. I opened my FAT32 partition (E:) where I found the ubuntu.bin file, and moved that file to the root of the my Windows 7 partition (C:). Next I used BCDEdit to add an entry to Windows 7’s BCD store. Administrative privileges are required to use BCDEdit, so I navigated to Start->All Programs->Accessories, right-clicked on Command Prompt and selected “Run as administrator.” Alternatively you can open the run box using Win+r, enter cmd and then use Ctrl+Shift+Enter. First, I created an menu entry for Ubuntu:

BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next I specified which windows partition hosts a copy of the ubuntu.bin file:

The path to the ubuntu.bin file:

An entry to the displayed menu at boot time:

How long Windows 7 should display the menu:

That’s it. I rebooted and was presented with a menu where I can choose to boot to Windows 7 or Ubuntu. When I choose Ubuntu, I’m taken to the GRUB menu where I can choose to continue booting to Ubuntu or return to the previous menu.

On a final note, if at any time you want to eliminate the Ubuntu menu option simply delete the BCD store entry you created using the following command:

Configuration

    Establish an Internet Connection

After booting to Ubuntu for the first time the it was time to establish an Internet connection. Using the T410’s Ethernet port presented no problems, and its 11b/g/n wireless adapter is supported by Ubuntu so establishing a wireless connection was as simple as left-clicking on the Network Manager applet icon on the right side of the top desktop panel and selecting my access point (See Figure 11). I entered my “WPA and WPA2 Personal” passphrase and was connected to the Internet within a few seconds.

Screenshot of a wireless connection using the Network Manager in Ubuntu

Figure 11
    Update Software Packages

With an Internet connection established it was time to ensure that Ubuntu contained the most recent updates to its software packages. I frequently install packages from Canonical’s “Parter” repository, so before downloading and installing any updates I opened the file /etc/apt/sources.list and uncommented the following two lines:

This ensures that third-party software will be available for download and installation and that any software installed from this repository will receive subsequent updates. With that out of the way, I proceeded with updating the local package index and upgrading Ubuntu’s existing software packages:

    Install and Configure New Terminal Emulator

While the Gnome terminal that Ubuntu defaults to is just fine, I had the occasion recently to use Xubuntu, a Ubuntu derivative that uses the Xfce desktop environment. I really fell in love with Terminal, Xubuntu’s default lightweight terminal emulator. Most importantly though, it doesn’t bore me to tears looking at it all the time. Terminal emulators are like your significant other – you have to be with them all the time so you might as well get the one you want (See Figure 12):

Once installed Terminal is available by navigating to Applications->Accessories. To make it my default terminal emulator, I opened System->Preferences->Preferred Applications and selected the “System” tab. From the drop-down list I selected “Custom” then entered xfce4-terminal in the Command field.

The default geometry for Terminal is 80 columns by 24 lines (80×24), however I prefer a few more lines. To adjust the geometry I opened Terminal’s configuration file ~/.config/Terminal/terminalrc and changed MiscDefaultGeometry=80×24 to MiscDefaultGeometry=80×32.

To make the terminal window slightly transparent I opened Edit->Preferences in Terminal, selected the Appearance tab, then selected “Transparent background” from the drop-down list under Background. Finally, I set the default transparency to 0.90 using the Transparency slider bar. I also wanted the ability to make the window more transparent as desired without having to open the terminal preferences each time. To accomplish this I first installed the utility compizconfig settings manager:

Then opened the utility by navigating to System->Preferences->CompizConfig Settings Manager and selected the checkbox next to Opacity, Brightness and Saturation under the Accessibility category. Now I can increase and decrease the transparency of Terminal (or any other window for that matter) by holding the Alt key and using the scroll wheel on my mouse.

Screenshot of the Xfce terminal

Figure 12
    Configure the Bash Shell

I spend a lot of time at the terminal when using Linux so I configured BASH (“Bourne Again Shell”), Ubuntu’s default shell, so that it contained my favorite aliases and other tweaks. When you start a terminal session in Ubuntu, Bash will read commands from ~/.bashrc. You can add your own command aliases and other changes directly to ~/.bashrc, or simply uncomment and modify some or all of the ones that are provided as examples in that file if desired. The approach that I prefer, however, is to create a separate file containing these modifications, then simply point to that file from within ~/.bashrc. This approach allows me to easily port these changes from one system to another:

Then I opened this file and added my aliases and other tweaks. Here’s an example of my ~/.bash_aliases file:

Then opened it ~/.bashrc and uncommented the following lines:

I used the following command to have Bash immediately recognize my aliases and other tweaks:

    Partition Mounting and Permissions

While Ubuntu successfully detected my Windows 7 partition at /dev/sda2 it did not automatically mount it. What Ubuntu does in these circumstances instead is to make the partition visible in “Places” but not actual mount it anywhere until it is selected, then it chooses a random name and mounts it at /media. Because I use the terminal a lot this behavior is less than desirable as the partition must be selected in “Places” before it is available from the command line. To ensure that Ubuntu mounts this partition as well as the FAT32 partition at boot time with the correct directory and file permissions automatically, I created two mount points in /media:

Then added the following lines to /etc/fstab:

    Install the Nvidia Driver

I purchased my T410 with the Nvidia graphics option. Ubuntu’s nouveau driver is the default driver for this GPU and it works quite well with this laptop, correctly identifying the native resolution of its display as 1440*900 (16:10) and presenting the Ubuntu desktop appropriately. However, I did not want to be without really good hardware graphics acceleration so I installed the Nvidia driver. This was accomplished by navigating to System->Administration->Hardware Drivers, and starting a small utility which located the most current Nvidia driver within a few seconds. I selected “Activate” and the utility downloaded and installed the driver. When the installation was complete I rebooted the laptop, where once again was presented with the correct desktop resolution. Once the Nvidia driver is installed you will still be able to adjust your display settings using the native Gnome tool (System->Preferences->Monitors), however it will now ask if you “…you want to use your graphics driver vendor’s tool instead?” Selecting “Yes” will activate Nvidia’s tool instead. You can access this tool directly by navigating to System->Administration->Nvidia X Server Settings or by using the command nvidia-settings from a terminal.

      Fix screen brightness control

After installing the Nvidia driver I noticed that the keyboard function keys for adjusting the screen brightness no longer worked. The fix for this was to open the file /etc/X11/xorg.conf and add the following line to the “Device” section:

    Configure Printing

Printing has come a long way in Linux and the Ubuntu distribution is no exception. My T410 is typically connected to one of two printers most of the time: a Canon i560 Ink Jet connected via USB when at work, or a HP CM1312nfi Laser Jet when at home. Ubuntu instantly recognized the i560 when I connected it via USB with no further configuration necessary to meet my needs. Setting up the HP printer was nearly as seamless; although, because it is a network printer, it required a bit more configuration. I can manage both printers by navigating to System->Administration->Printing, and have even more control by pointing my web browser to http://127.0.0.1:631 to use CUPS (the “Common Unix Print System”) settings.

    Configure E-mail

Ubuntu comes with Evolution, a “groupware suite” featuring, among other things, contact, calendar and e-mail applications for Linux systems. I’ll be blunt though – Evolution is a piece of shit. The only reason one would choose to use it is if a) they didn’t realize there were alternatives out there, or b) they need an e-mail client that will work with Microsoft’s Exchange Server 2003 or 2007 and those servers are not supporting the POP or IMAP protocols. I, unfortunately, fall into the latter category. My current employer uses Exchange Server 2007 and has elected not to turn on support for POP or IMAP. Unfortunately, out of the box, Evolution does not work with Exchange 2007 under these conditions. Why? Because Exchange Server uses a proprietary RPC protocol, MAPI (“Messaging Application Programming Interface”), that was designed to be used by the Microsoft Outlook client. Fortunately there is a work around for this problem. The Evolution MAPI plugin has been developed by the open source community that will allow Evolution to communicate with an Exchange 2007 server using MAPI. However, Evolution performance using this plugin vary. In my case, for example, while I can send and receive e-mail more or less reliably, the calendar and contacts functionality do not work at all:

After the plugin was installed, I took T410 to work and attached it to the network. I initiated Evolution’s setup assistant by navigating to Applications->Office->Evolution Mail and Calendar. When I reached the “Receiving E-mail” screen, I selected “Exchange MAPI” from the list of choices in the drop-down list under Server Type and entered the Exchange server’s host name, my Exchange user name, and the name of the domain where the Exchange server was located under Configuration, then selected “Authenticate” (See Figure 13). I entered my account password and after a few minutes received the message “Authentication finished successfully.”

Screenshot of the Evolution mail setup assistant

Figure 13

If you’re connecting to Exchange Server 2003, and POP or IMAP support is not supported, then you should chose “Microsoft Exchange” instead of Exchange MAPI in the drop-down list. Confirm your Exchange account name is correct and enter the Outlook Web App (OWA) url for the Exchange server, then select “Authenticate.” If you’re lucky enough to have either of IMAP or POP activated in the Exchange server you’re connecting to then you can use just about any e-mail client (including Evolution) as most will support these protocols.

      Install and configure a VPN client

With Evolution up and running (more or less), I needed a Virtual Private Network (“VPN”) client that could connect to the Cisco VPN concentrator used by my employer so I could use Ubuntu/Evolution from home or the road. I chose vpnc, a Cisco-compatible VPN client that creates a IPSec-like connection as a tunneling network device. It runs entirely in userspace and does not require kernel modules except the use of the tun driver:

Created a configuration file:

Then added the following lines to this file:

To activate vpnc:

To disconnect vpnc:

    Configure Firefox

Firefox is the default web browser in Ubuntu Desktop Edition 10.04. Following are configuration changes I made to improve its usability.

      Install a Flash plugin

Out of the box Firefox lacks support for Adobe’s Flash technology. This can be fixed by installing either Adobe’s own proprietary Flash plugin or one of the open source variations like Gnash or Swfdec. I chose to install Adobe’s Flash plugin:

      Install a Java plugin

Ubuntu also lacks support for Oracle’s Java technology. This too was easily fixed by installing either Sun’s Java plugin or an open source variation like IcedTea. I chose to install Oracle’s Java plugin.

You can verify the Flash and Java plugins were successfully installed by entering about:plugins the Firefox address bar.

      Make the backspace key work

Oddly, the backspace key in Firefox does not cause the browser to go back to the previous page as it does in under Windows. To fix that I entered about:config in the address bar, entered browser.backspace_action in the Filter field, double-clicked on its value and changed it from 2 to 0, then restarted Firefox.

      Force last tab to close

The default behavior in Firefox prevents the user from closing the last open tab without also closing the browser. This behavior drove me crazy. To fix that I opened about:config, entered browser.tabs.closeWindowWithLastTab in the Filter field, double-clicked on its value and changed it from “true” to “false,” then restarted Firefox.

      Avoid the Favicons

Favicons are those small icons made available by web sites that are displayed in front of their respective bookmark and tab in Firefox. To save on some disk space and speed up browsing, I prevented Firefox from loading these icons. To do this I opened about:config and modified the following parameters:

browser.chrome.favicons set to “false”
browser.chrome.image_icons.max_size set to 0
browser.chrome.site_icon set to “false”

      Eliminate the new tab button

Firefox features a small green “+” symbol adjacent to the tab(s) that provides the ability for the user to open a new tab by clicking on it. This is a widget I don’t use. To eliminate it, as well as some others, I created a userChrome.css file (your default Firefox profile directory will be different than the op9v3zvx.default directory shown in following command):

Then opened this file and added the following lines:

I restarted Firefox in order for these changes to take affect.

    Install and Configure the Novatel USB760 Modem

I use a Novatel USB760 USB modem to connect to Verizon’s wireless data service. This modem also doubles as a USB storage device. The problem is that Ubuntu will automatically mount the USB760 as a CDROM device and not allow it to act as a modem. Simply trying to unmount the device was met with limited success as Ubuntu will attempt to automatically mount it again after an indeterminate period of time. To work around this problem, I plugged the USB760 into one of the USB ports and waited for Ubuntu to fully mount it. Then I modified /etc/udev/rules.d/70-persistent-cd.rules by appending the following to the end of any lines pertaining to “Novatel_Mass_Storage” so that the system would eject the Novatel USB760 as a CDROM device automatically (Note: there should be a space before and after the comma that appears at the start of this line):

Then I opened /usr/share/hal/fdi/information/10freedesktop/10-modem.fdi and added the following entry in the USB devices section:

I removed the USB760, rebooted the laptop, then plugged it back in and waited for Ubuntu to mount and subsequently eject the device. I could verify this occurred by looking at /media/ and observing that the VZAccess Manager directory was no longer mounted there. I selected the Network Manager applet icon on the right side of the top desktop panel and selected “Auto mobile broadband (CDMA) connection” and proceeded to configure my Verizon wireless connection.

Look and Feel

    Lose the Jungle Sounds

To lose the drum and jungle sounds Ubuntu is fond of playing at login and startup I navigated to System->Administration->Login Screen, selected “Unlock” and unchecked “Play login sound.” Then, navigated to System->Preferences->Sound and selected “No sounds” from the Sound theme drop-down list.

    Remove Hard Drive Icons from the Desktop

I found the small hard drive icons that Ubuntu places on the desktop to represent mounted disks and partitions distracting. To hide them I opened a terminal and entered gconf-editor to bring up Gnome configuration editor, then navigated to apps->nautilus->desktop and unchecked the “volumes_visible” option.

    Fix Low Resolution Boot Graphics

After I installed the Nvidia driver I noticed that the GRUB menu and Ubuntu splash screen were now displayed at a resolution of 640*480. Ugly! Switching from the Nouveau in-kernel graphics driver to one supplied by Nvidia as a binary loaded into Ubuntu’s X windows server apparently meant I no longer had KMS (“Kernel Mode Setting”) support for the video driver, and thus the system fell back to good old VGA mode during boot time. The work around for this was to use uvesafb, a generic driver/frambuffer that supports a wide variety of video cards that have a Video BIOS compliant with the VBE 2.0 standard, v86d, a helper application that runs x86 code in an emulated environment and is required in order to run uvesafb), and hwinfo, a tool to determine which resolutions the Nvidia card could support:

I ran hwinfo in order to determine which resolutions were supported:

The following sample output from the preceding command suggested a number of resolutions that could be supported. Through some trial and error, however, I settled on 1024×768:

I opened /etc/default/grub and modified the following lines:

Then opened /etc/initramfs-tools/modules and included uvesafb by adding the following line:

Finally, I used the following commands to force the use of uvesafb and to update the system’s bootloader and initial ramdisk:

After that, I rebooted and basked in the considerably nicer looking screen resolution being used for the GRUB bootloader menu and Ubuntu splash screen.

    Modify Keyboard Shortcuts

For better or worse I spend a fair share of my computing time on machines running Windows. As if that heresy wasn’t enough, I’ve also grown rather fond of keyboard shortcuts involving the “Windows” key (known in Ubuntu as the “Mod4” key). You know the ones… Win+d to navigate to the desktop, Win+e to open Explorer, etc. I configured similar shortcuts in Ubuntu by navigating to System->Preferences->Keyboard Shortcuts. Following are the shortcuts I typically configure:

Set focus to the desktop set to “Mod4+d”
Lock screen set to “Mod4+l”
Run a terminal set to “Mod4+t”
Open the Home folder set to “Mod4+e”

    Modify the GRUB Bootloader Menu

The GRUB bootloader menu contained a few entries that I considered superfluous. These included the two “Memory test” entries as well as the “Windows Recovery Environment” entry (See Figure 14).

Screenshot of the GRUB menu

Figure 14

To eliminate the two Memory test entries I made the file /etc/grub.d/20_memtest86+ non-executable:

To eliminate the Windows Recovery Environment menu entry, I opened /etc/grub.d/30_os-prober and added the following lines after the section of code that starts around line 134:

[text firstline=”134″ highlight=”144,145,146,147,148″]
for OS in ${OSPROBED} ; do
DEVICE=”echo ${OS} | cut -d ':' -f 1
LONGNAME=”echo ${OS} | cut -d ':' -f 2 | tr '^' ' '
LABEL=”echo ${OS} | cut -d ':' -f 3 | tr '^' ' '
BOOT=”echo ${OS} | cut -d ':' -f 4

if [ -z “${LONGNAME}” ] ; then
LONGNAME=”${LABEL}”
fi

# Added to remove the Windows Recovery entry
if [ “$LONGNAME” = “Windows Recovery Environment (loader)” ] && [ “${DEVICE}” = “/dev/sda1” ] ; then
continue
fi

Finally, to complete my GRUB modifications, I opened /etc/default/grub and changed the value of GRUB_TIMEOUT so that the GRUB menu would stay onscreen longer than the default 10 seconds. I finished up by updating GRUB:

Note: each time you update the Linux kernel, GRUB will add the new version to its menu. You can delete any of the older kernel versions listed in the GRUB menu by uninstalling that particular kernel version from your system. However, I recommend you keep at least one older kernel as well as its associated recovery option as a backup.

    Clean up Notifications

Ubuntu’s Indicator Applet resides in the top panel of the desktop and provides a single notification area for multiple messaging applications, including Evolution (See Figure 15). Also located up there is Ubuntu’s new “Me Menu,” a unified interface for managing your presence on instant messaging and social networking services such as Facebook, identi.ca and Twitter.

Screenshot of the Ubuntu Indicator Applet

Figure 15

While many user will find the Indicator Applet useful, I did not:

Ubuntu’s Me Menu wasn’t terrible useful for me either:

To see these changes immediately rather then rebooting:

Another set of notifications that I found superfluous were the shutdown and restart confirmation prompts that appear when you select either of those options from the Shut Down Applet (See Figure 16).

Screenshot of the Ubuntu restart confirmation prompt

Figure 16

To disable these, I opened a terminal and entered gconf-editor to bring up Gnome configuration editor, then navigated to apps->indicator-session and checked the “suppress_logout_restart_shutdown” option.

    Install and Configure a Theme
    Install and Configure a Theme

Update: The Ubuntu Satanic Edition theme is no longer supported. Consequently the URLs to its gpg key and repository described in the following steps are broken. Alternatively you could find another theme, in which case the following steps (using the appropriate URLs) are likely still valid, or simply use the default Ubuntu theme(s) — iceflatline, 20191223)

The stock Ubuntu theme has come along way since the omnipresent brown that characterized previous versions. But seriously, who wants a stock theme? After mulling it over a bit, I decided a diversion to the dark side was in order – enter Ubuntu Satanic Edition, a comprehensive set of themes to make my desktop dark and malevolent.

Ubuntu SE is stored in a secure repository so before I could download and install it I needed to install its GPG (GNU Privacy Guard) key:

Add its repository to the system by adding the following lines to /etc/apt/sources.list:

Update the local package index and install the appropriate version for widescreen monitors:

After installation, I navigated to System->Preferences->Appearance and selected “Inhuman Recant” from under the Theme tab, and selected “SE Pentagram” from under the Background tab. Then I modified the color of the top and bottom desktop panels to better match the background image (See Figure 17).

Screenshot of a Ubuntu Satanic Edition theme

Figure 17

Next I used Ubuntu SE’s built-in sataniconf script to install a login theme that would compliment the desktop theme I chose (to get a list of available logon themes you can run this command with no options):

Should I tire of the dark side I can use the following two commands to revert the splash, login and desktop themes back to their defaults:

    Install and Configure Conky

One of my favorite things about using Linux and BSD is the ability to use Conky, a light-weight free and open source system monitor that can display nearly any information about your system directly on your desktop:

Using sets of variables in Conky’s configuration file I can define what Conky should monitor and where those monitored parameters are displayed on the desktop. The look and feel of what’s displayed is highly customizable. Conky’s default configuration file /etc/conky/conky.conf can be used as a starting point, but it must be copied it to your home folder and renamed .conkyrc before Conky can use it. To start conky manually:

To stop it:

To enable conky to start automatically at boot time, I navigated to Preferences->Startup Applications and selected “Add.” In the Name field I entered “conky,” in the Command field I entered /usr/bin/conky -p 10 -q and in the Comment field I entered “conky system monitor.” The -p 10 argument in the command makes conky wait for 10 seconds before starting, allowing the desktop sufficient time to fully render. The -q argument makes conky start in quiet mode (See Figure 18).

Screenshot showing how to add conky as a startup application

Figure 18

When configuring Conky for my system I decided to dispense with the fancy network graphs and other eye candy and go with a more minimalistic approach instead. I settled on four areas for Conky to monitor, which provide just the information I need while not burdening system resources.

System – Basic system information showing kernel version, uptime, total RAM and Swap usage, etc.

Processor – Shows the top five applications or processes based on CPU usage.

Memory – Shows the top five applications or process based on system RAM usage.

Network – Shows basic information regarding wired and wireless connections, including IP address, inbound and outbound speed, connection quality, etc.

One of the many cool things about Conky is its support for the use of conditional statements within its configuration file. The ${if_existing} variable, for example, checks for the existence of a file passed to it as an argument. If that file exists it will display everything between ${if_existing} and the matching ${endif}. I used this particular variable to my advantage when configuring the network monitoring section. Instead of displaying information about wired and wireless interfaces that were not in use, I chose instead to have Conky display information about them only if they were active by testing for the existence of their file (e.g., eth0) in /proc/net/route. Here’s the configuration file I’m currently using. Feel free use it as is or change it to fit your needs.

Here’s what this Conky configuration looks like running on my Ubuntu SE theme:

Screenshot of Conky running the Ubuntu SE desktop theme

Figure 19

Screenshot of Conky output

Figure 20

Finishing Steps

At this point the installation and basic configuration of Ubuntu on my T410 was complete. All that was left for me to do was to download and install/uninstall some applications, stop a few applications and processes from starting automatically, and organize the Applications menu.

Ubuntu does a good job of providing good default applications that anyone can use. Alas though there are a few packages I can’t seem to do without, including:

ethtool – A utility for controlling network drivers and hardware
Filezilla – An FTP client.
Geeqie – A graphics file browser.
Hamachi – A hosted VPN service now known as “LogMeIn.”
htop – An interactive process viewer for Linux.
mg – A text editor based on MicroEMACS.
Notepad++ – A text editor (run under wine).
OpenVPN – A VPN software and server application.
Pidgin – An instant messenger client
sysv-rc-conf – A utility to examine run-level services.
Truecrypt – Disk encryption software
VLC – A multimedia player.
Wine – Windows emulator.
XChat – An IRC chat application.

All of these were available through Ubuntu’s package manager. I also took the opportunity to uninstall some applications that I knew I wouldn’t use. Gwibber, Empathy, F-Spot, Rhythmbox, X-Sane, and a few others fell into this category.

After installing/uninstalling applications, I navigated to System->Preferences->Startup Applications and removed some of the applications I found there so they would not start at boot time. These included Bluetooth, Ubuntu One, Visual assistance, and Remote desktop server. Then I fired up sysv-rc-conf to examine run-level services:

The default layout displays a grid of all services that have symlinks in /etc/init.d/ and which run-levels they are activated in (See Figure 21). For example, where the dns-clean row and column 2 intersect, if there is an “X” there that means the service will be turned on when entering run-level 2 (run-level 2 through 5 are full multi-user modes and are equivalent in Ubuntu). If there is no X it can mean that either there are no links to the service in that specific run-level, or that the service is turned off when entering that run-level. If more configuration detail is needed, sysv-rc-conf can be started using the priority option.

The priority layout also uses a grid, but instead of X’s there are text boxes that can have different values. If the text box starts with the letter S the service will be started when entering that runlevel. The two digits following is the order in which the services are started. If the text box starts with the letter K the service will be stopped when entering that runlevel. If the text box is blank that means there isn’t a symlink in that run-level for that service and it will not be started or stopped.

Using the sysv-rc-conf default layout I toggled the bluetooth, kerneloops, rc.local, and speech dispatcher services off.

Screenshot of sysv-rc-conf running

Figure 21

With those tasks out of the way it was time to clean up and organize the Applications menu. To do this I navigated to System->Preferences->Main menu (See Figure 22). I typically setup my Applications menu so that there are six top-level menu categories: Communications, Games, Graphics & Publishing, Multimedia, Office, and Utilities. These can by created by highlighting “Applications” in the left column then selecting “New Menu.” Once those were categories were created, organizing the existing applications so that they were listed under one of the newly created top-level menu categories was simply a matter of dragging and dropping them to where I wanted them. Note, however, that dragging and dropping an application to a new category does not eliminate it from appearing in its old location. To do that you must uncheck it under its old location using the Item column on the right. Once all of the applications in a particular top-level menu category have been unchecked that category will be hidden and no long appear under the main Applications menu.

Screenshot of Ubuntu's Main Menu utility

Figure 22

Conclusion

This concludes the post on how I installed and configured Ubuntu 10.04 LTS on my Lenovo T410 laptop. Obviously many of the choices made throughout the installation and configuration steps that I’ve described were based on my personal preferences. You of course, are free, indeed encouraged, to make your own choices. As in my case, I suspect that any challenges you encounter along the way can easily be overcome. In short, Ubuntu (as do many other Linux distributions) works well on this laptop.

References
http://technet.microsoft.com/en-us/library/cc709667%28WS.10%29.aspx
https://iceflatline.com2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
http://www.os-cillation.com/open-source-projekte/xfce-terminal/?L=5
https://iceflatline.com2009/08/installing-xfce-terminal-on-ubuntu-and-fedora/
Newham, C., and Bill Rosenblatt. Learning the bash Shell. 2nd ed. Sebastopol, CA, USA: O’Reilly, 1998. Print.
https://iceflatline.com2009/10/configure-command-line-aliases-in-bash/
https://iceflatline.com2009/12/my-conky-configuration/

bookmark_borderConfigure FreeNAS To Be Your Subversion Repository

Recently I had the pleasure of building a Network Attached Storage (“NAS”) server based on FreeNAS. Since then, this device has more than fulfilled my initial requirements for reliable file storage and media server in my network. In a previous post, I described how I configured FreeNAS to store web files and serve as a document root for the Apache http server implemented in my Ubuntu server. Using a similar approach, this post will describe how I configured FreeNAS to host my Subversion (“svn”) repository.

Software versions used in this post were as follows:

  • FreeNAS v0.7.1 Shere (revision 5127)
  • Ubuntu Server v10.04 LTS (x64)
  • Subversion 1.6.6dfsg-2ubuntu1
  • nfs-common v1:1.2.0-4ubuntu4
  • portmap v6.0.0-1ubuntu2

Configuring the FreeNAS Server

I began by creating the directory svn on /mnt/files, an existing mount point on my FreeNAS server. This directory would serve as the location for my svn repository. Then I enabled the Network File System (“NFS”) service so that /mnt/files/svn could be accessed from the Ubuntu server. To do this, navigate to Services->NFS->Settings and make sure that the check box for enabling NFS is checked and specify the number of servers that will run (the default value of four should easily handle dozens of users). Now select “Save and Restart.” Next, navigate to Services->NFS->Shares and select the “+” icon, where you are presented with the configuration screen for creating a new NFS share. Enter the path to be shared; the network that is authorized to access this shared path; and, make sure that the “All dirs” checkbox selected. The remaining options can retain their defaults (See Figure 1). Now select “Add” then “Apply changes.”

Screenshot of NFS shared path configuration in FreeNAS

Figure 1

Configuring the Ubuntu Server

In order to mount the NFS shared path without error, I needed to add a couple of packages. The nfs-common package is needed when a host acts as an NFS client, and includes a number of processes that ensure a particular NFS connection is allowed and may proceed. Also, because NFS relies upon remote procedure calls to function, the package portmap is needed in order to map RPC requests to the NFS service:

After these requisite packages were added, I created a directory to mount the NFS shared path. In this command, you must include the IP address of the FreeNAS server as well as the path to the directory created on it previously:

Then I made sure the permissions for this directory were set correctly:

Next, I added the following lines to /etc/fstab in order for the shared path to mount automatically at boot time:

Then I installed Subversion. The Subversion package for Ubuntu includes the Subversion client, tools to create a Subversion repository (svnadmin), and a custom protocol to make the repository I create on FreeNAS available over my network (svnserve):

And created an svn repository at the root of the shared path:

Next, I removed anonymous access to the repository and established write privileges for authenticated users. To do this, open /media/svn/conf/svnserve.conf and uncomment the following lines (Note: The svnserve.conf file is sensitive to white spaces, so make sure to not leave a space preceding the line when removing the hash (#) symbol):

Then I added myself as an authenticated user to the /media/svn/conf/passwd file:

I plan to use svn’s custom protocol for access to the repository so I need to start the svn server. One way to start it is to use the svnserve command:

However, I wanted the svn server to start up at boot time, as well as have stop and restart capabilities while it was running, so I created the following simple init script:

To use the script, I saved it to my home directory as svnserve and made it executable. Then moved it to /etc/init.d:

Then added the svnserve script to all of Ubuntu server’s multi-user run levels (2-5) and started the svn server:

Now, if for some reason the Ubuntu server is rebooted, the svn server will fire up automatically.

With the svn server now running, I created a root-level directory in subversion for a project called “code”:

After creating the project in subversion I can now use the standard svn commands or applications such Tortoise, RapidSVN and others to checkout the project or otherwise interact with the repository.

Conclusion

This concludes the post on how to configure a FreeNAS server for use as an svn repository. Sure, I could have installed the subversion package directly on FreeBSD, the underlying operating system for FreeNAS, but that approach adds processes that are not native to the FreeNAS implementation. By using the approach outlined in this post, I was able to place the repository on a solid, reliable and centralized storage system, and provide good logical and physical separation between the svn repository and the svn server functionality.

References

http://tldp.org/LDP/abs/html/abs-guide.html

https://help.ubuntu.com/community/Subversion

iceflatline