OpenVZ On Ubuntu Or Debian

As a SysAdmin I have been using OpenVZ since it was introduced, and trust me it has not always been this easy. I used to take care of 20 physical servers with yearly replacement of about 5 machines. Since some of the servers are running different Linux distributions and different hardware it was decided that to standardize all servers, OpenVZ was to be deployed so that all of them are running Debian stable.

OpenVZ is container-based virtualization for Linux and it only separates the different guest servers in terms of resources. This differ from other implementations such as VMware, Xen, and VirtualBox where these involve hardware virtualization. Because of this, the guests called VE or VPS have the same kernel version and can only run Linux. What distribution as guest? The choice is yours.

Undoubtedly most of you have heard of Virtuozzo – it’s running OpenVZ. As a matter of fact the company that produces Virtuozzo is the one funding and supporting the development of OpenVZ.

The fact that it can run any distribution you like means that you can study and learn how to maintain different distributions. Even the littlest difference can confuse a rookie SysAdmin, for example:

  • Debian apache’s init script is distributed as /etc/init.d/apache and /etc/init.d/apache2 while in CentOS it’s called /etc/init.d/httpd
  • In Debian to change init scripts and runlevels we use update-rc.d while in CentOS we use chkconfig even though they both do the same exact thing

There are many other differences in terms of implementation that I rather not discuss here.

Click on Continue Reading if you’re interested to read more…
Continue reading OpenVZ On Ubuntu Or Debian

DD-WRT v24 Upgrade on My WRT54G v2.2 Wireless Router

It has been some time that I wanted to upgrade the firmware, but I rarely have the motivation to do so. I ensured myself that I would not brick the router, and reminded myself on how DD-WRT always produces new and exciting features. So today, I did it. It took around 20 minutes to upgrade and re-configure my router. I have a significant number of customization done especially the QoS and port forwarding and they take a while to be reconfigured. Unfortunately I can’t import saved settings from the previous version of the firmware.

Since I have a WRT54G v2.2 (antique), I followed the advice from the Internet – upgrade to mini version and then to standard version.

One of my favorite addition is the ability to see how many connection each client is using:

Another feature that I think is cool is the ability to plot a real-time bandwidth graph:

The WAN graph is maxed out because I am downloading Ubuntu from OSCC mirror as mentioned in the previous post.

There are tons other improvements included that I can’t include here, try it out yourself!

Enabling connection to modem to check stats

Since the WRT54G is not a modem, I do sometimes have the need to check my ADSL stats and have to connect to the modem directly. My provider sometimes do cheat by capping my connection lower than what I have paid for.

To enable this I simply add an interface alias to the vlan1 interface on the router. I am using a Linksys AM-300 modem-router as a modem only and it has the default IP of 192.168.1.1. If you didn’t customize your WRT54G then it’s difficult because 192.168.1.1 is also the default IP. In my case, my LAN is in a different subnet (my WRT54G has a customized IP). All I had to do in the web interface is to go to Administration > Commands, enter ifconfig vlan1:1 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 to the box and click on “Save Startup”. The router will reboot because it is a startup script!

After the router finished rebooting, if I enter the 192.168.1.1 in my browser address bar I will get my AM-300 administration page. Now I can be sure I am not cheated and still get my 2Mbps 😉

OSCC: The Silent Mirror

All hyped out about sharing Linux knowledge with friends especially dirn, I wanted to download Ubuntu for my own use mainly because I am a strict Debian user. Browsing the mirror list in Ubuntu official site I am disappointed by the speed of most of the mirrors I selected, and the fastest I can get is the ETA of 4 hours.

Then a bell rang in my head and I went to look for OSCC. This mirror is the closest mirror I can get using my ADSL. The problem with this mirror is that it sometimes have old files especially for the Debian and CentOS repositories. So it always become my last choice to look for files. I don’t blame them as the rsync process must’ve been really slow to download files from the 1st level mirrors.

The speed is very satisfactory because the mirror is located in Cyberjaya, Malaysia as you can see below:

I have been seeking this mirror every time I feel disappointed with speed of overseas mirror as it mirrors some other projects too.

