Crunchbang Linux a Speedy Alternative to Ubuntu

Friday, November 6th, 2009

Built using only Ubuntu, Crunchbang Linux has boiled down its distribution offering only the bare minimum needed to have a good balance between speed and functionality. Though not intended for older hardware, it is reported to work well in outdated environments where there is a premium placed on eking out as much speed as possible. Read more about it at http://crunchbanglinux.org/wiki/about and share with us any stories you might have in using it.

How to make Ubuntu Linux run faster on a laptop

Tuesday, July 21st, 2009

If you google around on the web you will find there are several tutorials on how to make your Ubuntu Linux installation run faster — especially on older hardware. These tips are very useful and range from minor tweaks to major overhauls. Being an intermediate Linux user myself, I found some of the more difficult optimizations to be overwhelming and not something I would want to try at home — changes to how Linux writes to the hard drive, for example. While researching and implementing the optimizations I felt comfortable with on my older Dell laptop and my new Asus eeePC 901, I jotted down all of my notes for future reference. Below are some tips for the intermediate user on how to optimize your laptop (or desktop) running Ubuntu Linux.

 

Reduce Swappiness

Most laptops have enough RAM installed that the swap space on the hard disk shouldn’t really be used. Yet the default setting for swappiness in Ubuntu is 60. By lowering it to 10 we can reduce the number of read/writes the the hard disk. This is especially handy for netbooks with solid state drives in them. To reduce the swappiness, follow these steps:

  1. sudo sysctl -w vm.swappiness=10
  2. Add the following line to /etc/sysctl.conf
    vm.swappiness=10

 

Preload

Preload is an adaptive read-ahead daemon that monitors running applications and analyzes them for commonalities. It then uses this data to predict what applications you might run and preloads them into memory. The result is faster startup times for commonly used programs. Installing preload is as easy. Just run the following line in a terminal window:

sudo apt-get install preload

» For further explanation, read this article on loading applications quicker in Ubuntu using preload.

 

Boot-Up Manager

The Boot-Up Manager (BUM) is a useful utility for starting and stopping boot-up scripts. Once installed it will appear in the System -> Administration menu. You can use BUM disable unnecessary boot-up scripts that may be slowing down your boot time. For example, I disabled saned, an API library for scanners, because I know I’ll never be attaching a flatbed scanner to my laptop. To install BUM:

sudo apt-get install bum

» Read the documentation for Boot-Up Manager

 

Startup Applications

If you are using Gnome for your desktop manager there will be an option to select which applications are started when you login. Go to System -> Preferences -> Startup Applications and uncheck the programs you don’t need. For example, I disabled the Evolution Alarm Notifier because I don’t use Evolution for setting alarms. I also disabled the Remote Desktop server, UME Desktop Launcher, and UNR Launcher. Just be careful to uncheck them and not remove them. In the case that you’ve removed something critical, you’ll want to be able to get it back.

 

Replace Metacity with Openbox

Openbox is a minimalistic and lightweight window manager that is known to run much faster than metacity, its bulkier counterpart. And you can easily get it working while still using Gnome as your window manager / desktop environment. By running Openbox inside the Gnome environment your desktop will become cleaner and faster. To install it, follow these steps:

  1. Install openbox using:
    sudo apt-get install openbox obconf openbox-themes
  2. Setup openbox as the default window manager by adding an entry in Startup Applications.
    To do this, go to System -> Preferences -> Startup Applications and enter the following:

    • Name: Openbox
    • Command: openbox ––replace

    Note: According to the Openbox documentation you can make it the default by choosing the GNOME/Openbox session when logging in and saving this as your default session. However, this functionality is broken in 9.04. The above steps are a workaround until this is fixed.

  3. Choosing the Openbox theme and other configuration settings
    Go to System -> Preferences -> Openbox Configuration Manager to choose a theme you like and to update other settings such as Appearance and Windows.
    Note: changing the Desktops setting doesn’t effect the Gnome applet controlling the number of desktops. To change the number of desktops, you will need to revert back to Metacity and change them, then re-enable Openbox

» More information, documentation and screenshots available at the Openbox web site

 

That’s all for now

I found that making these few simple changes decreased load times on my older laptop significantly and made my newer netbook more minimal. Hopefully, these tips will help you as well.

 

PHP crons, linux, and the hostname

Thursday, May 28th, 2009

When running PHP as a cron, the $_SERVER['HOSTNAME'] variable is not set, nor are any other variables that will identify which server your cron is running on. This can be problematic if you are running the same cron on multiple servers, such as in a load balanced environment, and you need the cron to report back or log information about the server on which it ran.

Here is some code for getting the hostname value from your linux network configuration, assuming you have setup /etc/sysconfig/network properly.


//get hostname info from /etc/sysconfig/network
preg_match('/HOSTNAME=(.*)/', file_get_contents('/etc/sysconfig/network'), $network);
$hostname = split("\=", $network[0]);
echo $hostname[1]; //this equals the value of your HOSTNAME

Ubuntu Linux: How to setup a VPN connection to a SonicWall router using Openswan and Pre-shared Keys (PSK)

Monday, May 18th, 2009


Background

Pelago is a web design and development agency in Santa Barbara, California. Since our humble beginnings in August of 2000, we’ve seen the Internet landscape evolve exponentially in the last nine years. Our most current challenge as a creative and engineering agency is in embracing diversity in platforms and the inevitable shift towards the remote office. We use three different operating systems — Windows, OS X and Linux — on a daily basis. In addition to developing web-based project management software that is compatible with all three platforms, our designers and developers rely on them inside and outside of the office. Tunneling through the firewall from outside the office was our next requirement for embracing a diverse and distributed remote office.

