Lets get right to it! The software to download is listed below:
1. Jetty (HTTP, Servlet)
2. MySql
JETTY INSTALLATIONJetty website can be found
here. The version used here can be found here
Jetty-5.1.10. Version zip file is jetty-5.1.10-all.tar.gz.
Unzip the the file in a directory, for demonstartions a staging area directory ~/Scratch/Jetty was creatted. Unzipping the jetty-5.1.10-all.tar.gz to this directory will create a directory structure as follows:
In UNIX/MAC OS X/Linux the home directory '~' or user directory is the perfect location for our staging directory and server directory. This allows the developer to launch the servers from a shell command wihtout installing in the usr/local directories. The execution is kept local at this point and provides for a better development environment. 1. ~/Scratch/Jetty - unzipping archive
2. ~/Scratch/Jetty
/jetty-5.1.10-all/jetty-5.1.10 - Directory created from unzip
NOTE:
Downloading jetty-5.1.10-all.tar.gz was chosen as not to work through the complications of compilation. If a desire to download the source archive for Jetty in order to understand the compliation process would be a very positive exsercise. However, due to the our purposes this will be considered out of scope. Future entries may consider instruction on this topic; only demand of request will be the deciding factor. :-)
Now from this point, move the contents of ~/Scratch/Jetty/jetty-5.1.10-all/jetty-5.1.10 into the ~/Scratch/Jetty and delete the directory ~/Scratch/Jetty/jetty-5.1.10-all.
In order to keep consistent in all platforms putting all servers in a consistent directory will allow consistent documentation. This may or may not be the proper setup for production, however, the idea of this setup is to promote familiarity with the installation. Once, you feel comfortable with this installation preparing this environment for production should provide a smoothier implementation.
Move the ~/Scratch/Jetty
to a directory ~/Servers/Jetty
. The directory contents should look like Figure 1.
Of course, it is important to peruse this directory structure and understand what each directory contains and its function as well as the function and purpose for each file. Reading the "README.TXT" can only be a good thing, my suggestion is do it.
Now lets get Jetty up and running!! First of all, insure you do not have any server hanging off port 8080. If Tomcat, Resin or any other server occupies this port stop it or change the port in the jetty.xml to a port of your choice.
Now let's launch Jetty.
The simply way is to type java -jar start.jar from a command line. However, it would be better to launch this command with the os command line background command & . This is to allow a comman window with the same environment available to execute the shutdown process of the jetty server. This effort makes it easier to keep a shell available for log viewing, stopping the server and checking the server health.
Setting up an environment variable for jetty is completed from the shell as seen below:
export JETTY_HOME=<jetty install directory>
So, execution of the Jetty server is as follows:
java -jar /usr/local/jetty/start.jar &
In the internet browser enter the URL Enter http://localhost:8080/ and the response from the server is an Error 404 - Not Found!! as seen in Figure 2
The result is simply explained as the jetty server which was launched without a context. Explaining the context issue will follow, for now select the Template Webapp and the javadoc links. Just read them, look around and get familar with the documentation.
Now, go to the initial command prompt and type: java -jar stop.jar
This will stop the jetty engine. We will now start jetty again with a context. For expediency, we will use the demo applications that reside in the demo directory of the jetty directory structure. The demo provides a test to insure accurate installation that can establish validity across all platforms.
To launch the Jetty server with the demo context simply go to a shell, change directory to ~/servers/jettty.
Executiing the server is exactly the same as done above, however, the demo context must be given as a prameter.
The command line is as follows:
~/Servers/jetty/> java -jar start.jar etc/demo.xml &
The server is accessed by http://localhost:8080/ as you can see by the url in figure 3 is http://localhost:8080/jetty/index.html. Of course, this url is rendered by the demo.xml. Investigating how this works is extrememly valuable and it is highly sugggested and recommended.
However, this concludes the MAC OS X installation entry. The instructions to Windows can be found
here. After your target OS is configured the next step is to install MySQL.
Once the installations are compete the review of JSP's, Servlets and Database access will be presented.
MYSQL INSTALLATION The
MySQL version we are installing is
version 5.0. Version 4.X maybe more stable and more familiar to most developers, but the belief of using the newest and most competent version is the only justification for version 5.0's use in the target environment.
The installation file name for the version 5.0 is mysql-standard-5.0.18-osx10.4-powerpc.dmg.
Now that we have the download the installation steps are listed below:
- Launch mysql-standard-5.0.18-osx10.4-powerpc.dmg to mount the mysql package
- Launch the mysql-standard-5.0.18-osx10.4-powerpc.pkg
- Running through the install is very straight forward
- The final installation creates the following files in /usr/local:
- Directory (Mysql directory)
- mysql-standard-5.0.18-osx10.4-powerpc
- Symbolic Link to mysql above
- MySql requires a user account named mysql. This is normally created for OS X 10.2 and above
- You can verify this by entering this comman in the command shell:
- cat /etc/passwd | grep -i "mysql"
<Helios:sparc> 0 [02-19 13:41] /usr/local (0 Mb) ! cat /etc/passwd | grep -i "mysql" mysql:*:74:74:MySQL Server:/var/empty:/usr/bin/false |
- cat /etc/passwd | grep -i "mysql"
<Helios:sparc> 0 [02-19 13:41] /usr/local (0 Mb) ! cat /etc/passwd | grep -i "mysql" mysql:*:74:74:MySQL Server:/var/empty:/usr/bin/false
|
4. If you would like to startup MYSQL as a startup item launch MySQLStartupItem.pkg
The following directory is created in MySQLCOM dir
/Library/StartupItems/. To disable my MySQL from system startup update the following file
/etc/hostconfig's variable MYSQLCOM=-
YES- to MYSQLCOM=-
NO-
5. Start MySQL command line issue the following commands
<Helios:sparc> 0 [02-20 07:04] /usr/local (0 Mb) ! cd /usr/local/mysql
<Helios:sparc> 0 [02-20 06:57] /usr/local (0 Mb) ! sudo ./bin/mysqld_safe <Issue a CTRL-Z>
|
6. Connect to MySQL
<Helios:sparc> 0 [02-20 06:57] /usr/local (0 Mb) ! /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.18-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show datanases -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'datanases' at line 1 mysql> show databases; +-----------------------------+ | Database | +-----------------------------+ | information_schema| | mysql | | test | +-----------------------------+ 3 rows in set (0.31 sec)
mysql>
|
You are conencted.
I have been using MySQL Admin to create database and tables, and well, general administartion. I believe to be a nice little package and would suggest using it... Its an easy install and provides a GUI for MySQL Administration.
(NOTE: My experience with MySQL Admin is Windows and Mac OS X only at this time!)
Execute the MYSQL shortcut. You'll be prompted for a password. Enter your password.
Enter show databases:
mysql> show databases;
+--------------------+
| Database
+--------------------+
| information_schema
| mysql
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use test;
Create a table foo in Database "test"
mysql> CREATE TABLE foo (a TINYINT NOT NULL);
Query OK, 0 rows affected (0.58 sec)
mysql> show tables;
+----------------+
| Tables_in_test
+----------------+
| foo
+----------------+
1 row in set (0.00 sec)
NOTE: If you received the results above MySQL is installed correctly
MYSQL ADMIN INSTALLATIONMySQL's admin tool is a fairly new tool and provides a better interface than the standard MySQL.exe (some may argue this point with great conviction! :-). The installation is fairly simple and will require the username and password that was created in the MySQL DB installation.
Simply download the MySQL Administrator from
MySQL Admin execute the DMG. this will mount the package drag the MySQL Adminstrator.app to a directory of your choosing.
Launch it and you will be asked for some credentials, enter localhost, if you followed along leave the password and user fields balnk.

You should now be grated acces to the adminsitration tool seen below;
Goto the folder
C:\Scratch\MySQLAdmin and execute the
mysql-administrator-1.1.5-win.msi installation. Install the Tool in the following directory:
C:\Servers\MySQL\MySQL Administrator 1.1\Any qestions?? Add comments or send email to
SOS tags: mysql mysql admin
links: digg this del.icio.us technorati reddit