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)
[edit]
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"
[edit]
How to Install Webmin

Webmin is an browser-based administration tool for Apache, PHP, MySQL, and Much More.
wget http://garr.dl.sourceforge.net/sourceforge/webadmin/webmin_1.400_all.deb

(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)
https://localhost:10000
[edit]
Sun Java Application Server (Java EE)

Official documentation
[edit]
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.
[edit]
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.
[edit]
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
[edit]
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
[edit]
Tomcat 6
[edit]
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 http://tomcat.apache.org/download-60.cgi 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/setclasspath.sh 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/catalina.sh 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.
[edit]
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.
[edit]
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.
[edit]
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).
echo $CATALINA_HOME
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:


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">


PostgreSQL connectivity
jdbc/postgresql
javax.sql.DataSource
Container



Page for testing

Testing page

pgsqlVersion
pgsqlVersion


pgsqlVersion
/pgsqlVersion



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


name="jdbc/postgresql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://host/database"
username="user"
password="password"
maxActive="20"
maxIdle="10"
maxWait="-1"/>
WEB-INF/web.xml
META-INF/context.xml


Create pgsqlVersion.java and set its content:
import java.io.*;
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 {
response.setContentType("text/html");
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()");
rs.next();
pw.println(rs.getString("version"));
rs.close();
stat.close();
} catch(Exception e) { }
}
}

Create index.html and set its content:
"http://www.w3.org/TR/html4/frameset.dtd">


PostgreSQL datasource







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

Finally, visit http: //host:8080/dataSourceTest. Thats all!
[edit]
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.
[edit]
NFS Server
Read Linux NFS FAQ
Run this command for each computer to determine the IP Addresses for each one:
ifconfig
[edit]
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 192.168.1.1 and 192.168.1.254 with Read/Write access:
/path/to/shared/files 192.168.1.0/24(rw,no_root_squash,async)

This will export path to all IP addresses between 192.168.1.1 and 192.168.1.254 with Read Only access:
/path/to/shared/files 192.168.1.0/24(ro,async)

192.168.1.0/24 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
[edit]
Installing NFS Client

Use this script (For installing nfs client and mounting automatically) or follow the guide:
sudo apt-get install portmap nfs-common
[edit]
Mounting Manually
cd ~
mkdir temp
sudo mount 192.168.1.1:/path/to/shared/files temp

192.168.1.1 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
[edit]
Mounting Automatically

Create mountpoint:
sudo mkdir /mnt/files

Edit configuration:
gksudo gedit /etc/fstab

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

Test new configuration:
sudo mount -a

Reboot to test automatic mounting.
[edit]
Hardware
[edit]
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
[edit]
Envy- nvidia driver installer script

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

Download NVClock: http://www.linuxhardware.org/nvclock/#download

Extract package to your home folder.

In Terminal, input the following commands in order:
cd nvclock0.8b2
./configure
make
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
[edit]
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.
[edit]
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"
EndSection

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.
[edit]
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"
EndSection

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.
[edit]
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"
EndSection

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.
[edit]
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"
EndSection
[edit]
Disable CAPS LOCK

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.
[edit]
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
fi
Next time you reboot, your NUM LOCK should default to "on."
[edit]
BSNL Broadband (dataone) speedup

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

208.67.222.222 and 208.67.220.220 or

4.2.2.1 and 4.2.2.2 or

search Google for free DNS service providers.
[edit]
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 Citrix.com 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
./setupwfc
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.
[edit]
WINE

Latest install instructions are always at: WineHQ.org

Add repository key:
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

Add repository to apt sources:
sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/gutsy.list -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.
[edit]
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:
wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux


There is a beta version of the install at http://www.tatanka.com.br/ies4linux/downloads

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.
[edit]
Wine-Doors

Wine-Doors http://www.wine-doors.org/ packages Windows applications for Wine. The current package list includes Internet Explorer 6.

Debian/Ubuntu package (single click) available for download.
[edit]
QEMU

Qemu http://fabrice.bellard.free.fr/qemu/ process emulator.
[edit]
How to run windows XP under qemu

If your hardware supports virtualization, run this script after giving it executing permissions.
[edit]
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
[edit]
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 https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/156085/comments/5
[edit]
Parallels Virtualization Software in Ubuntu

If you want to install Parallels Virtualization Software in Ubuntu try this
Parallels Virtualization Software Setup in Ubuntu
[edit]
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
Add
deb http://ubuntu.cafuego.net gutsy-cafuego bcm43xx
Then do this to add the signature
wget http://ubuntu.cafuego.net/AF425CB5.gpg -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.
[edit]
Requests

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

No comments: