Build a Private Git Server using VirtualBox Bridged Network
I had been adjusting my new GNU/Linux environment with Arch Linux lately. Almost all the utilities that I need in Arch Linux were downloaded through the AUR and then compile and install them on demand which was pretty fast. Along with the software installation in Arch Linux, I also discovered Git version control system which I think it’s useful for version control my website files. However, the only Git hosting provider GitHub offers 300MB of storage space which is not enough for my 600MB (and growing) website files. Therefore, I decided to build a private virtual Git server for self usage.
Background
For a long time, I use NAT network interface as the default interface for the network when building a virtual machine with VirtualBox. Recently, I tried to build a virtual private Git server to version control my website files. I created a virtual machine in VirtualBox and customized it a little as usual, and installed Ubuntu Server as the server OS. After the installation was finished and logged into the server, I noticed that the IP address was 10.0.2.15 which can’t be accessed both by the host system and other systems on my home network. The Networking Modes section in the VirtualBox manual (http://www.virtualbox.org/manual/ch06.html#networkingmodes) explains that the NAT uses a virtual router to obtain the IP address whereas the Bridged uses a virtual network adapter to obtain the IP address which means that it obtained the IP address from my home router. This solves my problem for getting IP address for the virtual server to join my home network.
Steps
- Open VirtualBox.
- Choose the virtual machine with the network interface to be configured.
- Click Settings and select Network on the left.
- Choose Bridged Adapter in the “Attached to” list.
- Choose the appropriate physical network adapter in the Name list (I chose wlan0 since I’m using a netbook).
- Click OK to close the Settings dialog and click Start to start the virtual server.
- After the server was fully started and logged in, type “ifconfig” (without quote) to verify the IP address. If it’s like the format “192.168.0.x” or the format similar to your home network, the bridged networking is activated. Otherwise, visit the community forums (http://forums.virtualbox.org/) for help.
- Test the network – First, test on the host system: Type the IP address you got from the previous step into the browser on the host system (in my case, on the netbook). The network is working if “It works!” default web server page appears in the browser.
- Then, test on another system in the same network (which is my laptop): the same procedures as in the last step.
- If all went well, you should ssh from another system to the virtual server for remote access in order to create a Git repository.
- For more information on how to create a private Git server, read this article (http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux). The steps are the same except you are setting up in a virtual server instead of a real server.
Feel free to comment below if you have any questions regarding creating a server in the VirtualBox.
My First Arch Linux Installation Experience
I first heard Arch Linux two years ago when I also discovered Linux from Scratch project. At that time, I didn’t have any experience on GNU/Linux nor the command line. I have finally chosen Ubuntu 8.04 because its good reputation on the Internet. However, I’m not interested in Ubuntu anymore since I recently upgraded to Ubuntu 10.10 and downgraded back to 10.04. Because my GNU/Linux skills have increased during the past years, I have decided to try Arch Linux.
During the installation process, I followed the installation instruction on the Arch Linux wiki:
https://wiki.archlinux.org/index.php/Beginners’_Guide
After transferring to USB using UNetBootIn, I have to change the USB drive label to ARCH_201005, otherwise it will display the following message:
(Click to enlarge)
To change the label, type “palimpsest†(without quote) in the terminal. Select the USB device on the left. Make sure to unmount the driver first, and then click the “Edit Filesystem Label†button to change the drive label to ARCH_201005.
And since I have both 64-bit laptop and 32-bit netbook, I downloaded the dual ISO which contains both 32-bit and 64-bit versions of the OS. After I copied the files to the USB drive through UNetBootIn and booted into the boot menu, the 32-bit and 64-bit selection items have no effect. The only option that works is the first “Default†one which is the 32-bit version. Because I want to install it on my 64bit-based laptop, I tried to figure out how to install the 64-bit version of Arch Linux. After looking into the boot options by press the tab key at the boot menu, I found out that all of the boot image files for each architecture are in the /boot folder. I also noticed that the working “Default†one is based on the two files in the root directory: ubninit and ubnkern. I think that these files are the same as the ones in the /boot/i636/ folder. Therefore I renamed these files with .32 extension and copied the only two files in the /boot/x86_64/ folder to the root directory with the same names as the ones with .32 extension. I then copied and renamed these files to the root directory with .64 extension for backup purpose. In the end, here is my current files in the root directory of the USB device:

(Click to enlarge)
Note that the two files without any extension (ubninit and ubnkern) are 64-bit files. I could delete them and replace with the .32 extension files in the near future once I decide to install Arch Linux on my netbook.
Since I was installing on the laptop, I have no wired Internet connection. I had to first connect to the Internet by using ifconfig, iwconfig, and dhcpcd utilities before the installation. Also, according to the wiki, I have to execute “dmesg | grep firmware†command in order to find out and install the appropriate wireless firmware during the installation.
Once I installed Arch Linux, I needed to solve the wireless auto-connection issue. Thanks to the netcfg wiki (https://wiki.archlinux.org/index.php/Network_Profiles#Connecting_automatically), I quickly solved the issue. One last thing that I’ve done is to remove the network daemon in the DAEMONS section of /etc/rc.conf file since I have loaded net-profiles daemon and I think the net-profiles daemon has the same usage as the network daemon.
After I installed GNOME and Compiz, I noticed the title bar on all the windows were missing once I enabled Compiz through fusion-icon. Thanks for the tip on the Arch Linux forum (https://bbs.archlinux.org/viewtopic.php?id=96991), I was able to regain the title bar. The solution is easy: open the ccsm (CompizConfig Settings Manager) and enable the Window Decoration plugin under the Effects section (make sure to enable Move Window and Resize Window plugins under Window Management section as well since they are basic window interaction elements). I also noticed that unlike Ubuntu and other similar distributions, all the Compiz plugins in Arch Linux are disabled by default since I installed GNOME from scratch.
The following are the reference sources that helped me during the installation:
- Arch Linux Beginner’s Guide: https://wiki.archlinux.org/index.php/Beginners’_Guide
- Wireless Auto-connect at startup: https://wiki.archlinux.org/index.php/Network_Profiles#Connecting_automatically
- phpMyAdmin wiki: https://wiki.archlinux.org/index.php/PhpMyAdmin
- Install AUR packages: https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_Packages_from_the_AUR
- Install LAMP: https://wiki.archlinux.org/index.php/LAMP
- Wine installation: https://wiki.archlinux.org/index.php/Wine
- “Boot device didn’t show up after 30 seconds†issue: https://bbs.archlinux.org/viewtopic.php?id=77815
- Wireless network device lacks of firmware issue: https://bbs.archlinux.org/viewtopic.php?id=52342
- Installing python issue: https://bbs.archlinux.org/viewtopic.php?id=73410
- No title bar with Compiz issue: https://bbs.archlinux.org/viewtopic.php?id=96991
- /var/run/network//suspend/ net-profiles issue: https://bbs.archlinux.org/viewtopic.php?id=91461
- Cannot use gedit with root issue: https://bbs.archlinux.org/viewtopic.php?pid=836688
If you have other tips on the Arch Linux installation and configuration process, please share them in the comments below.
ISO Master – An Useful ISO Creator and Editor for GNU/Linux
If you are following my Twitter, identi.ca, or Facebook feed recently, you knew that I’m currently switching to Arch Linux on my laptop since I don’t like Unity to be the default UI for Ubuntu 11.04. Besides, I already lost interest with Ubuntu 10.10. This post is based on the upcoming post about my Arch Linux installation experience.
When I was installing Arch Linux, I have to change the ISO label in order to reproduce the following error message inside VirtualBox:
(Click to enlarge)
I never changed label for an ISO file in GNU/Linux. So I googled a bit and found an useful tool for creating and editing ISO files called ISO Master. It is on the Softpedia website, which is a software download and review site. Unfortunately, I don’t think this tool is in any of the GNU/Linux repositories. This means that I have to compile and install it myself. Surprisingly, after I downloaded the source file, the compiling and installing process went smoothly without any error.
After the installation was finished, I launched ISO Master from the Sound & Video application menu. The UI is clean and easy to navigate. I opened downloaded Arch Linux image file and click File → Properties. I then changed its volume name and saved as a new ISO. Thanks to this useful utility, I was able to reproduce the above screenshot, as well as my operation with ISO files in the future.
For the complete review of ISO Master, read the article on Softpedia: http://www.softpedia.com/reviews/linux/ISO-Master-Review-50543.shtml
The reasons why I switched back to Ubuntu 10.04
Since I installed Ubuntu 10.10 last Sunday, I always had a problem with the new version. As you already knew, one of the issues is that it couldn’t play the C program tutorials that recorded with mov files. I think the problem lies in the broken codecs. Here is the full list of issues I encountered when using 10.10:
aptitude not installed by default
When I don’t want to open the Synaptic Package Manager to manage the packages, I use apt-get to install new and upgrade existing packages and aptitude to search packages. To my surprise, the aptitude command is already not installed by default in Ubuntu 10.10 (I think that the Synaptic Package Manager will also not be installed by default in Ubuntu 11.04).
I had to manually install aptitude using the following command:
sudo apt-get install aptitude
The quick search box in Synaptic does not work
In Ubuntu 10.10, the quick search box in Synaptic Package Manager is moved to the far right of the toolbar along with the search button. Sometimes I use Synaptic to search through the packages when I’m not be able to find packages using aptitude. The quick search box is no longer functional and I had to use Search button to perform searches. I don’t like to use the Search button in Synaptic because I’m not able to clear the search history.
Some video formats cannot be played
As I stated before, the .mov files cannot be played by Totem and other players. I didn’t test other video formats, but this prevented me to learn the video tutorials from Lynda.com and VTC. I also cannot downgrade the codec packages and other related packages to the most stable one.
The Unity interface cannot open multiple instances of application
I tried the new Unity interface on my netbook. Personally, I like the old interface available in Ubuntu 10.04 a little better. The icons in the quick launch panel are related to the application and system menu in the Ubuntu 10.04 UNE. This means that I can customize the command for each item in the Main Menu editor. For example, I often use multiple Firefox profiles. I can navigate to System -> Preferences -> Main Menu and change the command of Firefox from
firefox %u
to
firefox -P -no-remote
This opens a new browsing session when clicked on the Firefox icon instead of opens a new browser window. The quick launch bar in the Unity is more like the task bar in Windows 7. It only can launch applications one time.
10.10 Installer cannot be copied to USB flash drive using UNetBootIn official Lucid version
After several failures tried to boot Ubuntu 10.10 live using USB, I noticed that I was not using the latest version of UNetBootIn. I added its PPA and tried one more time and worked. This means that I have to update the package using PPA and make the live USB before my computer was reinstalled, which means that it would take more time to install Ubuntu 10.10 then Ubuntu 10.04.
Ubuntu 10.04 is LTS, which is more stable
Ubuntu 10.04 is the Long Term Support version. Compare to 10.10, it is more stable. I will wait Ubuntu 11.04 and see if it suits me. If not, I will wait another 2 years for the LTS version.
Do you have other issues with Ubuntu 10.10? Share them in the comments below.
Note that since I have downgraded to Ubuntu 10.04, I’m able to play the .mov files. I will continue the C programming tutorials tomorrow.
Enable Backspace in Chromium
Since I discovered that Google doesn’t add the backspace support to its Chrome browser to navigate between web pages history, I always tried to find a way to add this shortcut key support to Chromium. I don’t like to press two or more keys combo (in this case, alt + left) just to go back one page, especially in the low-light condition when I cannot clearly see the keyboard.
Finally, with the help of an Ubuntu forum I found a Chrome extension called Backspace As Back/Forward for Linux. Once you installed this extension, the backspace key icon (
) would appear at the end of the URL address bar along with other extensions when the web pages history is available. Note that you need to refresh the existing opened web pages in order to activate the extension.
The only disadvantage I’ve found with this extension is that the page needs to be fully loaded in order to activate the backspace key. I think this is the nature of Chrome extension since the Chrome extensions are JavaScript / AJAX based.
Import additional snippets to Bluefish
Update (12/5/2010): As Matt pointed out in the comments section below, you need to replace HTML code for the special characters with raw characters during the import process. For example, replace < with the less than (<) character. Scroll down for more information on the replacement process. Thanks, Matt.
In the last post, I talked about the snippets plugin in Bluefish that allows me to import HTML 5 and CSS 3 tags as well as other languages for reference and reuse purposes. This time I’m going to show you how to import the snippets from the Bluefish wiki into the Bluefish snippets menu.
- First, go to here to copy the xml code of your choice. Make sure not to copy the <pre> tag.
- Paste the copied code into a text editor and save as a xml file.
Update (12/5/2010): Make sure to use the Find and Replace feature in your text editor to replace all the HTML code for special characters with the actual characters. Here are some common ones (HTML code is in the parentheses): < (<),  > (>). - Start Bluefish and switch to the third tab on the left side bar which looks like the following:
- Right-click inside the left-side bar and choose Import.
- Select the xml file you just saved and click Open.
- If the xml code was copied correctly, there should be a new branch appear inside the left sidebar.
- Right-click the newly created branch and choose Edit snippet to change the displayed name if you want.
- Now you can browse through the code snippets and hover the cursor over one element to learn more about the new tags of HTML 5.

Switching my Development Environment to Bluefish (Updated)
Update (10/15/2010): It seems that the snippets plugin for Bluefish is just used for reference and reuse of code. It doesn’t affect the auto-completion feature, which disappoints me. However, it could help me to learn new HTML 5 and CSS 3 techniques.
I had always used NetBeans for my only web development environment for a long time. Today when I tried it on the netbook and felt a little sluggish. Perhaps it’s because it is a multi-purpose IDE – PHP, Java, C, and Ruby. I don’t use many of its features, such as upload and compile/run, because I use FireFTP and command line to upload and compile code. These features are waste of RAM space and I think that’s the cause to slow down the system.
Therefore I tried to search for a light-weight web development IDE for GNU/Linux and found Bluefish. It has the features I need for a perfect IDE to develop web applications. The auto-complete and spellcheck are two of my most used features. It also has the snippets plugin which I think it is used to add more tags support for the auto-completion feature, such as the HTML 5 tags add pre-defined tags for the reuse purpose.
Bluefish starts up on my netbook very fast. It also runs very smoothly compare to the NetBeans. I enjoyed using it so far. To install Bluefish, type the following command:
sudo apt-get install bluefish
It should be placed in the Programming section after installed it.
By the way, it appears to also support the C language according to the snippets, although I have not test it yet.
Please share your thoughts in the comments section on how does the Bluefish IDE work for you.
Problem With mov file and Hold of C Tutorials
Since I upgraded to Ubuntu 10.10 last Sunday, I hadn’t watched C tutorial videos using Movie Player. I was beginning to watch them today and discovered they are not playable in the Totem Move Player anymore. Since they are mov files, I tried other players like VLC and Xine, even with OpenShot and Kdenlive, all with failure. When I was using Ubuntu 10.04, the only player that can play mov files perfectly was the Totem movie player with appropriate plugins. But now in 10.10, even the Totem player cannot play mov files. Here is the error message I got when I opened a mov file:
As I stated above, I installed and tried to play the files on almost all the video players, even with Miro, and Ubuntu still cannot play them. Therefore, I decide to pause the C tutorials posting a little while until I fixed this issue. In the mean time, I will try to keep the normal posting schedule (one post per day).
US Government uses FOSS
This page lists few of the companies/governments that use FOSS. One of which is the US Department of Defense. According t0 its profile, the reason for using FOSS is to defend software freedom. It reminds me that President Obama wanted to use open source software in the White House during the 2008 election.
The C Macros
A macro is a #define plus some parameters. It looks like a mini function. For example:
#define Max(a, b)Â Â a > b ? a : b
As you remember, #define is used to replace the text in the source code with another text that is specified in the #define line. This rule also applies to the macros.
Here is the sample code that contains the above line:
/*
*
* macro.c
*
* Program to demonstrate a #define macro
*
* by Mark Virtue, 2001.
*
*/
#include <stdio.h>
#define Max(a, b)Â Â Â ((a) > (b) ? (a) : (b))
#define Double(s)Â Â Â ((s) * 2)
main() {
int x, y, z;
x = 6;
y = 7;
z = Max(x, y);
z = Double(x+1);
printf("Double x is %dn", z);
fflush(stdin);
getchar();
}
Note that the best way to prevent the macros to work incorrectly is to place parentheses everywhere around the parameters. In the above code, the answer will be 8 (6 + 1 * 2) instead 14 ((6 + 1) * 2) if the parentheses were not added.
Since Max() is defined to contain two parameters, there will be a compiler error if Max() only has one parameter in the source code. Below is the error message for GCC compiler if z is set to Max(y):
macro.c:21:11: error: macro "Max" requires 2 arguments, but only 1 given
