Skip navigation

I’m glad that WordPress has an iPhone app. Now I can start blogging from anywhere.

Blog away…

As a developer, never thought one day I would install Bugzilla. I guess, developer always hates bug tracker. But I was appointed as a tester in a project, a there is no budget for any bug tracker. Thus, there is Bugzilla.

Several things you need to download using aptitude. Run below command in the terminal:

sudo apt-get perl apache2 libapache2-mod-perl2 build-essential mysql-server-5.1

Then download the latest Bugzilla from http://www.bugzilla.org. You may download it from Ubuntu repository, but I prefer to get the latest release, fresh from the oven. Once you have the bugzilla archived file. Unarchived it and you should get the bugzilla folder. Place the bugzilla folder in /var/www path and you should get /var/www/bugzilla.

Then you need to configure your apache2. Then open apache2 default file by command below:

sudo vi /etc/apache2/sites-available/default

Add this entry in your default file:

<Directory /var/www/bugzilla/ >
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit
</Directory>

Then go to /var/www/bugzilla folder. Run below command:

sudo ./checksetup.pl --check-modules

It will list out which perl modules you need to install. You can install one-by-one depending on your needs. To keep things simple, we just install everything by running below command:

sudo perl install-module.pl -all

Perl will download, compile and install all the required and additional components for Bugzilla. Then open a file called localconfig by below command.

sudo vi /var/www/bugzilla/localconfig

Edit below attributes in the file:

#No .htacess file will be created. If set to 1, it will be created.
$create_htaccess=0;
#Web Server (Apache2) Group. Since I don't have one, I set to empty value.
$webservergroup='';
#Database type (default)
$db_driver='mysql';
#Database Host (default)
$db_host='localhost';
#Database Name (default)
$db_name='bugs';
#Database User (default)
$db_user='bugs';
#Database Password
$db_pass='';

Then enter your mysql console, and type below command to create a user named bugs and to set the privileges.

mysql > GRANT SELECT, INSERT,
UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
TO bugs@localhost IDENTIFIED BY ’buggafool’;

mysql > FLUSH PRIVILEGES;

Run below command and the script will generate the necessary tables in your mysql server:

sudo /var/www/bugzilla/checksetup.pl

Restart your apache2 server by below command:

sudo service apache2 restart

Now you’re good to go. Browse your local bugzilla @ http://<ip-address>/bugzilla/.

Below is the script I used to startup Adempiere in my Ubuntu Server.

#! /bin/sh -e
# /etc/init.d startup script for ADempiere
#

# Script layout borrowed from anachron.

# path to JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16

# path to ADEMPIERE_HOME
ADEMPIERE_HOME=/opt/Adempiere

# add to path
PATH=$JAVA_HOME/bin:$ADEMPIERE_HOME/utils:$PATH

export JAVA_HOME ADEMPIERE_HOME

test -x $ADEMPIERE_HOME/utils/RUN_Server2.sh || exit 0

# Get lsb functions
. /lib/lsb/init-functions

case "$1" in
 start)
 log_daemon_msg "Starting Adempiere server" "adempiere"

 start-stop-daemon --start --exec $ADEMPIERE_HOME/utils/RUN_Server2.sh >> /dev/null &
#    $ADEMPIERE_HOME/utils/RUN_Server2.sh

 log_end_msg 0
 ;;
 stop)
 log_daemon_msg "Stopping Adempiere server" "adempiere"

 start-stop-daemon --stop --oknodo --quiet --exec $ADEMPIERE_HOME/utils/RUN_Server2Stop.sh >> /dev/null &

 log_end_msg 0
 ;;
 *)
 echo "Usage: /etc/init.d/adempiere {start|stop}"
 exit 2
 ;;
esac

exit 0

I saved above script in a file named adempiere and placed it in /etc/init.d folder. Just need to change the JAVA_HOME and ADEMPIERE_HOME values according to your server settings. Then I register startup script with Ubuntu with below command:

sudo update-rc.d /etc/init.d/adempiere defaults

Restart your server, and you should see your Adempiere will startup during server bootup.

References:
http://www.adempiere.com/index.php/ADempiere_Dedicated_Server

To backup your svn repository, you just type below command:

svnadmin dump [REPO_PATH] > [DUMP_FILE_PATH]

Replace [REPO_PATH] with your repository path and [DUMP_FILE_PATH] with your dump file path in your machine.

To backup only your latest revision, first you need to find out the latest revision number from your repository. To do that just run below command:

svnadmin verify [REPO_PATH]

It will list out the revision number and the most bottom will be your latest revision number. That will be referenced by [LATEST_REVISION_NUM] from now on. Run below command to backup only the latest revision from [REPO_PATH].

Then run below command to backup the latest revision from your repository:

svnadmin dump -r [LATEST_REVISION_NUM] [REPO_PATH] > [DUMP_FILE_PATH]

To restore your repository from a dump file, run following command:

svnadmin load [REPO_PATH] < [DUMP_FILE_PATH]

To change your timezone via command line in Ubuntu, just run the following command in your terminal:

sudo dpkg-reconfigure tzdata

Just follow the process by selecting the country and city and you are done.

Related softwares:

  1. JBoss 5.1.0
  2. Ubuntu 9.04

As of time of writing, Ubuntu repository only provides JBoss AS 4. So, to install the latest JBoss (5.1.0), you need to manually download it from:
http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA-jdk6.zip/download

Once you downloaded the jboss-5.1.0.GA-jdk6.zip archive file, unzip it and put the folder jboss-5.1.0.GA in /opt folder. Thus, I’ve chosen /opt/jboss-5.1.0.GA path as my $JBOSS_HOME.

To setup the JBoss to startup on machine bootup, below are the steps.

Create a system user named jboss by running below command in the terminal:

sudo adduser --system jboss

Change the owner of $JBOSS_HOME and its subfolders to jboss user by typing below command:

 sudo chown jboss /opt/jboss-5.1.0.GA -R
 

Create a script file named jboss in /etc/init.d folder. Type in below content into the jboss script:

#! /bin/sh

JBOSS_HOME=/opt/jboss-5.1.0.GA

start(){
 echo "Starting jboss.."

 sudo -u jboss ${JBOSS_HOME}/bin/run.sh -b 0.0.0.0 > /dev/null &
}

stop(){
 echo "Stopping jboss.."

 sudo -u jboss ${JBOSS_HOME}/bin/shutdown.sh -S > /dev/null &
 #give time to shutdown jboss services.
 sleep 60
 #kill all java services started by user jboss
 su -l jboss -c 'killall java'
}

restart(){
 stop
 start
}

case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart)
 restart
 ;;
 *)
 echo "Usage: jboss {start|stop|restart}"
 exit 1
esac

exit 0

Include above startup script into Ubuntu bootup sequence by typing command below:

sudo update-rc.d /etc/init.d/jboss defaults
sudo service jboss start

And you’re done.

References:

  1. http://www.jboss.org/community/wiki/StartJBossOnBootWithLinux

Want to capture your screen in Ubuntu?  I recommend you to use Shutter. Although Ubuntu comes with a default screen capture tool, but Shutter has more functions.

To install it, you need to add below Shutter PPA (Personal Package Archive) into your repository list. Run below command to add the PPA.

sudo echo
'deb http://ppa.launchpad.net/shutter/ppa/ubuntu
jaunty main' >> /etc/sources.list

You might need to change to root user if you getting Permission denied error message for above command.
Then run below command to authenticate the PPA:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 009ED615

Update your repository list:

sudo apt-get update

Install Shutter from the new PPA:

sudo apt-get install Shutter

If everything went well, you should get a new Shutter menu in your Applications > Accessories > Shutter – Screenshot Tool as show below.
Shutter from Main Menu
FYI, above screenshot was taken with Shutter. I was able to set a delay for several seconds and capture my screen including the mouse pointer. This is great to show to user which point on the picture I was referring to. Now, give it a try yourself and enjoy!

Did you regret giving a horrible name for your machine when installing your Ubuntu? Well, I did, several times. But don’t worry, the steps to change your hostname are simple. Caveat, if you have any other softwares pointing to your machine by its hostname, you must change those softwares setting yourself.

Your machine hostname resides in /etc/hostname file. Change the value inside the file to your new hostname. To make the change to take effect, run the following command in your terminal.

sudo /etc/hostname.sh start

Related softwares:

  1. Eclipse 3.5
  2. JDK 1.6
  3. Maven 2.2.1

First, install M2clipse-plugin in Eclipse via below M2clipse update site:

http://m2eclipse.sonatype.org/update/

If you don’t know how, please refer to this article on how to install Eclipse plugin via update site.

To use the latest Maven2, which is version 2.2.1 at the point of writing this article, you need to download the binaries from below site:

http://lawyersdb.com/mirrors/apache/maven/binaries/apache-maven-2.2.1-bin.tar.gz

Once downloaded the apache-maven-2.2.1.tar.gz archive file, unzip/untar it and place the apache-maven-2.2.1 folder in /opt. So, /opt/apache-maven-2.2.1 will be known as $M2_HOME. To set this environment variable manuallly into the system, add this below line in /etc/environment file.

JAVA_HOME=/usr/lib/jvm/java-6-sun
M2_HOME=/opt/apache-maven-2.2.1

Add also the $JAVA_HOME variable, if you haven’t done so. But make sure it is pointing to your JDK home folder. You need to re-login into your Ubuntu for this new environment variable to take effect

After re-login, create a mvn link in /usr/bin, for you to run the mvn command globally. Type the following:

cd /usr/bin
ln $M2_HOME/bin/mvn /usr/bin/mvn

To check Maven2 installation status, type below command in your console:

mvn -version

You should see Maven2 printing some info regarding the version.

Back to the Eclipse. Now, you need to setup External Tools to point to this new /usr/bin/mvn command we just created. At Eclipse main menu, choose Run > External Tools > External Tools Configuration…

Create External Tools

External Tools Configuration dialog will be prompted as below.

Empty External Tools Configuration

Right-click on Program and choose New.

Create New External Tool Menu

A new program form will be displayed. Enter the following details:

  1. Name : Maven
  2. Location : /usr/bin/mvn
  3. Working Directory : ${project_loc}
  4. Arguments : ${string_prompt}

Maven2 External Tools Config Setup

Click on Apply and Close buttons.

To use the newly created External Tools we just created, click to highlight your Maven2 project.

Choose Maven2 Project

On the Eclipse main menu, choose Run > External Tools > External Tools Configuration…

Choose External Configuration Menu to Run Maven2

Then, on the External Tools Configuration dialog, choose Maven and click on Run button.

Choose Maven to Run External Tools

A Variable input dialog will be prompted. Key in your mvn parameter you wish to pass and click OK button.

Variable Input dialog

You will see your Maven2 console is running and processing your command as shown in below.

Maven2 console

If you had setup a private remote repository, you can save the hassle for downloading artifacts from the public remote repository (central repo). Your private remote repository will download it for you and cache it on the private server. If you want to download from your private remote repository, you need to update or create your Maven2 settings.xml file. This file should be located at ${USER_HOME}/.m2 folder. The content of the file is as following:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <pluginGroups/>
 <proxies/>
 <servers/>
 <mirrors>
   <mirror>
     <id>myPrivateRemoteRepository</id>
     <mirrorOf>*</mirrorOf>
     <name>My Private Remote Repository</name>
     <url>[PRIVATE_REMOTE_REPOSITORY_URL]</url>
   </mirror>
 </mirrors>
 <profiles/>
</settings>

Replace the [PRIVATE_REMOTE_REPOSITORY_URL] with your private remote repository URL. You can put any value on the id and name elements, but it just need to be unique between other mirrors.

Related softwares:

  1. Ubuntu 9.04
  2. Postgresql 8.3
  3. Adempiere 3.4.2

Pre-requisite of installing Adempiere, is to setup a supported database which could be Oracle or Postgresql. In this article, I’ll be using Postgresql 8.3. To learn more on how to install Postgresql in Ubuntu, you can go here. Also, in Postgresql, create a login-role named adempiere and create a database named adempiere. Assign the owner of this adempiere database to adempiere login-role.

You need to download the Adempiere archive file from sourceforge.net URL below:
http://sourceforge.net/projects/adempiere/files/ADempiere%20Official%20Release/Adempiere%203.4.2-stable/Adempiere_342s.tar.gz/download

Unzip the archive file and you will get a folder named Adempiere. Place it anywhere to your liking. As for me, I will put it under /opt, so my $ADEMPIERE_HOME will be /opt/Adempiere.

First, you need to restore the database from the provided dump file. Run the command below:

sudo  -u postgres psql adempiere < $ADEMPIERE_HOME/data/Adempiere_pg.dmp

You will see in the console, the Postgresql script is running and creating the necessary tables and data into adempiere database.

Second, you need to execute the setup script. I found that before running the setup script, I need to give execution permission to the script. So type the following to do so:

sudo chmod +x $ADEMPIERE_HOME/RUN_setup.sh

Then I execute the setup script as below:

sudo $ADEMPIERE_HOME/RUN_setup.sh

You will get the Adempiere Server Setup dialog as below:
Adempiere Server Setup

If you don’t wish to use the default values, you can change it to below values:

  1. Web Port : 8088
  2. SSL : 4443
  3. Database Server : localhost
  4. Database Type : postgresql
  5. Database Name: adempiere
  6. System Password: [postgres password in Postgresql]
  7. Database User: adempiere
  8. Database Password: [adempiere password in Postgresql]

Click on the Test button, if everything goes well you should be able to see the Save button is enabled. Click on the Save button. A License Agreement dialog will pop-up. Click on Yes, I Understand and Accept button. You should be able to see on the console, where your ran the RUN_setup.sh script, is running and processing as shown below:
Adempiere Setup Console

Once you see, BUILD SUCCESSFUL in the console, you can close everything.

Next you can run the Adempiere script like below:

$ADEMPIERE_HOME/RUN_Adempiere.sh

By default, Adempiere comes with default data, so you can login with sample data. Try login with username and password as GardenAdmin.