Historically in 2002 I almost became an employer of OSCC after scoring good marks in a Linux test done at DRB-Hicom, and went to an interview at OSCC. I failed to get the position because when asked “How do you change init scripts and levels in Red Hat?”, I answered “I use ln to make symbolic links from /etc/init.d to /etc/rc.{0-6}”. They said, “No, you should use chkconfig“. My answer was not incorrect being a self-taught Linux user but by-the-book users will feel otherwise. I was annoyed but I don’t hold any grudge against them. I do, however feel lucky I didn’t get the job.

MyBlogLog: Where Have I Been?

I am a little embarrassed to admit that I have neglected MyBlogLog for quite some time that I never noticed that it has been bought by Yahoo!.

I did wonder on how some people get very nice MyBlogLog widgets and today I decided to check it out. I was asked to link my account to Yahoo! when I tried to log into MyBlogLog. And as you can see I have activated the new widget.

It turns out Yahoo! decided to leave the old widget codes alone and it has worked all these while 🙂

Old Vs New:

p/s – no offense to Onyx Design I was not trying to delete you but when I captured the screen I had my mouse hovered on top of your icon and too lazy to re-capture.

Google Chrome: More Findings

Actually, if you really watch the 52-minutes video or read the whole manual you might already know about these cool features. And then again maybe not. I didn’t have the time to go thorough with the documents / videos so I am just documenting based on casual use.

One of most obvious feature would be the “Inspect element” contextual menu. As a Firebug user this screen is no stranger to me.

I have not figured out whether Chrome can display real time resources such as JavaScripts and CSS loading like what Firebug does in its “Net” panel.

Another interesting feature I just discovered is the “Open link in incognito window” contextual menu that will appear every time a right click is done on a link.
Continue reading Google Chrome: More Findings

Google Chrome: My Findings So Far

Like Rizal, I was also thrilled to try out Google Chrome when I saw the posts in nazham.com and dirn.name.

I am simply discussing my initial findings, and we all know it’s Beta. This is by no means an official or detailed review. This is what I have encountered so far while using it casually.
Continue reading Google Chrome: My Findings So Far

OCRopus and Tesseract

A friend pointed me to an open source project called OCRopus because I am currently working on a project related to OCR. Commercial OCR solutions ain’t cheap and you can really dig a hole in your pocket trying to get a good OCR solution. It’s neither the price of the hardware nor the software that is high but the amount of work that needs to be done to make sure a correct output is obtained.

Most OCR solutions need a vast amount of time to train the software to correctly identify characters. Artificial Intelligence can help but not now, not today, not yet.

OCRopus is not the one who recognize the character itself but it relies on Tesseract. OCRopus provides layout analysis, pluggable character recognition, statistical natural language modeling, and multi-lingual capabilities. Sounds really good doesn’t it? Tesseract is the OCR engine that OCRopus uses.

Most of the project is tested and developed on Ubuntu, but if your platform has binutils and build tools you’re good to go. I believe it is also possible to build using Microsoft Visual Studio on Windows and of course MingGW. I went for the easiest option since I only have 2 hours to spare and I already have Cygwin on my system.

I first installed libraries header files (libpng-devel, libtiff-devel, libjpeg-devel) and build tools (gcc, make, g++, autoconf) and then built tesseract with the normal ./configure && make && make install method. To build OCRopus there is a need for Perforce Jam. Jam is actually Just Another Make. I find it a little funny when I have to build Jam using make. Oh well. OCRopus is built with ./configure && jam && jam install and it went pretty well.

To run them don’t forget to download the language files for your target language otherwise it will complain: Unable to load unicharset file /usr/local/share/tessdata/eng.unicharset

I ran my tests with standard LUA scripts that came with OCRopus (located in /usr/local/share/ocropus/scripts/) with the command ocroscript.exe rec-tess input_image > output.html

I created a 10 line Word Document with different fonts and printed it to a PDF. Using Adobe Photoshop I saved it to a JPG image. Then I gradually resized the image to the smallest I can get some output with.

To see the tests and results, click on Continue Reading.

Continue reading OCRopus and Tesseract

Compressing WordPress Output

While toying around with NextGen code so that I can activate my custom image mirror, I saw the output from Firebug. I noticed that my HTML output is not compressed (by the absence of gzip content-encoding).

Some Apache servers have this module already enabled (previously mod_gzip a 3rd party module in Apache 1, and now built-in in Apache 2 as mod_deflate).

