Free DNS provides easy shared DNS hosting & URL forwarding

Sunday, October 28, 2012

Speed up Ubuntu Quantal Quetzal

I recently upgraded my Ubuntu 12.04 Precise to Ubuntu 12.10. Overall, I didn't see much difference, probably because I didn't run/notice the bugs/limitations that were fixed in this new release. One thing that I (subjectively) noticed is that boot up and application startup is slower, with the UI experiencing occasional freezes. I guess these slowness/freezes were already in 12.04, but they become more obvious after the upgrade. To the point that they become frustrating. So I looked into some ways that might speed up the system (not minor or complete tweakings, but just a few to get over the current situation).

Mount options

First thing I tried was adding nodiratime and noatime options to the mount options of / and /home partitions. To do that, just edit /etc/fstab and add these options alongside the existing ones. My fstab looks something like this now:
/dev/sda1 / ext4 nodiratime,noatime,errors=remount-ro 0 1
UUID=..... /home ext4 defaults,nodiratime,noatime 0 2
I didn't notice any major speedup after these changes, but they do seem common sense and lack of speedup might be due to my particular setup (some VMs I'm using).

Install ureadahead

Next I installed the ureadahead package which is supposed to lower boot up times. Install was easy:
sudo apt-get install ureadahead
According to what I read, on first run, ureadahead logs bootup files accesses and then aggregates these files into cached file that will be used in next bootups to speed things up. It also optimizes this cached file according to the type of disk that you have (SSD or HDD). After the system boots, ureadahead process seems to terminate and just gets out of the way.
I didn't notice any major speedup on this either. It could be some, but bootup time is still several times more of the Ubuntu advertised "10 seconds bootup".

Install preload

Preload is a daemon that logs statistics about programs usage and requirements and use these statistics to speed up programs startup. I guess this is what Windows has on by default in that prefetched folder. As mentioned in the man pages, the speed up is not immediately, because preload first needs to collect the stats and create some caches before it can use them. Even so, I did see programs starting faster pretty soon after installing preload. I just installed using:
sudo apt-get install preload

Install prelink

Preling is a tool that improves memory usage and load times by optimizing programs and libraries. Install it using:
sudo apt-get install prelink
After install, you need to start the optimization process. Before I did that, first I edited /etc/prelink.conf to include /opt directory in the optimization process because I have some custome software there. After that, just run

sudo prelink -avmR
The option v is for verbose so that you can see what's processing. You could remove that if you don't care. I guess I'll need to run such a command when I update/install new software, but that's not a big issue.
Although I installed it mostly for the "memory optimizations" promise, Prelink also seemed to help with speed. I'm not sure how much since I installed it after preload which already helped in that area.

Tuesday, November 29, 2011

Setup GeoIP for PHP5 on Ubuntu Server

I lost a few hours on this, although I done it sometime ago. To make sure I don't forget it again, here it is:
  1. Install geoip packages:
    sudo apt-get install geoip-bin php5-geoip
  2. Download GeoIP Lite version:
    wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /tmp/GeoLiteCity.dat.gz
  3. Unzip GeoIP Lite to /usr/share/GeoIP/GeoIPCity.dat (this is what I forgot: to rename the file):
    sudo gunzip -c /tmp/GeoLiteCity.dat.gz > /usr/share/GeoIP/GeoIPCity.dat
  4. Reload apache
    sudo /etc/init.d/apache2 reload

Thursday, August 5, 2010

Elegant SEF columns layout

I found this somewhere (I can't remember where). I'm not using it now, but it's good to know.
The CSS is
/* @begin columns/sidebars (fixed L,R; liquid C) */
.columns-both, .columns-left {
  padding-left: 200px; /* LC width */
}
.columns-both, .columns-right {
  padding-right: 150px; /* RC fullwidth + CC padding */
}
.columns-container .column-main, .columns-container .column-left, .columns-container .column-right {
  position: relative;
  float: left;
}
.columns-container .column-main {
  width: 100%;
}
.columns-container .column-left {
  width: 190px;          /* LC width */
  left: -200px;          /* LC fullwidth + CC padding */
  margin-left: -100%;
}
.columns-container .column-right {
  width: 140px;          /* RC width */
  margin-right: -150px;  /* RC fullwidth + CC padding */
}
/*** IE6 Fix ***/
* html .columns-container .column-left {
  left: 150px;           /* RC fullwidth */
}
/* @end columns/sidebars (fixed L,R; liquid C) */
and the HTML (in a Drupal theme) is:


   

     
     

     
     
     
   

   
   
   

     
   

   
   
   
   

     
   

   
 

Tuesday, July 6, 2010

Working out OpenVPN with Network Manager in Lucid Lynx

For two years now, I've used OpenVPN to connect to a server where I upload some of the stuff I work on. Until now I always started OpenVPN from the terminal, because I didn't manage to get it working from the Network Manager in the last 4 Ubuntu versions.
Last weekend, I had some spare time and I installed Lucid Lynx on my laptop. I tried (again) to get OpenVPN working with Network Manager. As usually it failed, although I was pretty sure everything I did was correct.
So I decided to import my existing openvpn configuration file and export it back to see if there's something different. After doing this, I've noticed a few difference, but most of them were just due to syntax. However, two lines looked more interesting:

user openvpn
group openvpn
I've checked and saw that with these lines in the configuration file, the openvpn connection failed to start even from the terminal. Therefore, I did the following:
  1. create the openvpn group as a system group using

    groupadd -r openvpn
  2. assign the openvpn group to the directory (and files) that holds my openvpn key and certificates (mine and server's):

    chgrp -R openvpn openvpn_folder
  3. assign group read permissions to the openvpn settings directory and remove permissions for others:

    chmod g+r,o-rwx openvpn_folder
After these steps, the OpenVPN connection started from the Network Manager without problems (note that it's recommended route only traffic for that network through that connection).