Running a Webserver on a Tonido Plug
Running a Webserver on a Tonido Plug - Getting Tomcat Running After Building It PDF Print E-mail
Written by Administrator   
Tuesday, 16 November 2010 20:16
Article Index
Running a Webserver on a Tonido Plug
Getting Started
Installing PlugBox Linux
Installing the Apache Webserver
Installing an FTP server on a Tonido Plug
Apache and Bftp Autostart at Boot
Getting a JDK to run on a Tonido Plug
Compiling Tomcat from source on Plugbox Linux
Getting Tomcat Running After Building It
All Pages

Getting Tomcat Running After Building It



  When I finished building, the output folder of the building process was left in a subdirectory of root's home folder.   I decided a more reasonable place to put it would be in /user/local/tomcat


mkdir /usr/local/tomcat
cd tomcat_build
cd trunk/output/build
cp -dprv * /usr/local/tomcat


 I think that I have to make another environment variable

CATALINA_HOME which points to the Tomcat folder /usr/local/tomcat

So I will edit the /etc/profile script.  Now the end of the script file looks like:


Here I am trying to start it up. From the /usr/local/tomcat/bin folder I'm going to run the script
[root@Plugbox bin]# ./ 

 Now to see if it is working, you can type your IP address into your browser and add 


:8080 to the address.  This should take you to a tomcat page if it is working.


Tomcat Running on a Tonido Plug Computer 



Sweet!   Tomcat runs!

Configuring Tomcat


 ok I think I want to turn down the memory used.   I don't know what the default settings are, but I know that my Tonido plug doesn't have nearly as much RAM as a typical desktop, so it is possible the defaults are going to be wasteful.

I learned from this blog page.


so now at the end of /etc/profile
I have:


So when I visited I was viewing the tomcat page!

You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>

So I went to my tomcat/conf folder and edited tomcat-users.xml
Near the end, but before the </tomcat-users> line I added:

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcatuser" password="mygirlfriendsname" roles="manager-gui,manager-script"/>

 Getting Tomcat to start up at boot time.

 I read the official Apache Tomcat page on how to do this.  They talk about running Tomcat as a daemon.   To do this, you need to use something called the jsvc tool, which sounded like another opportunity to waste hours of time.
  So instead, I just added the startup to /etc/rc.local file.   Since I am not much of a Linux person, I don't really understand what a 'daemon' is or why I'd want to go that way over just putting in a startup script.
  Here is a page which describes what rc.local is for and a lot about the Arch Linux boot process. 
  However, this appears to work just fine:
This is what my /etc/rc.local file looked like after I added the tomcat startup line. 

# /etc/rc.local: Local multi-user startup script.
And then in /etc/rc.local.shutdown I have:
# /etc/rc.local.shutdown: Local shutdown script.




   A pretty standard thing to have on your server is mysql.    I have not done this yet, but arch linux has this page on how to set it up with Apache and Tomcat.
First I updated my sources

packman -Sy

pacman -Ss mysql

lists a package which looks right so I’m going to install it on the Tonido.

pacman -S mysql

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h Plugbox password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with
cd /usr/mysql-test ; perl

Please report any problems with the /usr/bin/mysqlbug script!

Optional dependencies for mysql


ok, so I guess I’ll start up the mysql daemon

[root@Plugbox usr]#  cd /usr
[root@Plugbox usr]# ./bin/mysqld_safe &
[1] 10285
[root@Plugbox usr]# 101130 16:47:26 mysqld_safe Logging to '/var/lib/mysql/Plugbox.err'.
101130 16:47:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

and now I’ll run the secure_installation


This asked me for the current password, which is blank for a new installation.
Then it asked me to choose a password for root which I did.  Then it recommended some security things to do, which I did.

This page has some good info about how to set up mysql:

ok, so it looks like a file called ‘mysqld’ has already been added to my  /etc/rc.d folder.  So all I need to do is add mysql to the list of stuff to startup.

so I edited /etc/rc.conf and added mysqld to the list of daemons:

DAEMONS=(syslog-ng network netfs crond sshd mysqld httpd bftpd)

I made sure it was running by logging in as root:

mysql -p -u root

After putting in my password, it looked like it was running fine.

I decided to turn on the listing on port 3306 or whatever in case I will need that.  But I made the access work only from localhost by editing the /etc/hosts.allow file:

# /etc/hosts.allow
sshd: ALL
mysqld: : ALLOW
# End of file

and I went to /etc/mysql/my.cnf

And commented out the line


 How to Reach Me

    I welcome correction, comments and suggestions. 
Reaching the Author 




Last Updated on Wednesday, 01 December 2010 14:06

Sponsored Links

Bold Inventions, Powered by Joomla!; Joomla templates by SG web hosting