Our SonicWall router makes it easy enough to establish a VPN connection using Windows. There is a client that can be downloaded from the SonicWall web site. What about other operating systems? Our developers often use Ubuntu Linux from home and required a way to VPN into the office. Once established, a VPN connection allows access to development servers, remote desktops, and other network resources inside the firewall; so you can see why it would be essential for the remote office.

The problem, as most Linux users out there already know, is that setting up a VPN connection in Ubuntu Linux is not very easy. After much trial and error, here is how we got the VPN working on Ubuntu Linux using Openswan.


Configuring the SonicWall Router

Login to your SonicWall router admin and make the following adjustments to the VPN settings.

  1. Click on the VPN link and note the Unique Firewall Identifier for your SonicWall router. You will need it later for the value sonicwall.unique.identifier.
    SonicWall VPN Settings
  2. Under VPN Policies, create or edit the ‘GroupVPN’ policy.
  3. Click on the General tab and set the following:
    SonicWall VPN General Settings

    • IPSec Keying Mode: IKE using Preshared Secret
    • Shared Secret: shared.secret.key (enter your secret key here)
  4. Click on the Proposals tab and set the following:
    SonicWall VPN Proposals Settings

    • IKE (Phase 1) Proposal
      DH Group: Group 5
      Encryption: 3DES
      Authentication: SHA1
    • Ipsec (Phase 2) Proposal
      Protocol: ESP
      Encryption: 3DES
      Authentication: SHA1
    • Enable Perfect Forward Secrecy (checked)
      DH Group: Group 5


Installing Openswan

If you are using Ubuntu, open a terminal window and type in:
sudo apt-get install openswan
The install will ask you a few questions about how you want to set it up. Select the suggested default for each step. This will install Openswan and create the ipsec.conf and ipsec.secrets configuration files.


Configuring Openswan

Add the following connection parameters to your /etc/ipsec.conf file:
conn sonicwall
     type=tunnel
     left=192.168.2.31 #your IP
     leftid=@home
     leftxauthclient=yes
     right=xxx.xxx.xxx.xxx #IP address of your sonicwall router
     rightsubnet=192.168.1.0/24 #gateway IP for your LAN. This will work for most
     rightxauthserver=yes
     rightid=@sonicwall.unique.identifier
     keyingtries=0
     pfs=yes
     aggrmode=yes
     auto=add
     auth=esp
     esp=3DES-SHA1
     ike=3DES-SHA1
     authby=secret
     #xauth=yes

Update: After upgrading to Ubuntu 9.10 a few things changed in the conf file. First, I had to comment out ‘xauth=yes’ as it was throwing an error. Second, I had to use my own static IP instead of %defaultroute. If you are using DHCP, %defaultroute may still work, but I have a static IP and had to change this.

Add the following line to your /etc/ipsec.secrets file
@home @sonicwall.unique.identifer : PSK "shared.secret.key"


Starting and stopping the VPN connection

Starting ipsec and opening the VPN connection
sudo ipsec setup ––start
sudo ipsec auto ––add sonicwall (note: if you change the configuration files, you'll need to run 'sudo ipsec auto ––replace sonicwall' to reload the file)
sudo ipsec whack ––name sonicwall ––initiate

Closing the VPN connection and stopping ipsec
sudo ipsec whack ––name sonicwall ––terminate
sudo ipsec setup ––stop


References

The following links were useful for getting the VPN connection up and running on Ubuntu Linux:
Openswan wiki page for SonicWall routers:
http://wiki.openswan.org/index.php/Openswan/SonicWall
SonicWall PDF instructions for using Agressive Mode and IKE with Pre-shared Keys
http://www.sonicwall.com/downloads/SonicOS_Enhanced_to_Openswan_Using_Aggressive_Mode_IKE_with_PreShared_key.pdf

Ubuntu 7.10 is almost here

Friday, October 12th, 2007

This month the latest version of Ubuntu is scheduled for release. Here is the full Ubuntu 7.10 new feature set and the features I am personally looking forward to:

Stand-alone Open Source software expected to have big growth

Friday, June 8th, 2007

We have a mixed world here at Pelago where we do primarily Open Source development, but have a combo office with Macs, PCs, Windows Server 2003 and Linux. If there is ever a comparable Open Source option we definitely go that route first. It allows us to modify it for our needs and doesn’t have prohibitive licensing. It looks like Open Source vendors can expect growth over the next few years:

The market reached $1.8 billion in 2006, and will grow 26 percent annually for the next four years, the firm predicted.

The full story is here at Yahoo! news.

Ubuntu continues to gain momentum – can Linux gain ground in the desktop realm?

Thursday, May 24th, 2007

It seems like every time you turn around there is a new Ubuntu announcement. For example, it is being ported to handhelds, and Dell announced that it is going to sell computers with Ubuntu 7.04 preinstalled. With all of the virtualization growing in the marketplace with VMware and Parallels for the Mac, it seems like Linux should gain ground in the desktop arena. I have a Dell laptop with Ubuntu on it and I am able to do pretty much everything I need with it. Also, with the advent of so much hosted software (like our service Intervals) it seems like a ripe opportunity for Linux based desktops to grow in popularity. The need to be connected is at a premium, but the need for installed software seems to be lessening. If you have an internet connection, Open Office, and a chat program you can do much of most people need to do. I am curious to see where things are at in year.

Ubuntu Fiesty Fawn

Friday, April 20th, 2007

Our favorite flavor of Linux, Ubuntu, has just released their newest version code named Fiesty Fawn. Here are some tips on installing it, and a sneak preview of video and graphic tools.

Why is Ubuntu our favorite? Because it is easy to install and most closely mirrors the desktop environment. We’ve installed a lot of distros here at Pelago. Our developers like SUSE, our sysadmins like RedHat and CentOS, and the rest of us love Ubuntu.