Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Language: German English

Install Gnome3 on Ubuntu 11.04 Natty or Ubuntu 10.10 Maverick

Run the following commands in your terminal:

On Ubuntu 11.04:

add-apt-repository ppa:gnome3-team/gnome3
aptitude update
aptitude dist-upgrade
aptitude install gnome-shell

On Ubuntu 10.10:

add-apt-repository ppa:ubuntu-desktop/gnome3-builds
aptitude update
aptitude install gnome3-session

Note: This repository is outdated !

Lock out and back in, after completing the installation. (Choose Gnome3)

Remove:

aptitude install ppa-purge
ppa-purge ppa:gnome3-team/gnome3

Links:

* http://www.gnome.org

* http://www.ubuntu.com

Comments: 0 | Read Comments | Write a Comment |

Enable SNMP on Citrix XenServer 5.6

Open XenServer Console or open a SSH connection to your XenServer for this howto:

1. Firewall Settings

Open “/etc/sysconfig/iptables” with “vi” editor and add the following line to allow SNMP connections:

-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT

Restart iptables service:

service iptables restart

2. Configurate SNMPD

Edit “/etc/snmp/snmpd.conf” and insert the following lines:

[...]
com2sec MY-TRUST-NET 192.168.0.0/24      public
[...]

[...]
group   notConfigGroup v1            MY-TRUST-NET
[...]

Note: Replace “192.168.0.0/24″ with your Subnet.

Now start the SNMP-Deamon with:

service snmpd start

To start SNMP automatic on system startup execute the following command:

chkconfig snmpd on

Note: This settings are not persistant. If you upgrade your XenServer you have to make this settings again.

3. Links

* http://support.citrix.com/article/CTX122337
* HP SNMP Agents for Citrix XenServer

Comments: 1 | Read Comments | Write a Comment |

Ubuntu Lucid on XenServer 5.6 FP1

Describes howto install Ubuntu Lucid 10.04 LTS (32-Bit or 64-Bit) on a Citrix XenServer 5.6 FP1 and convert the virtual machine into a template.

Note: Click to enlarge a picture.

1. Create a new virtual machine

Select template “Ubuntu Lucid Lynx 10.04 (64-bit)” and choose name and description for your virtual machine (or 32-Bit if necessary). Select “Install from URL” and insert the URL http://archive.ubuntu.net/ubuntu

xl1xl2xl3

Specify the number of vCPUs and the memory for your virtual machine and create the virtual disks.

xl4xl5

I choose a 8 GB Disk for the system and 1 GB for the swap disk.
By using 2 different disks i can delete the swap partition if i don’t need it or can replace disks with bigger ones.

At least add network interfaces to your VM. This depends on your XenServer network setup. Choose a bonding or single interface here for example and finish the virtual machine wizzard.

XenServer now builds your virtual machine and start it.

If the virtual machine is ready open the console to the virtual machine and start the installation of Ubuntu:

xl6xl7xl8

Choose your country and keyboard layout and configurate the network interface.
If you don’t have a DHCP Server in your network you choose “manual” and configurate the network by hand.

xl9xl10xl11xl12

Enter the hostname and domain name. In this example, my system is called xen.local, so I enter xen and local:

xl13xl14

Choose a mirror of the Ubuntu archive.
Please check if the installer detected your time zone correctly. If so, select Yes, otherwise No:

xl15xl16

Partitioning

Now you have to partition your hard disks.
First select “manual” and select the first virtual disk “xvda”. Create a new empty partition table and select the free disk space to create a new partition.
Use this partition as “Ext4 journaling file system” and as “/” mount point.

xl17xl18xl19xl20xl21

xl22xl23xl24







Now repeat all with “xvdb” but now create a “swap area”.

xl26xl27xl28xl29

The partitioning is totally up to you – if you know what you’re doing, you can also set up different partitions.
At least “Finish partitioning” and select “Yes” when you are asked “Write the changes to disks”. Now the new partitions are being created and formatted.

Afterwards the base system is being installed:
xl30

Create a user, for example the user “sebastian” with the user name “sebastian”:

xl31xl32xl33xl34

Note: I don’t need an encrypted private directory, so I choose No here.

Next the package manager apt gets configured. Leave the HTTP proxy line empty unless you’re using a proxy server to connect to the Internet.
I select “No automatic updates”. Of course, it’s up to you what you select here. But on a server i usually want to install the updates by myself.
Make your choce about automatic updates. Now the installer installs the system and download some essential packets. Make a small software selecten. I choose “Basic Ubuntu server” and “OpenSSH server” to get a small virtual machine.

xl35xl36xl37xl38

Now the GRUB boot loader gets installed. Select “Yes” when you are asked “Install the GRUB boot loader to the master boot record?”.

xl39xl40xl42

The base system installation is now finished. Hit “Continue” to reboot the system.

2. Install XEN Tools

In XenCenter, attach “xs-tools.iso” to the DVD drive of the VM.
Mount “xs-tools.iso”, install the correct XenServer Tools package (replace amd64 with i386 if necessary) and unmount “xs-tools.iso”.

mount /dev/cdrom /mnt
dpkg -i /mnt/Linux/xe-guest-utilities_5.6.100-647_amd64.deb
umount /mnt/

At least reboot the VM. Make sure the services run at boot time. If not try this:

update-rc.d -f xe-linux-distribution remove
update-rc.d xe-linux-distribution defaults

Reboot the VM for the last time.

3. Convert to template

Install all software on your virtual machine you need on all virtual machines and make all settings you need.

After you have made all your changes and settings shut down the virtual machine.

“Right click” on the virtual machine in your inventory and select “Convert to Template”

Now you can create new virtual machines with a basic setup for your environment.

Select “New VM from template” and choose your custom template.

Comments: 8 | Read Comments | Write a Comment |

Resize images (folder) with imagemagick (mogrify)

Before upload pictures to my online gallery i want to resize them to a smaller size. I don’t want to open all with a tool or something. I want to run a small script on my netbook without GUI.

First install imagemagick:

aptitude install imagemagick

Now “cd” into the directory with your images and execute:

mogrify -resize 800x600! *.JPG

All of the images will be replaced with resized version of themselves.

Now i can upload the directory to my gallery.

Comments: 0 | Read Comments | Write a Comment |

Change DNS-Server in XenServer 5.6 FP1

Citrix removed the change DNS from their console. But to change DNS-Server in “/etc/resolv.conf” are not solid settings.
If you reboot the server the settings will be changed back to the initial configuration.
You have to change it with “xe pif-reconfigure-ip”.

Change DNS-Server

First use

xe pif-list

to get the UUID of your PIF. You get an output like this:

uuid ( RO)                  : PIF-UUID
                device ( RO): eth0
    currently-attached ( RO): true
                  VLAN ( RO): -1
          network-uuid ( RO): NETWORK-UUID

You can view the current configuration of the interface with “xe pif-param-list uuid=PIF-UUID”.

To change the configration use the following command:

xe pif-reconfigure-ip uuid=PIF-UUID mode=static IP=IP-ADDRESS netmask=SUBNETMASK gateway=GATEWAY DNS=DNS-SERVER

Note: Use “DNS=DNS-SERVER-1,DNS-SERVER-2″ to specify more DNS-Servers.

Check your configuration with “xe pif-param-list uuid=PIF-UUID”.

Links:

http://forums.citrix.com/thread.jspa?messageID=1531853

Comments: 0 | Read Comments | Write a Comment |

Upgrade Debian Lenny to Squeeze on Citrix XenServer

Debian Logo

1. Update your Lenny installation

Make sure that your current Lenny is up-2-date.

aptitude update
aptitude upgrade

2. Change sources to Squeeze

Open “/etc/apt/sources.list” and replace “Lenny” with “Squeeze” here is an example:

# Debian Squeeze
deb http://ftp.de.debian.org/debian/ squeeze main
deb-src http://ftp.de.debian.org/debian/ squeeze main  

# Debian Squeeze Security
deb http://security.debian.org/ squeeze/updates main

3. Upgrade your system

aptitude update
aptitude install apt dpkg aptitude
aptitude full-upgrade

4. Upgrade Grub

Debian Squeeze use Grub2 you have to run “upgrade-from-grub-legacy” to upgrade from Grub to Grub2.

upgrade-from-grub-legacy
rm -f /boot/grub/menu.lst*

If you don’t do that, you get the following error in your XenServer.

Error: Starting VM 'YOUR_VM' - Using  to parse /boot/grub/menu.lst - Traceback (most recent call last): - File "/usr/bin/pygrub", line 746, in ? - raise RuntimeError, "Unable to find partition containing kernel" - RuntimeError: Unable to find partition containing kernel
Comments: 5 | Read Comments | Write a Comment |

Puppet Dashboard / Reports – Ubuntu

Puppet reports with “Puppet Dashboard“:

Installation:

Add the following lines to your “/etc/apt/sources.list” file:

deb http://apt.puppetlabs.com/ubuntu lucid main
deb-src http://apt.puppetlabs.com/ubuntu lucid main

Run

aptitude update

to updates your packet list.

If you get an “GPG error” because the public key is not available than add the Puppet Labs repository key to APT. (NO_PUBKEY 1054B7A24BD6EC30) run:

gpg --recv-key 1054B7A24BD6EC30
gpg -a --export 1054B7A24BD6EC30 | sudo apt-key add -

and try “aptitude update” again.

Now install Puppet Dashboard package:

aptitude install puppet-dashboard

You need an MySQL Server to store the reports:

aptitude install mysql-server

Now run “mysql” and create a database and a user for the puppet dashboard:

mysql -u root -p
mysql> CREATE DATABASE dashboard CHARACTER SET utf8;
mysql> CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';
exit;

Edit “/usr/share/puppet-dashboard/config/database.yml” and configure the “production” section:

production:
  database: dashboard
  username: dashboard
  password: password
  encoding: utf8
  adapter: mysql

Configure the database:

cd /usr/share/puppet-dashboard
rake RAILS_ENV=production db:migrate

Edit “/etc/default/puppet-dashboard” and uncomment the line:

START=yes

Now start puppet dashboard:

/etc/init.d/puppet-dashboard start

Edit “/etc/puppet/puppet.conf” on the puppetmaster and insert the following lines in the “[puppetmasterd]” section:

[puppetmasterd]
[...]
reports=puppet_dashboard
reportdir=/var/lib/puppet/reports
reporturl=http://SERVER:3000/reports
[...]

Note: Replace “SERVER” with the address of your puppetmaster server.

On the puppet clients edit the “/etc/puppet/puppet.conf” and modify the “[puppetd]” section:

[puppetd]
[...]
report=true
[...]

Note: You can do this via puppet, too !

Use puppet dashboard:

Open “http://SERVER:3000″ in your browser to access puppet dashboard.

Run puppet on your client (Restart puppet on the client or use puppetrun).

Look at the report with puppet dashboard in your browser.

Links:

* http://projects.puppetlabs.com/projects/dashboard
* http://searchenterpriselinux.techtarget.com/tip/Displaying-Puppet-reports-on-Puppet-Dashboard
* http://bitcube.co.uk/content/puppet-dashboard-v101-install
* http://www.craigdunn.org/2010/08/part-3-installing-puppet-dashboard-on-centos-puppet-2-6-1/

Comments: 1 | Read Comments | Write a Comment |

Install VirtualBox 4.0 on Ubuntu / Debian

1. Add new software repository

Edit the file ”/etc/apt/sources.list” with your favorite editor and add the following line depending on your Ubuntu version:

 

 
 

Ubuntu 10.10 (Maverick Meerkat)

deb http://download.virtualbox.org/virtualbox/debian maverick contrib

Ubuntu 10.04 (Lucid Lynx LTS)

deb http://download.virtualbox.org/virtualbox/debian lucid contrib

Ubuntu 9.10 (Jaunty Jackalope)

deb http://download.virtualbox.org/virtualbox/debian karmic contrib

2. Add the GPG-Key

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

3. Install VirtualBox

aptitude update
aptitude install virtualbox-4.0 dkms

Links

* http://www.virtualbox.org
* http://www.virtualbox.org/wiki/Changelog
* http://en.wikipedia.org/wiki/VirtualBox
* http://de.wikipedia.org/wiki/VirtualBox

Comments: 0 | Read Comments | Write a Comment |

Install Tomcat 7 on Debian (Lenny) with virtual hosts and Apache2 integration


This article is a new version of my Apache Tomcat 6 article. This article describes how to install Apache Tomcat 7 on Debian Lenny, Apache2 integration and virtual hosts. Tocat 7 is not available over the regular sources on Debain Lenny (and Etch) it need to be installed by hand.

Tomcat 7 is still BETA. Please use Tomcat 6 for productive servers.

1. Install Java 6 runtime:

Choose one of the following Java JDK installations:

1.1 OpenJDK

aptitude install openjdk-6-jre

1.2 Sun Java (non-free)

vim /etc/apt/sources
deb http://ftp.de.debian.org/debian/ lenny main non-free
deb-src http://ftp.de.debian.org/debian/ lenny main non-free
aptitude update
aptitude install sun-java6-jre

Note: Keep in mind that you need a different Apache connector configuration if you use the Sun JDK.

2. Download Tomcat

Download Tomcat 7 from Tomcat 7 Download page.

For example:

wget http://artfiles.org/apache.org/tomcat/tomcat-7/v7.0.5-beta/bin/apache-tomcat-7.0.5.tar.gz

3. Install Tomcat

tar -xzvf apache-tomcat-7.0.5.tar.gz
mv apache-tomcat-7.0.5 /opt/tomcat

4. Create tomcat user and group

groupadd tomcat
useradd -g tomcat -d /opt/tomcat tomcat
usermod -G www-data tomcat
chown tomcat:tomcat /opt/tomcat -R

This create a new user “tomcat” and a group “tomcat”. It set the home directory for this user to “/opt/tomcat” and join the “tomcat” user the “www-data” group. This is necessary to access the virtual hosts. Finally give the “/opt/tomcat” directory to the new “tomcat” user.

5. Create Init-Script

vim /etc/init.d/tomcat
#!/bin/sh
#
# /etc/init.d/tomcat -- startup script for the Tomcat 7 servlet engine
#
# Modified init-Script from Ubuntu Tomcat init-script
#
# 2010 - Sebastian Mogilowski - http://www.mogilowski.net
#
### BEGIN INIT INFO
# Provides:          tomcat
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/tomcat
NAME=tomcat
DESC="Tomcat servlet engine"
DEFAULT=/etc/default/$NAME
JVM_TMP=/tmp/tomcat-tmp

if [ `id -u` -ne 0 ]; then
	echo "You need root privileges to run this script"
	exit 1
fi

# Make sure tomcat is started with system locale
if [ -r /etc/default/locale ]; then
	. /etc/default/locale
	export LANG
fi

. /lib/lsb/init-functions

if [ -r /etc/default/rcS ]; then
	. /etc/default/rcS
fi

# The following variables can be overwritten in $DEFAULT

# Run Tomcat 7 as this user ID and group ID
TOMCAT_USER=tomcat
TOMCAT_GROUP=tomcat

# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm"

# Look for the right JVM to use
for jdir in $JDK_DIRS; do
    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
	JAVA_HOME="$jdir"
    fi
done
export JAVA_HOME

# Directory where the Tomcat binary distribution resides
CATALINA_HOME=/opt/$NAME

# Directory for per-instance configuration files and webapps
CATALINA_BASE=/opt/$NAME

# Use the Java security manager? (yes/no)
TOMCAT_SECURITY=no

# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
	JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
fi

# End of variables that can be overwritten in $DEFAULT

# overwrite settings from default file
if [ -f "$DEFAULT" ]; then
	. "$DEFAULT"
fi

if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then
	log_failure_msg "$NAME is not installed"
	exit 1
fi

POLICY_CACHE="$CATALINA_BASE/work/catalina.policy"

if [ -z "$CATALINA_TMPDIR" ]; then
	CATALINA_TMPDIR="$JVM_TMP"
fi

# Set the JSP compiler if set in the tomcat.default file
if [ -n "$JSP_COMPILER" ]; then
	JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=\"$JSP_COMPILER\""
fi

SECURITY=""
if [ "$TOMCAT_SECURITY" = "yes" ]; then
	SECURITY="-security"
fi

# Define other required variables
CATALINA_PID="/var/run/$NAME.pid"
CATALINA_SH="$CATALINA_HOME/bin/catalina.sh"

# Look for Java Secure Sockets Extension (JSSE) JARs
if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then
    JSSE_HOME="${JAVA_HOME}/jre/"
fi

catalina_sh() {
	# Escape any double quotes in the value of JAVA_OPTS
	JAVA_OPTS="$(echo $JAVA_OPTS | sed 's/\"/\\\"/g')"

	AUTHBIND_COMMAND=""
	if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
		JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
		AUTHBIND_COMMAND="/usr/bin/authbind --deep /bin/bash -c "
	fi

	# Define the command to run Tomcat's catalina.sh as a daemon
	# set -a tells sh to export assigned variables to spawned shells.
	TOMCAT_SH="set -a; JAVA_HOME=\"$JAVA_HOME\"; source \"$DEFAULT\"; \
		CATALINA_HOME=\"$CATALINA_HOME\"; \
		CATALINA_BASE=\"$CATALINA_BASE\"; \
		JAVA_OPTS=\"$JAVA_OPTS\"; \
		CATALINA_PID=\"$CATALINA_PID\"; \
		CATALINA_TMPDIR=\"$CATALINA_TMPDIR\"; \
		LANG=\"$LANG\"; JSSE_HOME=\"$JSSE_HOME\"; \
		cd \"$CATALINA_BASE\"; \
		\"$CATALINA_SH\" $@"

	if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
		TOMCAT_SH="'$TOMCAT_SH'"
	fi

	# Run the catalina.sh script as a daemon
	set +e
	touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
	chown $TOMCAT_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
	start-stop-daemon --start -b -u "$TOMCAT_USER" -g "$TOMCAT_GROUP" \
		-c "$TOMCAT_USER" -d "$CATALINA_TMPDIR" \
		-x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH"
	status="$?"
	set +a -e
	return $status
}

case "$1" in
  start)
	if [ -z "$JAVA_HOME" ]; then
		log_failure_msg "no JDK found - please set JAVA_HOME"
		exit 1
	fi

	if [ ! -d "$CATALINA_BASE/conf" ]; then
		log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE"
		exit 1
	fi

	log_daemon_msg "Starting $DESC" "$NAME"
	if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
		--user $TOMCAT_USER --exec "$JAVA_HOME/bin/java" \
		>/dev/null; then

		# Regenerate POLICY_CACHE file
		umask 022
		echo "// AUTO-GENERATED FILE from /opt/tomcat/" \
			> "$POLICY_CACHE"
		echo ""  >> "$POLICY_CACHE"
		cat $CATALINA_BASE/conf/*.policy \
			>> "$POLICY_CACHE"

		# Remove / recreate JVM_TMP directory
		rm -rf "$JVM_TMP"
		mkdir -p "$JVM_TMP" || {
			log_failure_msg "could not create JVM temporary directory"
			exit 1
		}
		chown $TOMCAT_USER "$JVM_TMP"

		catalina_sh start $SECURITY
		sleep 5
        	if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
			--user $TOMCAT_USER --exec "$JAVA_HOME/bin/java" \
			>/dev/null; then
			if [ -f "$CATALINA_PID" ]; then
				rm -f "$CATALINA_PID"
			fi
			log_end_msg 1
		else
			log_end_msg 0
		fi
	else
	        log_progress_msg "(already running)"
		log_end_msg 0
	fi
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"

	set +e
	if [ -f "$CATALINA_PID" ]; then
		start-stop-daemon --stop --pidfile "$CATALINA_PID" \
			--user "$TOMCAT_USER" \
			--retry=TERM/20/KILL/5 >/dev/null
		if [ $? -eq 1 ]; then
			log_progress_msg "$DESC is not running but pid file exists, cleaning up"
		elif [ $? -eq 3 ]; then
			PID="`cat $CATALINA_PID`"
			log_failure_msg "Failed to stop $NAME (pid $PID)"
			exit 1
		fi
		rm -f "$CATALINA_PID"
		rm -rf "$JVM_TMP"
	else
		log_progress_msg "(not running)"
	fi
	log_end_msg 0
	set -e
	;;
   status)
	set +e
	start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
		--user $TOMCAT_USER --exec "$JAVA_HOME/bin/java" \
		>/dev/null 2>&1
	if [ "$?" = "0" ]; then

		if [ -f "$CATALINA_PID" ]; then
		    log_success_msg "$DESC is not running, but pid file exists."
			exit 1
		else
		    log_success_msg "$DESC is not running."
			exit 3
		fi
	else
		log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
	fi
	set -e
        ;;
  restart|force-reload)
	if [ -f "$CATALINA_PID" ]; then
		$0 stop
		sleep 1
	fi
	$0 start
	;;
  try-restart)
        if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
		--user $TOMCAT_USER --exec "$JAVA_HOME/bin/java" \
		>/dev/null; then
		$0 start
	fi
        ;;
  *)
	log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
	exit 1
	;;
esac

exit 0

Download the init-script: Tomcat 7 Init-Script (2.6 kB)

chmod +x /etc/init.d/tomcat
update-rc.d tomcat defaults

6. Activate the Tomcat manager

vim /opt/tomcat/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <role rolename="manager"/>
    <role rolename="manager-gui"/>
    <role rolename="admin"/>
    <role rolename="admin-gui"/>
    <user username="YOUR_USERNAME" password="YOUR_PASSWORD" roles="admin,admin-gui,manager,manager-gui"/>
</tomcat-users>

6. Start Tomcat

/etc/init.d/tomcat start

Now you can access the Tomcat manager with http://SERVER:8080/manager.

7. Install Apache2 connector

You can use the Tomcat as a standalone webserver, but the apache webserver has more features and you can use the apache modules. (mod_rewrite for example)

aptitude install apache2 libapache2-mod-jk

7.1 Apache worker

vim /etc/apache2/workers.properties
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/lib/jvm/java-6-openjdk
ps=/
worker.list=default
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1

Note: Replace “/usr/lib/jvm/java-6-openjdk” with “/usr/lib/jvm/java-6-sun” if you using the non-free Sun Java runtime.

7.2 JK configuration file

vim /etc/apache2/conf.d/jk.conf
<ifmodule mod_jk.c>
    JkWorkersFile /etc/apache2/workers.properties
    JkLogFile /var/log/apache2/mod_jk.log
    JkLogLevel error
</ifmodule>
/etc/init.d/apache2 stop
/etc/init.d/tomcat restart
/etc/init.d/apache2 start

8. Create a new VirtualHost

Creating a new VirtualHost: (In Apache AND Tomcat)

8.1 Create directories

mkdir /var/www/vhost1
mkdir /var/www/vhost1/htdocs
mkdir /var/www/vhost1/logs
vim /etc/apache2/sites-available/vhost1

8.2 Apache

<virtualhost www.testsrv.local>
    JkMount /*.jsp default
    ServerName www.testsrv.local
    ServerAdmin servermaster@testsrv.local
    DocumentRoot /var/www/vhost1/htdocs
    ErrorLog /var/www/vhost1/logs/error.log
    CustomLog /var/www/vhost1/logs/access.log common
    <directory /var/www/vhost1/htdocs>
        Options -Indexes
    </directory>
</virtualhost>

Note: You can forward all files “JkMount /*” or all files in a folder “JkMount /folder/*” to the Tomcat, too.

a2ensite vhost1
/etc/init.d/apache2 reload

8.3 Tomcat

vim /opt/tomcat/conf/server.xml
<!-- www.testsrv.local -->
<Host name="www.testsrv.local" appBase="/var/www/vhost1" unpackWARs="true" autoDeploy="true">
    <Context path="" docBase="htdocs" debug="0" reloadable="true"/>
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/www/vhost1/logs"  prefix="tomcat_access_" suffix=".log" pattern="common" resolveHosts="false"/>
</Host>

Note: Make sure you use a uppercase “H”, “C” and “V” for “Host”, “Content” and “Value”. This is importand since Tomcat 7.

/etc/init.d/tomcat restart

Note: You can add additional domains with:

<Alias>additionaldomain.com</Alias>

9. Create a Testpage

vim /var/www/vhost1/htdocs/test.jsp
<html>
    <head>
        <title>Hello World</title>
    </head>
    <body>
        <h1>Hello World</h1>
        Today is: <%= new java.util.Date().toString() %>
    </body>
</html>

Now you can test your configuration with http://www.testsrv.local/test.jsp

Comments: 35 | Read Comments | Write a Comment |

VMWare Open Virtualization Format Tool

Command line utility that supports import and export of OVF packages.

Download

Download VMWare Open Virtualization Format Tool here:

http://communities.vmware.com/community/vmtn/vsphere/automationtools/ovf

You can download this tool for Windows (64-Bit or 32-Bit), Linux (64-Bit or 32-Bit) and Mac OSX.

Install

chmod +x VMware-ovftool-2.0.1-260188-lin.x86_64.sh
./VMware-ovftool-2.0.1-260188-lin.x86_64.sh

Convert OVF to VMX

/opt/vmware/ovftool/ovftool /path/to/vm.ovf /path/to/vm.vmx

Convert VMX to OVF

/opt/vmware/ovftool/ovftool /path/to/vm.vmx /path/to/vm.ovf

More inforamtions and examples

See more examples in the documentation:

OVF Tool Userguide

Comments: 1 | Read Comments | Write a Comment |

Previous Posts Next posts