Thursday, April 24, 2008

Ubuntu 7.10 LAMP Server

For the Desktop Edition users:-

System->Administration->Synaptic Package Manager->Edit->Mark Packages by Taskel.

Click on LAMP Server.

You are done.

If you are looking for simple LAMP Server setup in 15min including webmin installation this is for you
Ubuntu 7.10 LAMP Server Step By Step Guide

(This requires the server version of Gutsy Gibbon, not the standard desktop edition)
How to install Apache and PHP5

Install Apache
sudo aptitude install apache2

Install PHP5 and the Apache PHP5 module
sudo aptitude install php5 libapache2-mod-php5

Restart Apache
sudo /etc/init.d/apache2 restart

Go to http://localhost to verify the installation. If you want to change the port, edit the file /etc/apache/ports.conf and change where it says "Listen 80" to say "Listen" + the desired port number, e.g. "Listen 8080"
How to Install Webmin

Webmin is an browser-based administration tool for Apache, PHP, MySQL, and Much More.

(If newer version exist, just replace x.400 with newer version number.
sudo apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl

If hasn't setup ed the root password yet, type: sudo passwd root (In Ubuntu root password is not setuped during install process.) If prefer not to setup root password, must manual enter user name and password for webmin administrator account, if root exist, just use it to login with.
sudo dpkg -i webmin_1.400_all.deb

To use webmin, type the following in a browser: (Make sure to use HTTPS not HTTP)
Sun Java Application Server (Java EE)

Official documentation
Installing Application Server

Sun Java Application Server is the heart of Java EE. Download either of the following versions:
Java EE 5 SDK Update 3
Java Application Platform SDK Update 3 Beta
Sun Java System Application Server 9.1 (under individual download section)

Alternately you can download GlassFish application server (community maintained):
With Netbeans Web & Java EE pack
Download GlassFish directly

Make the download file executable and run as root by:
chmod +x Desktop/filename
sudo ./Desktop/filename

Lets assume $JAVAEE_HOME indicates the installation directory. The default installation directory for Sun Java System Application Server 9.1 is /opt/SUNWappserver/. Now, either add $JAVAEE_HOME/bin in your PATH or make a link of asadmin and asant in your path by
sudo ln -s $JAVAEE_HOME/bin/asadmin /usr/local/bin/asadmin
sudo ln -s $JAVAEE_HOME/bin/asant /usr/local/bin/ant

The command 'asadmin' is the main and most important command for Java Application server. Ant is also useful to automate building process.
Application Server configuration

When Java EE installs, a domain 'domain1' is automatically installed with it in $JAVAEE_HOME/domains/ which is the default directory for all domains. Generally this directory ($JAVAEE_HOME/domains/) is not writable. So, as a unprivileged user you can create your own domain in your home directory.
Application Server domain settings

To create, start, stop and delete a domain in your home directory:
asadmin create-domain --adminport 4848 --domaindir ~ mydomain
asadmin start-domain --domaindir ~ mydomain
asadmin stop-domain --domaindir ~ mydomain
asadmin delete-domain --domaindir ~ mydomain

Alternately you can make $JAVAEE_HOME/domains/ writable to do domain-related works from default domain directory. E.g.
sudo chmod a+w $JAVAEE_HOME/domains/
asadmin create-domain --adminport 4848 mydomain
asadmin start-domain mydomain
asadmin stop-domain mydomain
asadmin delete-domain mydomain

If you have only one domain in the default domains directory ($JAVAEE_HOME/domains/) then you do not have to give the domain name to start or stop a domain. E.g.
asadmin start-domain
asadmin stop-domain

You can save the login information to ~/.asadminpass file in order to administer an application server domain from command line. If you do not login, you have to provide username and password for each administrative work (analogous to su and sudo commands). To login:
asadmin login --host localhost --port 4848

Deploying and un-deploying a web or ejb module is very easy. Just do the following:
asadmin deploy test1.war
asadmin deploy test2.ear

asadmin undeploy test1.war
asadmin undeploy test2.ear
Application Server data Source settings

DataSource configuration can be done easily from web based administration console. Here command line method is given:
sudo ln -s /usr/share/java/postgresql.jar /opt/SUNWappserver/domains/domain1/lib/postgresql.jar
asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGSimpleDataSource --property
serverName=localhost:portNumber=5432:databaseName=database:user=user:password=pass jdbc/postgresql
asadmin create-jdbc-resource --connectionpoolid jdbc/postgresql database

First, we have made this driver accessible from the domain. In the second command, we have created a data source connection pool which has been assigned a JNDI name in the third command. Here all the colon (:) separated values are database related. Change them according to your database settings. Now you can create a Connection by, e.g.:
Context ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("database");
Connection conn = ds.getConnection();

To see available data sources and their corresponding JNDI names:
asadmin list-jdbc-connection-pools
asadmin list-jdbc-resources

To delete both connection pool, you have to delete JNDI name first. E.g.
asadmin delete-jdbc-resource database
asadmin delete-jdbc-connection-pool jdbc/postgresql
Tomcat 6
Installing tomcat

Tomcat can be found in universe repository but it has some drawbacks (e.g. lots of dependencies, unavailability of version 6.x, do not use Sun Java). Thus manual installation is recommended.

Download latest stable version of tomcat from and extract it in /usr/local as root. Add "JAVA_HOME=/usr/lib/jvm/java-6-sun/" to /usr/local/apache-tomcat-6.x.x/bin/ after the first occurrence of "CLASSPATH=". Make sure that sun-java6-jre is installed. Make a soft-link of /usr/local/apache-tomcat-6.x.x/bin/ as /usr/local/bin/tomcat to access easily. Optionally you can remove .exe and .bat files and edit .sh files to remove cygwin, os400 and darwin related codes.

Although not necessary, but the ant program would be useful here. You can also install its documentation.
OpenEJB Server

OpenEJB is an open source, modular, configurable, and extendable EJB Container System and EJB Server. Visit here to see the installation instructions for OpenEJB under Tomcat 6.
Using tomcat with NetBeans

You have to make the configuration files readable because Netbeans generally do not run with administrative privilege. To use Tomcat with with NetBeans, you have to set a user with manager role. A typcal $CATALINA_HOME/conf/tomcat-users.xml file would look like:

Edit this file after you have started tomcat once. Any data placed in the element is erased during the first start of tomcat. You can also use tomcat that comes with NetBeans web & Java EE pack.
Configure Database Connection Pool (DBCP) of Tomcat

A database connection pool creates and manages a pool of connections to a database. Recycling and reusing already existing connections to a dB is more efficient than opening a new connection. It is still possible and valid to open and close connection for each servlet/jsp (visit #Using_JDBC_driver for details).

Before proceeding, let's assume that $CATALINA_HOME denotes tomcat installation directory (typically: /usr/local/apache-tomcat-6.0.14).
sudo ln -s /usr/share/java/postgresql.jar $CATALINA_HOME/lib/postgresql.jar
sudo mkdir $CATALINA_HOME/webapps/dataSourceTest
sudo chown $USER:$USER $CATALINA_HOME/webapps/dataSourceTest
cd $CATALINA_HOME/webapps/dataSourceTest
mkdir META-INF WEB-INF WEB-INF/classes

Create WEB-INF/web.xml and set its content:


PostgreSQL connectivity

Page for testing

Testing page



Create META-INF/context.xml and set its content (replace hostname, database instance name, user id and password):


Create and set its content:
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import javax.servlet.*;
public class pgsqlVersion extends GenericServlet {
public void service(ServletRequest request, ServletResponse response) {
try {
PrintWriter pw=response.getWriter();
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/postgresql");
Connection conn = ds.getConnection();
Statement stat=conn.createStatement();
ResultSet rs=stat.executeQuery("SELECT version()");;
} catch(Exception e) { }

Create index.html and set its content:

PostgreSQL datasource

Then compile the servlet:
export CLASSPATH=$CATALINA_HOME/lib/postgresql.jar:$CATALINA_HOME/lib/servlet-api.jar:.
javac -d WEB-INF/classes/

Finally, visit http: //host:8080/dataSourceTest. Thats all!
Nagios Network Monitoring Server
Nagios Monitoring Server Setup Guide

It should be noted that this howto instructs you to build nagios from its sources, while it exists on the official repositories.
NFS Server
Read Linux NFS FAQ
Run this command for each computer to determine the IP Addresses for each one:
Installing NFS Server

Use this script or follow the guide:
sudo apt-get install nfs-kernel-server nfs-common portmap

Reconfigure Portmap to not bind to loopback interface:
sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

Define which folders to share (export):
sudo nano /etc/exports

Add share (export) definitions:

This will export path to all IP addresses between and with Read/Write access:

This will export path to all IP addresses between and with Read Only access:
/path/to/shared/files,async) above would be the clients IP Address

When finished, save changes and restart the NFS Server:
sudo /etc/init.d/nfs-kernel-server restart

Export your new configuration:
sudo exportfs -a
Installing NFS Client

Use this script (For installing nfs client and mounting automatically) or follow the guide:
sudo apt-get install portmap nfs-common
Mounting Manually
cd ~
mkdir temp
sudo mount temp above would be the Servers IP Address

You may need to restart NFS services:
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart
Mounting Automatically

Create mountpoint:
sudo mkdir /mnt/files

Edit configuration:
gksudo gedit /etc/fstab

Add something similar to below: /mnt/files nfs rsize=8192,wsize=8192,timeo=14,intr 0 0

Test new configuration:
sudo mount -a

Reboot to test automatic mounting.
NVidia Driver

First, determine what kernel you have running:
user@localhost:~$ uname -a
Linux localhost 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux

I have the generic kernel, so I need to install the following:
sudo apt-get install linux-restricted-modules-generic

After that's done, go to System > Administration > Restricted Drivers Manager and turn on the driver.

Some users may receive an error screen: "The software source for the packsge nvidia-glx-new is not enabled." This can be overcome by going to System > Administration > Software Sources and ticking all the boxes under the heading "Downloadable from the Internet", click close and then allow Ubuntu to reload the package lists. The NVidia drivers can then be enabled using the method above.

You can optionally prevent showing NVidia logo on startup by:
sudo nvidia-xconfig --no-logo
Envy- nvidia driver installer script

Alternatively you can auto install nvidia drivers using Envy. Download and run the application.
Overclock NVIDIA graphics card and change fan speeds

Download NVClock:

Extract package to your home folder.

In Terminal, input the following commands in order:
cd nvclock0.8b2
sudo make install

To set video card fan speed to run at startup, input the following into “Sessions,” where X = % maximum fan speed:
nvclock -f -F X
Wacom tablet

By default, options for the Wacom tablet are commented out. Type the following command to edit the xorg.conf file.
gksu gedit /etc/X11/xorg.conf

Uncomment the following by removing the "#" or just replace the tree lines:
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"

Save and restart your X-session by typing CTRL-ALT-BACKSPACE.
Microsoft Intellimouse

To get the scroll wheel and side buttons to be recognized, change your /etc/X11/xorg.conf mouse section to look like the following:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
Option "Buttons" "7"
Option "ButtonMapping" "1 2 3 6 7"

If you want the wheel scroll button to scroll in firefox rather than the side buttons make "ZAxisMapping" "6 7" and "ButtonMapping" "1 2 3 4 5".

At this point you can reboot your computer or restart X (Ctrl-Alt-BackSpace) to see if your forward/back buttons work in FireFox. You can test in a terminal with xev.
Logitech Marble Mouse

To get the scrollwheel effect on Logitech trackball (Marble Mouse), change your /etc/X11/xorg.conf mouse section to look like the following:
Section "InputDevice"
Identifier "MarbleMouse"
Driver "mouse"
Option "Protocol" "auto"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Buttons" "5"
Option "ButtonMapping" "1 8 3 6 7"
Option "EmulateWheel" "true"
Option "EmulateWheelTimeout" "300" # msec
Option "EmulateWheelButton" "6"
Option "YAxisMapping" "4 5"

Make sure that you have "MarbleMouse" under the server layout section as well.

The big left and right buttons work normally (click, right click) and pressing them at the same time acts as a middle click. Holding the small left button will let you scroll up and down with the trackball. Clicking small left and right buttons will let you go back/forward in firefox.

Thanks to imjustabill and Buffalo Soldier from the Ubuntu Forum. This works well on my computer.
Logitech MX510

To have the extra buttons on your MX510 working with X, you'll have to install and configure the evdev-drivers. Open up a terminal and enter:
sudo apt-get install xserver-xorg-input-evdev

Now, all you have to do is configure Xorg to work with the new driver. Always remember to back up original files before altering:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
gksudo gedit /etc/X11/xorg.conf

Locate and replace the InputDevice section which holds the information for your mouse, for example with the identifier Configured Mouse, and replace it with:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "evdev"
Option "CorePointer"
Option "Name" "Logitech MX510"

Logout or kill the X session using and login again. This should get all of your buttons and scrollwheel up and running, and even let you navigate the webbrowser history using the thumb buttons on the side.
Logitech MX518

I got the side mouse buttons on my Logitech MX518 working in Firefox. I am using the "evdev" driver, not the "mouse" driver. I am using Kubuntu 7.10 Gutsy, which already has the package "xserver-xorg-input-evdev" installed by default.

Simply change the mouse section of your /etc/X11/xorg.conf to this:

Section "InputDevice"
Identifier "Configured Mouse"
Driver "evdev"
Option "CorePointer"
Option "Buttons" "7"
Option "ZAxisMapping" "4 5"
Option "ButtonMapping" "1 2 3 6 7"
Option "Name" "Logitech USB-PS/2 Optical Mouse"

I like to remap mine to . Just run gnome-keyboard-properties with "System > Preferences > Keyboard", click on the "Layout Options" tab and then on the arrow next to "Ctrl key position". Selecting "Make CapsLock an additional Ctrl" does the trick.
Enabling NUM LOCK at boot

The Default behavior is for the NUM LOCK key to be off; if you are on a desktop and have a keypad though, entering digits from it can be much quicker and you may wish to have it enabled for entering login password, etc. Here's how:
From Synaptic, download and install "numlockx," or, from the command line;
sudo apt-get install numlockx
To get it working, you now have to edit the appropriate startup file. First, make sure you have a working backup of the file:
sudo cp /etc/gdm/Init/Default /etc/gdm/Init/Default.bak
Next, modify the gdm/Init file. In terminal:
gksudo gedit /etc/gdm/Init/Default
Scroll down to the end of the file, and above the line that says "exit 0" add the following:
if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
Next time you reboot, your NUM LOCK should default to "on."
BSNL Broadband (dataone) speedup

BSNL Broadband or Dataone provides high speed (2Mbps) Internet connectivity in India. The DNS servers provided by the BSNL ( and are very slow. Instead use Either of these: and or and or

search Google for free DNS service providers.
Citrix ICA client

The Citrix client no longer suffers from any of the previous Ubuntu version's problems of UTF8 font issues, OpenMotif depends, or flaky/broken browser integration. It just works!
Download the latest en.linuxx86.tar.gz (currently v10.6) from and save to your desktop
Right-click tar.gz file, and Extract Here
Open a Terminal
Programs > Accessories > Terminal
Change to the directory where we extracted the client
cd Desktop/en.linuxx86
Run the setup program
Select the defaults

Now, web files from Metaframe Presentation Server, Citrix Access Gateway, etc webpages will work fine in Firefox.

Someone may wish to add an entry on how to use the client to connect to a local Citrix farm.

Latest install instructions are always at:

Add repository key:
wget -q -O- | sudo apt-key add -

Add repository to apt sources:
sudo wget -O /etc/apt/sources.list.d/winehq.list

Update apt sources:
sudo apt-get update

Install WINE:
sudo apt-get install wine

The program menu then appears in Programs under Wine, or double-click a Windows/DOS .exe file.
Install Internet Explorer 6 for Wine

IE 6 is not recommended for general usage, but some Windows packages (installed under Wine) require IE6 to complete installation. Furthermore, IE 6 is useful for checking code for developers who want to see how their web pages appear under IE 6.

Install the required package cabextract from Synaptic Package Manager (or from apt-get install cabextract).

Download and run the IEs4Linux installation script from the IEs4Linux website:
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*

There is a beta version of the install at

If you hit advance you have the option to install IE7. I have not gotten it to work as of yet, but IE6 installs with no issues on amd64 and i386

Accept all the defaults for installation.

Wine-Doors packages Windows applications for Wine. The current package list includes Internet Explorer 6.

Debian/Ubuntu package (single click) available for download.

Qemu process emulator.
How to run windows XP under qemu

If your hardware supports virtualization, run this script after giving it executing permissions.
VMWare Server

Until the Commercial Ubuntu repository includes the VMWare Server, you can use the following 'How To' to compile from source.
Step By Step Vmware server setup guide including Screenshots
VMWare Tools

If you want to install VMware tools on ubuntu gutsy follow this steps
VMWare Tools Setup Guide Including Screenshots

To be able to use usb devices look at following bug comment at
Parallels Virtualization Software in Ubuntu

If you want to install Parallels Virtualization Software in Ubuntu try this
Parallels Virtualization Software Setup in Ubuntu
How to install Broadcom wireless driver
This worked for me Kubuntu 7.10 32 bit but there are several ways
First, make sure you have the appropriate hardware
lspci | grep Broadcom
Output should match this
02:03.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 02)
Then you have to add a repository
gksu gedit /etc/apt/sources.list
deb gutsy-cafuego bcm43xx
Then do this to add the signature
wget -O- | sudo apt-key add -
Back in the console
sudo apt-get update
sudo apt-get install bcm43xx-firmware
Just press yes, let it install, and reboot! Thanks to Pete and the 7.04 guide for this.

If you have requests that you would like to be part of this guide, write them in Ubuntu_talk:Gutsy.

No comments: