martedì 25 gennaio 2011

Transfer files through ssh

As long as you can access a site with ssh account, then you can transfer files using scp, try to imagine , you are from host A and you have access to host B through ssh with same user account call foobar. You can copy a file from host B by example as bellow

scp foobar@hostB:~/myfile.txt .

:~/ actually leads you to home directory of foobar, as long as the file is accessible by the account foobar in host B, than it can be transfer. The other way round is transfer file from host A to host B.

scp myfile.txt foobar@hostB:~/

It support to copy a folder from one host to another by adding option -r

scp -r foobar@hostB:~/myfolder .

Copy from one host to another with different ssh account.

scp foobar@hostB:~/myfile.txt root@hostF:~/

mercoledì 19 gennaio 2011

Make a script on Ubuntu

Create a script file with a text editor
sudo gedit

Insert text for a simple test:


echo Hello World
echo -n Press return to continue...
read ans

In the Command section of the Launcher setup, the following would be specified:
sh /home/user/

Or alternatively, if the script has execute permissions:

If you want make the script executable:
sudo chmod 744

VirtualBox Shared folders on Ubuntu 10.04 client

Required: Virtualbox Guest Additions. See this post:

Prepare host

Click on Devices and then Shared Folders in Virtualbox:

Click on the add button in the Shared Folder dialog:

Click on the down arrow in the Folder Path field, select Other and navigate to the folder you create:


Make a note of the Folder Name since you'll be needing it in a minute. Check off Make Permanent to ensure the shared folder stays shared after you shutdown or reboot your virtual machine:

Prepare guest
If the client is Linux, you have to mount and connect it to a folder.

The following bash commands (in the client) would setup a correct mount (and creates a link from your desktop) Note: you should not use spaces in the share name.

sudo mkdir /mnt/sharename 
sudo chmod 777 /mnt/sharename
sudo mount -t vboxsf -o uid=1000,gid=1000 Example-Shared-Folder /mnt/sharename
ln -s /mnt/sharename $HOME/Desktop/sharename

Note: if you want to mount the folder as owned and writable only by root, omit the  -o uid=1000,gid=1000  option to the mount command.

For the above command if you get error as

mount: unknown filesystem type 'vboxsf'

Then just change the vboxsf to vboxfs

If error persist install virtualbox guest utils:

sudo apt-get install virtualbox-ose-guest-utils

end reboot the virtual machine.

To ensure the shared folder is mounted whenever your virtual machine is booted, run the following command: sudo nano /etc/rc.local and enter the command you entered in the last step (without the sudo in front) into this file below the hashes (i.e., #'s) but above “exit 0” (note that the arrow keys move the cursor and ctrl+x is used to exit which will prompt you to save first, answer Y, then hit Enter)

sudo mount -t vboxsf -o uid=1000,gid=1000 Example-Shared-Folder /mnt/sharename

Exit the terminal by typing: exit or by pressing ctrl+d.

Congratulations, you now have a functional Linux Mint virtual machine to use for any purpose you see fit. Please see below if you would like to enable hardware video acceleration on your virtual machine.

martedì 18 gennaio 2011

How To Install Virtualbox Guest Additions On A Ubuntu 10.04 Lucid Lynx Virtual Machine

First, go to the Devices menu for your virtual machine, and select Install Guest Additions.

This will mount a CD image in your Ubuntu virtual machine with the Guest Additions installer; you should see the icon appear on your virtual machine’s Desktop. Double-click on the icon to mount it.

Next, open a Terminal window.You’ll need to navigate to the /media directory, and then change to the directory representing the CD image.

cd /media/

The name is usually something like VBOXADDITIONS_version_release, for example:


Change to the VBOXADDITIONS directory, and then launch the installer. You can do this with this command for a 32 bit virtual machine:

sudo ./

For a 64 bit machine:

sudo ./

Type your password to authenticate, and the Guest Additions Installer will launch. It usually takes a few minutes to complete, and once you’re finished, the installer will return you to the Terminal prompt.

Once the installer is done, reboot your Ubuntu virtual machine.

When your Ubuntu virtual machine reboots, it will now support mouse integration, and you’ll be able to increase the resolution beyond 800×600.

The video below will show you how to install Guest Additions with Ubuntu 10.04. Once you see how it’s done it will only take a few minutes and one VirtualBox restart, then you’re good to go.

sabato 15 gennaio 2011

Firefox 4.0 Beta 9 Available for Download – Get Your Copy Now

Here is some great news for anyone who loves Firefox! The latest beta version for the 4.0 releases is now available for download. So make certain to get your own copy and start enjoying all of that fresh Firefox goodness.

Another bonus for the latest beta release is the adoption of the tabs on the title bar feature when the window is maximized! Looking very nice…

Firefox in UbuntuFirefox 4, currently in beta, is one of the latest versions of the Mozilla Firefox browsers and has some of the all time best features of the Mozilla Firefox browser. We had reviewed Firefox 4.0 Beta for Linux sometime back and found that it is around 30% faster than Firefox 3.6.6 (the current stable release). In this article we will tell you how to install Firefox 4 Browser in Ubuntu Linux using the Ubuntu Mozilla PPA (repository).
This beta version of Firefox 4 browser from the Ubuntu Mozilla PPA is compatible with the following versions of Ubuntu linux:
  • Ubuntu 10.10 Maveric Meerkat
  • Ubuntu 10.04 Lucid Lynx
  • Ubunty 9.10 Karmic Koala

How to Install?

Step 1:
Setup the Mozilla - Ubuntu daily PPA and update your package list using the following command:

sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa && sudo apt-get update

Step 2:
After the repository gets updated, you can install Firefox-4.0 on your Ubuntu system using the following command:

sudo apt-get install firefox-4.0

You can start using Firefox 4.0 by either launching it from the Applications > Internet Menu in GNOME, or directly from the command line by just using this command:


Firefox 4 Minefield in Ubuntu

However, it may be possible that after you try to launch Firefox-4.0 from the command line, what actually gets launched is the Firefox 3.6. This is a simple symbolic links issue and you can fix it by using this command:

sudo ln -s /usr/lib/firefox-4.0b6pre/firefox-4.0 /usr/bin/firefox-4.0

Please not that at the time of writing this article, Firefox 4.0 is a Beta 6 release so the corresponding folder name: firefox-4.0b6pre. So in case you get an error while running this command, just repace the folder name with the appropriate folder corresponding to the newer version.

Install Tomcat 6 on Ubuntu

If you are running Ubuntu and want to use the Tomcat servlet container, you should not use the version from the repositories as it just doesn’t work correctly. Instead you’ll need to use the manual installation process that I’m outlining here.

Before you install Tomcat you’ll want to make sure that you’ve installed Java. I would assume if you are trying to install Tomcat you’ve already installed java, but if you aren’t sure you can check with the dpkg command like so:

dpkg –get-selections | grep sun-java

This should give you this output if you already installed java:

sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install

If that command has no results, you’ll want to install the latest version with this command:

sudo apt-get install sun-java6-jdk


Read my post for last JDK or follow:

sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install

Now we’ll download and extract Tomcat from the apache site. You should check to make sure there’s not another version and adjust accordingly.

tar xvzf apache-tomcat-6.0.14.tar.gz

The best thing to do is move the tomcat folder to a permanent location. I chose /usr/local/tomcat, but you could move it somewhere else if you wanted to.

sudo mv apache-tomcat-6.0.14 /usr/local/tomcat

Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in your .bashrc file. You could also edit your file if you so chose.

The better method is editing your .bashrc file and adding the bolded line there. You’ll have to logout of the shell for the change to take effect.

vi ~/.bashrc

Add the following line:

export JAVA_HOME=/usr/lib/jvm/java-6-sun

At this point you can start tomcat by just executing the script in the tomcat/bin folder.

Automatic Starting

To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.

sudo vi /etc/init.d/tomcat

Now paste in the following:

# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
exit 0

You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Enjoy!

sudo /etc/init.d/tomcat restart

giovedì 13 gennaio 2011

Polifemo: Working Capital Tour 2010 Padova: in the morning f...

Polifemo: Working Capital Tour 2010 Padova: in the morning f...: " The day began with greetings institutional Ivo Rossi, Alessandro Paccagnella Silverio Bolognani and they did the honors. Riccardo Luna..."


Polifemo: Prize to the "brains" that do not migrate

Polifemo: Prize to the "brains" that do not migrate: " October 14, 2010 - page 26 Section: Commentary Innovation can also be done in Italy, even in the new frontiers of the Internet. Desp..."

Preventing Tomcat java.lang.OutOfMemoryError: PermGen space failure

The "OutOfMemoryError: PermGen space" message is normally encountered during development activites where a long-running JVM is asked to load/unload builds. However it can also be encountered in a recently spawned JVM under the "right" set of conditions.

The message is a symptom of an incomplete garbage collection sweep where resources are not properly released upon unload/restart.

Tomcat production server sometime will hit the following java.lang.OutOfMemoryError: PermGen space error.

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(

It’s usually happened when the Tomcat start and stop few times. It’s just funny, however you can fine tune it with some minor changes in the Tomcat configuration setting. By default, Tomcat assigned very little memory for the running process, you should increase the memory by make change in or catalina.bat file.

How to fix it?

1) Find where is located. We need to make some changes in "" file.
P.S is located at \tomcat folder \bin\

2) Assign following line to JAVA_OPTS variable and add it into file.
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Partial example of the file
# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
# (JSSE) installation, whose JAR files will be added to the
# system class path used to start Tomcat.
# CATALINA_PID (Optional) Path of the file which should contains the pid
# of catalina startup java process, when start (fork) is used
# $Id: 609438 2008-01-06 22:14:28Z markt $
# -----------------------------------------------------------------------------

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m
-Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

