|Running a Webserver on a Tonido Plug - Getting Tomcat Running After Building It|
|Written by Administrator|
|Tuesday, 16 November 2010 20:16|
Page 9 of 9
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
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:
# add JAVA_HOME and ANT_HOME
export ANT_HOME JAVA_HOME CATALINA_HOME
Here I am trying to start it up. From the /usr/local/tomcat/bin folder I'm going to run the script startup.sh
[root@Plugbox bin]# ./startup.sh
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.
Sweet! Tomcat runs!
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
# add JAVA_HOME and ANT_HOME
export ANT_HOME JAVA_HOME CATALINA_HOME CATALINA_OPTS
So when I visited
192.168.1.19:8080 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.
<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:
<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.
How to Reach Me
I welcome correction, comments and suggestions.
|Last Updated on Wednesday, 01 December 2010 14:06|