But what if you don’t have access to the Apache configuration, such as in a shared hosting environment?

I have the answer for PHP. I always include this line in the bootstrap code of the applications I build using Zend Framework:

ob_start("ob_gzhandler");

And the output will be gzipped prior to sending it to the browser. The result? Faster transfer to users.

For WordPress you can put the line in index.php:

< ?php ob_start("ob_gzhandler"); /* Short and sweet */ define('WP_USE_THEMES', true); require('./wp-blog-header.php'); ?>

Easy, isn’t it? Here are Firebug screenshots, before and after. Notice that I managed to cut the size of my front page by 1/5?

[As the screenshots are too wide please click on Continue Reading to see them]
Continue reading Compressing WordPress Output

PHP Framework Benchmark

In April I wrote about Eclipse PDT, Zend Framework, PHPUnit.

AVNet Labs have executed a comprehensive benchmark against popular PHP Frameworks.

It looks like they are also using Zend Framework for their development. I’ll stay with Zend as well, because I believe in vendor-product compatibility. I will not ask for support from Adobe if I have a problem with Microsoft Visual Studio, so it’s the same concept here.

Zend is The PHP Company.

Thanks to Rizal for the heads up.

Maildir Storage in Thunderbird

I am doing research before deployment of a Postfix + Dovecot HA cluster tomorrow morning, on converting existing mailboxes to Maildir format. The existing mail server is running Sendmail + Unidentified POP3 on a Fedora Core 2 box. It’s ancient and that’s why my client need it to be scrapped or turned into something else.

Maildir will certainly help a lot in improving performance and avoiding the need to think about mailbox slowness and lock-ups that is a normal problem with mbox.

As an avid Thunderbird user since the project was started years ago and since Firefox 3 have just been released, I can’t avoid wondering whether Thunderbird is considering adding an option for Maildir storage in version 3. Of course, this have no relation whatsoever with the servers mentioned above. For those who are unfamiliar with Thunderbird, it currently store mailboxes in the mbox format.

Searching high and low for an answer, I don’t see any mention of Maildir, anywhere. However Thunderbird 3 looks promising in terms of feel and usability. Mac users will be very happy that Thunderbird 3 is a native Cocoa application and integration will be better. Other platforms will have to make peace with Gecko 1.9.

I’m too lazy to become a tester this time around so I am just going to wait. What about you?

Welcome Firefox 3; Good Bye Google Browser Sync

Following from Firefox 3 download day yesterday, I was eager to try out the new, all-improved Firefox 3. As a matter of fact, I am writing this post in Firefox 3.

There is certainly a significant improvement in speed and responsiveness, and the overall feel have changed. It’s a lot more elegant now.

However it’s sad to learn that Google will no longer update its Google Browser Sync service to support Firefox 3.

I’ve now migrated to Foxmarks. So far it works very well. One thing I shall miss is the password sync option which I use for low risk sites such as private torrent trackers.

Other add-ons that are available for upgrade includes Firebug, Alexa Sparky, Google Notebook, Google Toolbar and of course, Foxmarks 🙂

Anyway, bravo to Firefox for a job well done.

Changing WordPress Permalink While Still Maintaining Accessibility

I’ve been wanting to change my permalink structure for a while now but I was afraid to lose pageranks on some of my pages. However since I realize that I have been penalized and none of my page have ranks anymore, I’ll just change it.

But there is another issue that you should be worried about if you change your permalink: incoming links from other blogs / sites. They will be rendered unusable.

I used to use /%year%/%monthnum%/%day%/%postname%/ (Day and name) as my setting. After a while it looks ugly and long with so many numbers. https://blog.adyromantika.com/innotek-virtualbox/ looks much nicer than https://blog.adyromantika.com/2008/04/26/innotek-virtualbox/.

The issue here is that we want the latter to still work.

There is a simple remedy to this problem. You can edit .htaccess file to add some rules to rewrite your old permalink structure to the new one. The rule I will explain below will redirect the page to the new permalink.

The default .htaccess looks like this:

1
2
3
4
5
6
7
8
9
# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</ifmodule>
# END WordPress


Continue reading Changing WordPress Permalink While Still Maintaining Accessibility

WiMAX Delayed In Malaysia