# OS specific support. $var _must_ be set to either true or false.
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;

# resolve links - $0 may be a softlink

3) Done. Restart Tomcat.
You should change the “Xms” and “PermSize” value base on your server capability.

mercoledì 12 gennaio 2011

Connect Tomcat 7 with Apache2 (mod_jk) and install Virtual Host

Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and processor cycles, to use its resources more efficiently.

One widely used application is shared web hosting. Shared web hosting prices are lower than a dedicated web server because many customers can be hosted on a single server.

Installa Apache Tomcat 7:

and install Apache2:

Install the connector:
sudo apt-get install libapache2-mod-jk

Now we move on to configure it to communicate with Apache Tomcat.
The first step is to create a file folder apache like this:
sudo gedit /etc/apache2/

End insert this text:
# Define 1 real worker using ajp13
# Set properties for worker (ajp13)

If you want add a new application in Virtual Web Host is not necessary to add a new workerX

Edit this file for connect tomcat's application with apache2:
sudo gedit /etc/apache2/httpd.conf

Past and copy this text:

ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128

Now we just have to disable the default configuration file for apache with:
sudo a2dissite default

We must also remove the line NameVirtualHost *: 80 as follows:
sudo gedit /etc/apache2/ports.conf

Reload e restart apache2
sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 restart

Edit file jk.load for load tomcat webapps in apache2 avaible web site

cd /etc/apache2/mods-available
sudo gedit jk.load

Past and copy this text:

LoadModule jk_module /usr/lib/apache2/modules/
# Where to find
# Update this path to match your conf directory location (put next to httpd.conf)
JkWorkersFile /etc/apache2/
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile     /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile     /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

And now edit proxy.conf

sudo gedit proxy.conf

This is new text:

<IfModule mod_proxy.c>
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.

ProxyRequests Off

<Proxy *>
AddDefaultCharset off
Order deny,allow
Allow from all
#Deny from all
#Allow from

# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block

ProxyVia On

Create the symbolik link in apache web site avaible:
cd /etc/apache2/mods-enabled 
sudo ln -s ../mods-available/jk.load ./jk.lo

We add in mods-enabled also links to the following modules

sudo ln -s ../mods-available/rewrite.load ./rewrite.load
sudo ln -s ../mods-available/proxy.load ./proxy.load
sudo ln -s ../mods-available/proxy.conf ./proxy.conf
sudo ln -s ../mods-available/proxy_ajp.load ./proxy_ajp.load

Create and edit the application's file (genetic is my web application name):
sudo gedit /etc/apache2/sites-available/genetic

Copy and past this text:

JKMount /genetic/* worker
JKMount /genetic worker

  RewriteEngine on
  RewriteRule ^/$ /genetic/ [R=permanent]
  RewriteRule ^/genetic/(.*)$ ajp://localhost:8009/genetic/$1 [P]

Create a symbolic link in enabled directory:

cd /etc/apache2/sites-enabled
sudo ln -s ../sites-available/genetic ./001-genetic

Let's create an application to be addressed
sudo gedit /usr/share/tomcat7/conf/server.xml

Add this text to hosts:

<Host name="" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="true" xmlNamespaceAware="false">
<Context path="" docBase="genetic/" reloadable="true" privileged="true" antiResourceLocking="false" anitJARLocking="false">

I create the folder for the application if the application does not exist

sudo mkdir /usr/share/tomcat7/webapps/genetic
cd /usr/share/tomcat7/webapps/genetic

Install application
sudo jar xvf genetic.war

Now your virtualhost in internet is actived. If you want virtualhost in localhost, edit hosts file:

sudo gedit /etc/hosts

Add in the line starting with

Install module rewrite
sudo a2enmod rewrite

Restart tomcat and reload Apache2

sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/tomcat7 restart

Write in your browser:
and see your tomcat webapp in apache

Install Apache2 with PHP5 and MySQL support on Ubuntu 10.10 (LAMP)

LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache2 webserver on an Ubuntu 10.10 server with PHP5 support (mod_php) and MySQL support.

1. Preliminary Note

In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

2. Installing MySQL 5

First we install MySQL 5 like this:

aptitude install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as, so we don't have to specify a MySQL root password manually later on:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

3. Installing Apache2

Apache2 is available as an Ubuntu package, therefore we can install it like this:

aptitude install apache2

Now direct your browser to, and you should see the Apache2 placeholder page (It works!):

Apache's default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

4. Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

aptitude install php5 libapache2-mod-php5

We must restart Apache afterwards:

/etc/init.d/apache2 restart

5. Testing PHP5
Getting details about your PHP5 installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php

Insert this code in info.php:


Now we call that file in a browser (e.g.

As you see, PHP5 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.

6. Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

aptitude search php5

Pick the ones you need and install them like this:

aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-p7s php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Now restart Apache2:

/etc/init.d/apache2 restart

Now reload in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

7. phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It's a good idea to install it:

aptitude install phpmyadmin

You will see the following questions:

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

Afterwards, you can access phpMyAdmin under

8 Links:


martedì 11 gennaio 2011

Install JDK 6 update 23 in Ubuntu 10.10

JDK (Java Development Kit) is a software that provides development tools for creating Java programs.


First we must download the package from the java website, select your platform, in our case Linux:

Here we go down the file "jdk-6u21-linux-i586.bin" to any folder, then leave where appropriate.

Now we have to give execute permissions:
sudo chmod +x jdk-6u23-linux-i586.bin

and install:
sudo ./jdk-6u23-linux-i586.bin

Now move the generated folder to a more appropriate directory:
sudo mv jdk1.6.0_23/ /usr/local

We set the new Java as one of the alternatives "java"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.6.0_23/bin/java" 1

Now we set the "new alternative" as real Java. This step makes the sun is the version used by default:
sudo update-alternatives --set java /usr/local/jdk1.6.0_23/bin/java

Now we do the same steps above for javac:

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/jdk1.6.0_23/bin/javac" 1
sudo update-alternatives --set javac /usr/local/jdk1.6.0_23/bin/javac

Now verify that everything works properly. Open the console and type:
java -version

If all is well, you should return the following:

java version "1.6.0_23"
Java (TM) SE Runtime Environment (build 1.6.0_23-B06)
Java HotSpot (TM) Client VM (build 17.0-b16, mixed mode, sharing)

For javac:
javac -version

If all is well back:
javac 1.6.0_23

If you have other installations of java / javac can be configured using the following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac

Also if you want setear JRE_HOME JAVA_HOME or as environment variables, we must go to:
sudo gedit /etc/environment

Here we record the routes where we have installed Java, in our case is as follows:
JAVA_HOME = "/usr/local/jdk1.6.0_23/bin/" (add)
JRE_HOME = "/usr/local/jdk1.6.0_23/jre" (add)
PATH ="...(other routes):$JAVA_HOME:$JRE_HOME (edit)

With this we finish the installation.

Install PostgreSQL 8.4 on Ubuntu 10.10

PostgreSQL is a database management system relational database and object-oriented free, released under the BSD license.

To install from Ubuntu to run in console the following line:
sudo apt-get install postgresql postgresql-client pgadmin3
This installs the engine and pgadmin3 client, a graphical tool to manage databases.
The next thing is to change the administrator password system PostgreSQL:
sudo passwd postgres
Now we must change the password of "user postgres" on the engine, it first entered with the following line:
psql -h localhost -U postgres -W template1
and then enter the following command:
ALTER USER postgres WITH PASSWORD 'password';
Finally out of postgres, enter the following command:
With this we have installed PostgreSQL. Settings
We set up remote access to our motor. This step is optional, only if you want to allow access to our server from other hosts.
First we edit the file postgresql.conf:
sudo gedit /etc/postgresql/8.4/main/postgresql.conf
Look for the line:
# Listen_addresses = 'localhost'
and change it to:
listen_addresses = '*'
We also look for the following line:
# Password_encryption = on
and change it to:
password_encryption = on
Now we edit the file "pg_hba.conf"
sudo gedit /etc/postgresql/8.4/main/pg_hba.conf
Modify the lines:

# Database administrative login by UNIX sockets
local   all         postgres                          ident


# "local" is for Unix domain socket connections only
local   all         all                               ident
# IPv4 remote connections:
host    all         all          md5
# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

We do this to use MD5 authentication with the user postgres.

Finally sent to restart:
sudo /etc/init.d/postgresql-8.4 restart
More information about the configuration:

The following video shows how to connect to PostgreSQL pgadmin3 and how to use:

lunedì 10 gennaio 2011

Install Tomcat 7 on Ubuntu 12.10

Apache has officially launched version 7.0 of the servlet container for Java applications, Tomcat. Major changes in this version, you can highlight support for Servlet 3.0 and JavaServer Pages 2.2.

Install JDK
See this post: Install JDK 6 update 23 in Ubuntu 10.10


The first thing to do is download the package "apache-tomcat-7.0.6.tar.gz" from the NEXT link [tar.gz]
Now unpack it with the following command:
tar xvzf apache-tomcat-7.0.8.tar.gz

Then we let in a more appropriate directory, in our case in / usr/share/tomcat7, but can be in any directory. We do this with the command:
sudo mv apache-tomcat-7.0.8/ /usr/share/tomcat7

Now we define the environment variables JAVA_HOME and JRE_HOME. This file is in the "environment" in / etc. Command to edit the file:
sudo gedit /etc/environment

Here we record the routes where we have installed Java in my case this is as follows:

PATH="...(other path):$JAVA_HOME:$JRE_HOME"

IMPORTANT: Verify the routes where they have installed Java.

I have had some problems in defining these environment variables, as sometimes tomcat does not recognize, but a surefire way of recognizing that tomcat is to define the file paths inside ""located in tomcat7/bin. To modify this file use the command:
sudo gedit /usr/share/tomcat7/bin/

Now just insert the JAVA_HOME and JRE_HOME after the first line, so the file is as follows:
# Licensed to the Apache Software Foundation (ASF)...

Now let's configure Tomcat users, this is done in the file "tomcat-users.xml"directory tomcat7/conf. Command to edit the file:
sudo gedit /usr/share/tomcat7/conf/tomcat-users.xml

Unlike previous versions where the administrator should own role "manager" now it should be "manager-gui"to operate on the web administration tomcat7. The file would be as follows:

<?xml version='1.0' encoding='utf-8'?>

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="admin"/>

<user username="usuario" password="contrasena" roles="manager-gui,admin-gui,manager,admin,manager-script,admin-script"/>

Now you should be all ready to try tomcat7.

First we must lift the server with the following command:
sudo /usr/share/tomcat7/bin/

With this we get the following output on console:
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using JRE_HOME: /usr/local/jdk1.6.0_20/jre
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

Verify that the JRE_HOME is where we define.

Now open your web browser and type the following url:

So we get the following page:

If we enter the administration Tomcat Manager we click on the menu or directly at URL:

Here we ask the user data from previous record in mind tomcat-users.xml.

I recommend testing the sample to make sure everything works ok, they are in the section "Miscellaneous" from the side menu or at the URL:


Start server:
sudo /usr/share/tomcat7/bin/

Stop server:
sudo /usr/share/tomcat7/bin/

Automatic Starting

To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.

sudo gedit /etc/init.d/tomcat7

Now paste in the following:

# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/

case $1 in
sh /usr/share/tomcat7/bin/
sh /usr/share/tomcat7/bin/
sh /usr/share/tomcat7/bin/
sh /usr/share/tomcat7/bin/
exit 0

You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat7

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Enjoy!

sudo /etc/init.d/tomcat7 restart

venerdì 7 gennaio 2011


Polifemo is my new project. This is a software that integrates dynamic data, including data about products and services directly from the shared database and management of those with an economic activity. These data are integrated into a geographic map.

Try the JNLP now

The idea then is to create value-added data that until now were only used for personal purposes. Sharing and integration would therefore benefit not only users but also those who decide to share their data. The next goals are to integrate the products and services and implement the search functions, optimizing the connectors so as to minimize the calls to the servers that share data, create a more usable client, view the bus routes and means of transport.

Find all information in project blog