It has been a while since I last heard anything about WiMAX plans for Malaysia. Well, from the news in The Star I gather that this problem is not specific to Malaysia.

The WiMAX Forum who provide standards and certification is now focusing on the US roll out. While some expert argues that the number of equipment needed for Malaysia is not as many as in the US, we still have to wait for them if we want best interoperability between providers.

My take is that I am willing to wait for it to become close to perfect. I want something reliable, and cost does not matter much. I’ll pay as much as RM500 per month for a stable and reliable service with good coverage. Currently, 3G or “wireless broadband” services provided by local telcos are not reliable. Not that it’s anyone’s fault – it’s the technology itself.

How much would you pay for a good WiMAX service?

As usual, click on Continue reading for the original news just in case the original source has been removed.

Continue reading WiMAX Delayed In Malaysia

WordPress 2.5.1

I was really reluctant to upgrade my WordPress version because I have so many custom plugins to create many widgets. I was just afraid that they might break and I have to spend a lot of time to repair them. My colleague Shahrulazlan has been trying to get me to upgrade my installation for a while now

However today after a few hours of learning Linux HA I need some WordPress to ease my mind.

Upgrading this blog on my development copy is a breeze. I have to admit I had to upload 3 times because of some MAC encoding problems. For some reason after checking in the files to subversion and doing an export, the files are all encoded in MAC encoding. And the result was catastrophic.

The final result is beautiful. I really love the new UI and features such as permalink editing while in write mode, and version checking for plugins. I have yet to test the auto-update feature, though.

No regrets. If you are still using 2.2 or 2.3 series do consider an upgrade. You’re missing a lot.

This upgrade also provide an opportunity for me to test my plugins. I am happy to announce that they both work well on 2.5.1.

innotek VirtualBox

During the course of my daily work, I sometimes need to run multiple OS at once. I used to rely a lot on VMware to run Debian and CentOS on my Windows notebook. The problem with the free VMware server is that it is damn slow, and at startup it takes a few minutes before the VMware authentication service finish working.

One day during a nicotine session my friend Haidir asked me “why don’t you use VirtualBox?”. Oh man! I recall bumping over some articles about VirtualBox in magazines but I guess it slipped my mind.

Starting from that day, bye VMware and hello VirtualBox!

I am surprised on the feel of VirtualBox – it is too light to be a fully functional virtualization product. But it is.

Comparing directly to VMware server (free version) VirtualBox does not introduce any kind of lag at all to my machine. CPU usage never reaches 100% with normal usage of the guest boxes:

VirtualBox running Debian and CentOS

I loooooove the shared folder feature. Sure, you’ll have to compile kernel modules for the virtualbox functions but it’s easy and you can always remove gcc and make later if you want.

A little note about networking, is that when you use only NAT networking with the host you will be able to do a “port forwarding” setup from the host (so that when you access a particular port on the host you are accessing the guest). Look for it in the documentation.


"C:\Program Files\innotek VirtualBox\VBoxManage" setextradata "CentOS" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/CentOSHTTP/Protocol" TCP
"C:\Program Files\innotek VirtualBox\VBoxManage" setextradata "CentOS" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/CentOSHTTP/GuestPort" 80
"C:\Program Files\innotek VirtualBox\VBoxManage" setextradata "CentOS" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/CentOSHTTP/HostPort" 80

In the commands above a port 80 on host is forwarded to port 80 on guest. Cool feature. However I want to demonstrate a hidden problem that might help some of you out there.

On my machine, IIS is running on port 80 (don’t ask me why). Meaning port 80 can’t be used by VirtualBox anymore. This will cause the virtual machine to crash when it tries to activate the network interface:

Virtual Box Crash Port In Use

(I purposely captured along the JIT message, normal users might see a normal Send Error to Microsoft dialog).

VirtualBox will display the virtual machine status as “Aborted”:

VirtualBox Aborted

What you can do next is decide on which port you really want to use on the host. In my case I can simply stop IIS on my host machine if I really want to use port 80.

This is neither a big issue with VirtualBox, nor is a critical defect – it’s just a bit annoying. Perhaps next versions can detect used port before powering on the virtual machine 🙂

But then again, I am using this for my personal work and learn environment. For serious use and production, you might want to consider vm ware hosting for a more reliable solution.