Instalación de Ambiente de Desarrollo Web en Java
Java SE, Tomcat y Eclipse WTP sobre Linux
Este procedimiento muestra como actualizar la máquina virtual de java, e instalar Apache Tomcat y Eclipse IDE para integrar un ambiente de desarrollo sobre plataforma Java sobre Linux. El siguiente procedimiento fue ejecutado originalmente sobre Fedora Core 6.
Los productos que se muestran para instalar son los siguientes:
- Java SDK 5.0, que se puede obtener de aquí, seleccionar Java SE Update 12 ( sin características adicionales ): En este caso el archivo para Linux es jdk-1_5_0_12-linux-i586-rpm.bin.
- Tomcat 5.5.23, que se puede obtener de aquí ( Core, en formato tar.gz ): En este caso el archivo multiplataforma es apache-tomcat-5.5.23.tar.gz.
- Eclipse 3.3 con Web Tools Project, que se puede obtener de aquí ( All in One, para Linux ): En este caso el archivo para Linux es wtp-all-in-one-sdk-R-2.0-200706260303-linux-gtk.tar.gz.
El siguiente procedimiento presupone que todos estos archivos se han guardado en un CD para su instalación, pero dicho procedimiento puede adaptarse a otros escenarios si así se desea.
Instalación de la Máquina Virtual:
- Primero se debe montar el CD con los productos a instalar.
- Se verifica la versión de la máquina virtual de Java:
[root@curso09 JVM]# whereis java>
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java
[root@curso09 JVM]# /usr/bin/java -version java version "1.4.2"
gij (GNU libgcj) version 4.1.1 20061011 (Red Hat 4.1.1-30)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- El directorio JVM en el CD contiene la versión más actual de JVM 5.0 hasta este momento.
- Se copia el archivo al disco duro. El archivo no debe ejecutarse en el directorio montado, ya que el sistema intentará extraer la información del archivo y coloarla en el directorio actual. Para evitar esto, se copia al directorio home del usuario que inició sesión, en este caso root.
- El archivo es un bin, por lo que debe ejecutarse a través de un shell. Si se usa el shell actual ( bash en la mayoría de los linux ), el sistema mostrará el siguiente error.
- Esto se debe a que el shell utilizado para crear el archivo bin es un /bin/sh. Por lo tanto ejecutar utilizando la siguiente instrucción:
- Aceptar los términos de la licencia, de otra manera no se permite la instalación.
- Verificar la instalación actual de la máquina virtual. En este caso se propone la instalación de una más actualizada ( Java SE 5 ó 6 )
- Para conocer el directorio de instalación de la nueva JVM, se utiliza el siguiente comando. Verificar los directorios indicados en negritas.
- Editar el archivo .bash_profile para agregar la variable de ambiente JAVA_HOME.
- Ahora se realiza la instalación de Tomcat. Para ello copiamos el archivo del CD al disco duro. Este paso no es realmente necesario, se puede hacer referencia al archivo en el CD.
- Para instalar Tomcat se debe colocar en el directorio donde será instalado; en este caso es /usr. Después, ejecutar el comando tar con las opciones xzvf.
- Verificar que el archivo apache-tomcat-5.5.23 se haya creado exitósamente, y ver su contenido.
- Editar nuevamente el archivo ./bash_profile para agregar la variable de ambiente CATALINA_HOME.
- Ejecutar el archivo .bash_profile para cargar el nuevo ambiente..
- Ejecutar dentro del directorio /usr/apache-tomcat-5.5.23/bin el archivo startup.sh para ejecutar Tomcat.
- Verificar en la bitácora /usr/apache-tomcat-5.5.23/logs/catalina.out que el servidor se haya levantado exitósamente.
- Probar que la página http://localhost:8080 se ejecute satisfactoriamente.
- Una vez verificada la ejecución de Tomcat, apagarlo utilizando el script shutdown.sh.
- Ahora se copia el archivo de instalación de Eclipse al directorio home.
- Cambiarse al directorio donde estará instalado Eclipse. Ejecutar el comando tar xzvf sobre el archivo:
- Dentro del directorio /usr/eclipse, ejecutar el archivo eclipse para iniciar el ambiente:
- Especificar el nombre para el espacio de trabajo, en este caso, el que se muestra en la imagen. Presionar OK. Una vez abierto el ambiente de eclipse, cerrar la pantalla de bienvenida.
- Ahora, para probar la instalación, se creará un nuevo proyecto web dinámico. Dar click derecho sobre la vista Project Explorer, y seleccionar New -> Dynamic Web Project.
- Nombrar al proyecto TestWeb; para poder ejecutar el proyecto, se debe definir primero una instancia de un servidor de aplicaciones, en este caso, Tomcat. Para crearla, presionar el botón New.
- En la ventana emergente, seleccionar Apache, como tipo de servidor, y también Apache Tomcat v5.5 por ser la versión instalada. Presionar Next.
- Presionar el botón Browse para seleccionar el directorio de instalación de Tomcat.
- Seleccionar el directorio /usr/apache-tomcat-5.5.23. Presionar OK.
- Seleccionar la JVM que se instaló previamente (jdk1.5.0_12) para trabajar adecuadamente con la versión de Tomcat5. Presionar Finish.
- Una vez creado el servidor, se proederá a terminar la definición del proyecto web. Presionar Next.
- Mantener los valores por defecto en esta ventana. Presionar Next.
- Redefinir el nombre de contexto de la aplicación a test, que es más corto y sencillo de manejar. Presionar Finish.
- La siguiente ventana muestra la estructura del nuevo proyecto en la vista Project Explorer, así como el nuevo servidor en la vista Servers.
- Crear una página JSP, dando click derecho sobre el directorio WebContent y seleccionar New -> JSP.
- En la ventana New JavaServer Page, y especificar en el campo file name index.jsp como nombre del archivo. Presionar Finish.
- Eclipse abrirá automáticamente el editor para la nueva página. Agregar el siguiente contenido:
- Salvar los cambios y ejecutar la página en el servidor Tomcat. Dar click derecho sobre la página en la vista Project Explorer, y elegir Run As -> Run on Server.
- Mantener las opciones por defecto, y habilitar la opción Always use this server when running this project. Presionar Next.
- En caso de que aparezca la siguiente ventana, habilitar la opción Update context root for Web module TestWeb, y presionar Finish.
- Verificar en la consola que el servidor fue levantado con éxito.
- Eclipse automáticamente abrirá un navegador con la ejecución de la página como se muestra a continuación.
- Para terminar, detener el servidor Tomcat y cerrar Eclipse.
[root@curso09 JVM]# pwd
/media/LPT/JVM
[root@curso09 JVM]# ll
total 46674
-r-xr-xr-x 1 root root 47793615 ago 7 01:22 jdk-1_5_0_12-linux-i586-rpm.bin
[root@curso09 JVM]# cd
[root@curso09 ~]# cp ./jdk-1_5_0_12-linux-i586-rpm.bin /root
[root@curso09 ~]# ll
total 46808
-rw------- 1 root root 1500 jul 28 10:32 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 ago 7 10:56 Desktop
-rw-r--r-- 1 root root 32130 jul 28 10:32 install.log
-rw-r--r-- 1 root root 4768 jul 28 10:29 install.log.syslog
-r-xr-xr-x 1 root root 47793615 ago 7 11:09 jdk-1_5_0_12-linux-i586-rpm.bin
-rw-r--r-- 1 root root 20480 ago 7 11:07 JVM_install.txt
[root@curso09 ~]# ./jdk-1_5_0_12-linux-i586-rpm.bin
bash: ./jdk-1_5_0_12-linux-i586-rpm.bin: /bin/sh: bad interpreter:
Permiso denegado
[root@curso09 ~]# ./bin/sh jdk-1_5_0_12-linux-i586-rpm.bin
Sun Microsystems, Inc. Binary Code License Agreement
for the JAVA 2 PLATFORM STANDARD EDITION DEVELOPMENT KIT 5.0
SUN MICROSYSTEMS, INC. ("SUN") IS WILLING TO LICENSE THE
SOFTWARE IDENTIFIED BELOW TO YOU ONLY UPON THE CONDITION
THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY
CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS
(COLLECTIVELY "AGREEMENT"). PLEASE READ THE AGREEMENT
CAREFULLY. BY DOWNLOADING OR INSTALLING THIS SOFTWARE, YOU
ACCEPT THE TERMS OF THE AGREEMENT. INDICATE ACCEPTANCE BY
SELECTING THE "ACCEPT" BUTTON AT THE BOTTOM OF THE
AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY ALL THE
TERMS, SELECT THE "DECLINE" BUTTON AT THE BOTTOM OF THE
AGREEMENT AND THE DOWNLOAD OR INSTALL PROCESS WILL NOT
CONTINUE.
...
Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.42 of 14 January 2001, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-1_5_0_12-linux-i586.rpm
Preparing... ############################# [100%]
1:jdk ############################# [100%]
Done.
[root@curso09 ~]# whereis java
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java
[root@curso09 ~]# /usr/bin/java -version
java version "1.4.2" gij (GNU libgcj) version 4.1.1 20061011 (Red Hat 4.1.1-30)
Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@curso09 ~]# find / -name java
/var/lib/alternatives/java
/etc/alternatives/java
/etc/java
/usr/bin/java
/usr/share/java
/usr/java
/usr/java/jdk1.5.0_12/bin/java
/usr/java/jdk1.5.0_12/jre/bin/java
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java
/usr/lib/java
/usr/lib/openoffice.org2.0/share/Scripts/java
[root@curso09 ~]# ll -a
total 94020
drwxr-x--- 16 root root 4096 ago 7 11:10 .
drwxr-xr-x 23 root root 4096 ago 7 10:55 ..
-rw------- 1 root root 1500 jul 28 10:32 anaconda-ks.cfg
-rw-r--r-- 1 root root 24 jul 12 2006 .bash_logout
-rw-r--r-- 1 root root 191 jul 12 2006 .bash_profile
-rw-r--r-- 1 root root 176 jul 12 2006 .bashrc
...
[root@curso09 ~]# vi .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then#[5;9H. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/usr/java/jdk1.5.0_12
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH
unset USERNAME
Instalación de Apache Tomcat:
[root@curso09 ~]# cp /media/LPT/ApacheTomcat/5.5.23/apache-tomcat-5.5.23.tar.gz.
[root@curso09 ~]# ll
total 99760
-rw------- 1 root root 1500 jul 28 10:32 anaconda-ks.cfg
-r-xr-xr-x 1 root root 5977561 ago 7 11:16 apache-tomcat-5.5.23.tar.gz
drwxr-xr-x 2 root root 4096 ago 7 10:56 Desktop
-rw-r--r-- 1 root root 32130 jul 28 10:32 install.log
-rw-r--r-- 1 root root 4768 jul 28 10:29 install.log.syslog
-rw-r--r-- 1 root root 48117502 may 2 07:40 jdk-1_5_0_12-linux-i586.rpm
-r-xr-xr-x 1 root root 47793615 ago 7 11:09 jdk-1_5_0_12-linux-i586-rpm.bin
-rw-r--r-- 1 root root 73728 ago 7 11:14 JVM_install.txt
[root@curso09 ~]# cd /usr/
[root@curso09 usr]# ls
bin etc games include java kerberos lib libexec local sbin share src tmp X11R6
[root@curso09 usr]# tar xzvf apache-tomcat-5.5.23.tar.gz
apache-tomcat-5.5.23/bin/catalina.sh
apache-tomcat-5.5.23/bin/digest.sh
apache-tomcat-5.5.23/bin/setclasspath.sh
apache-tomcat-5.5.23/bin/shutdown.sh
apache-tomcat-5.5.23/bin/startup.sh
...
[root@curso09 usr]# ls apache-tomcat-5.5.23 bin etc games include java kerberos lib libexec local sbin share src tmp X11R6
[root@curso09 usr]# cd apache-tomcat-5.5.23/
[root@curso09 apache-tomcat-5.5.23]# ll
total 68
drwxr-xr-x 2 root root 4096 ago 7 11:17 bin
drwxr-xr-x 6 root root 4096 mar 5 09:26 common
drwxr-xr-x 3 root root 4096 mar 5 09:27 conf
-rw-r--r-- 1 root root 11357 mar 5 09:27 LICENSE
drwxr-xr-x 2 root root 4096 mar 5 09:26 logs
-rw-r--r-- 1 root root 688 mar 5 09:27 NOTICE
-rw-r--r-- 1 root root 6741 mar 5 09:26 RELEASE-NOTES
-rw-r--r-- 1 root root 6964 mar 5 09:27 RUNNING.txt
drwxr-xr-x 5 root root 4096 mar 5 09:26 server
drwxr-xr-x 4 root root 4096 mar 5 09:26 shared
drwxr-xr-x 2 root root 4096 ago 7 11:17 temp
drwxr-xr-x 8 root root 4096 mar 5 09:26 webapps
drwxr-xr-x 2 root root 4096 mar 5 09:26 work
[root@curso09 apache-tomcat-5.5.23]# vi /root/.bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then#[5;9H. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/usr/java/jdk1.5.0_12
export CATALINA_HOME=/usr/apache-tomcat-5.5.23
PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$PATH:$HOME/bin
export PATH
unset USERNAME
[root@curso09 apache-tomcat-5.5.23]# . /root/.bash_profile
[root@curso09 apache-tomcat-5.5.23]# java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
[root@curso09 usr]# cd /usr/apache-tomcat-5.5.23/
[root@curso09 apache-tomcat-5.5.23]# cd bin
[root@curso09 bin]# ll
total 588
-rw-r--r-- 1 root root 23669 mar 5 09:26 bootstrap.jar
-rw-r--r-- 1 root root 8962 mar 5 09:26 catalina.bat
-rwxr-xr-x 1 root root 12044 mar 5 09:26 catalina.sh
-rw-r--r-- 1 root root 968 mar 5 09:26 catalina-tasks.xml
-rw-r--r-- 1 root root 9341 mar 5 09:26 commons-daemon.jar
-rw-r--r-- 1 root root 26202 mar 5 09:26 commons-logging-api.jar
-rw-r--r-- 1 root root 509 mar 5 09:26 cpappend.bat
-rw-r--r-- 1 root root 1282 mar 5 09:26 digest.bat
-rwxr-xr-x 1 root root 841 mar 5 09:26 digest.sh
-rw-r--r-- 1 root root 899 mar 5 09:26 jkstatus-tasks.xml
-rw-r--r-- 1 root root 1323 mar 5 09:26 jmxaccessor-tasks.xml
-rw-r--r-- 1 root root 74398 mar 5 09:26 jsvc.tar.gz
-rw-r--r-- 1 root root 4122 mar 5 09:26 service.bat
-rw-r--r-- 1 root root 2413 mar 5 09:26 setclasspath.bat
-rwxr-xr-x 1 root root 3008 mar 5 09:26 setclasspath.sh
-rw-r--r-- 1 root root 1271 mar 5 09:26 shutdown.bat
-rwxr-xr-x 1 root root 780 mar 5 09:26 shutdown.sh
-rw-r--r-- 1 root root 1272 mar 5 09:26 startup.bat
-rwxr-xr-x 1 root root 1173 mar 5 09:26 startup.sh
-rw-r--r-- 1 root root 53248 mar 5 09:26 tomcat5.exe
-rw-r--r-- 1 root root 98304 mar 5 09:26 tomcat5w.exe
-rw-r--r-- 1 root root 12972 mar 5 09:26 tomcat-juli.jar
-rw-r--r-- 1 root root 173510 mar 5 09:26 tomcat-native.tar.gz
-rw-r--r-- 1 root root 2233 mar 5 09:26 tool-wrapper.bat
-rwxr-xr-x 1 root root 2545 mar 5 09:26 tool-wrapper.sh
-rw-r--r-- 1 root root 1278 mar 5 09:26 version.bat
-rw-r--r-- 1 root root 784 mar 5 09:26 version.sh
[root@curso09 bin]# ./startup.sh
Using CATALINA_BASE: /usr/apache-tomcat-5.5.23
Using CATALINA_HOME: /usr/apache-tomcat-5.5.23
Using CATALINA_TMPDIR: /usr/apache-tomcat-5.5.23/temp
Using JRE_HOME: /usr/java/jdk1.5.0_12
[root@curso09 bin]# tail -f ../logs/catalina.out 7/08/2007 11:29:17 AM org.apache.coyote.http11.Http11BaseProtocol start INFO: Arrancando Coyote HTTP/1.1 en puerto http-8080 7/08/2007 11:29:18 AM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 7/08/2007 11:29:18 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/24 config=null 7/08/2007 11:29:18 AM org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource 7/08/2007 11:29:18 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 1934 ms
![]() |
[root@curso09 bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/apache-tomcat-5.5.23
Using CATALINA_HOME: /usr/apache-tomcat-5.5.23
Using CATALINA_TMPDIR: /usr/apache-tomcat-5.5.23/temp
Using JRE_HOME: /usr/java/jdk1.5.0_12
Instalación de Eclipse WTP:
[root@curso09 apache-tomcat-5.5.23]# cd
[root@curso09 ~]# cp /media/LPT/Eclipse/wtp-all-in-one-sdk-R-2.0-200706260303-linux-gtk.tar.gz .
[root@curso09 ~]# ll
total 357736
-rw------- 1 root root 1500 jul 28 10:32 anaconda-ks.cfg
-r-xr-xr-x 1 root root 5977561 ago 7 11:16 apache-tomcat-5.5.23.tar.gz
drwxr-xr-x 2 root root 4096 ago 7 10:56 Desktop
-rw-r--r-- 1 root root 1096 ago 7 11:27 Eclipse_install.txt
-rw-r--r-- 1 root root 32130 jul 28 10:32 install.log
-rw-r--r-- 1 root root 4768 jul 28 10:29 install.log.syslog
-rw-r--r-- 1 root root 48117502 may 2 07:40 jdk-1_5_0_12-linux-i586.rpm
-r-xr-xr-x 1 root root 47793615 ago 7 11:09 jdk-1_5_0_12-linux-i586-rpm.bin
-rw-r--r-- 1 root root 242255 ago 7 11:20 JVM_install.txt
-r-xr-xr-x 1 root root 263726993 ago 7 11:27 wtp-all-in-one-sdk-R-2.0-200706260303-linux-gtk.tar.gz
[root@curso09 ~]# cd /usr/ [root@curso09 usr]# tar xzvf wtp-all-in-one-sdk-R-2.0-200706260303-linux-gtk.tar.gz eclipse/ eclipse/about_files/ eclipse/about_files/about_cairo.html eclipse/about_files/lgpl-v21.txt eclipse/about_files/pixman-licenses.txt eclipse/about_files/IJG_README eclipse/about_files/mpl-v11.txt ...
[root@curso09 usr]# cd eclipse
[root@curso09 eclipse]# ll
total 428
drwxrwxr-x 2 7374 1010 4096 jun 25 16:40 about_files
-rw-rw-r-- 1 7374 1010 11930 jun 25 16:40 about.html
drwxrwxr-x 2 7374 1010 4096 jun 25 16:40 configuration
-rwxr-xr-x 1 7374 1010 20537 jun 25 16:40 eclipse
-rw-rw-r-- 1 7374 1010 58 jun 25 16:40 eclipse.ini
-rw-r--r-- 1 7374 1010 12656 jun 25 23:21 epl-v10.html
drwxrwxr-x 143 7374 1010 20480 jun 27 16:30 features
-rw-rw-r-- 1 7374 1010 9022 jun 25 16:40 icon.xpm
-rwxr-xr-x 1 7374 1010 266168 jun 25 16:40 libcairo-swt.so
-rw-r--r-- 1 7374 1010 6506 jun 25 23:21 notice.html
drwxrwxr-x 76 7374 1010 53248 jun 27 16:30 plugins
drwxrwxr-x 2 7374 1010 4096 jun 27 16:30 readme
[root@curso09 eclipse]# ./eclipse &
[1] 3281
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Regresar
Derechos Reservados de este Material:
Atribución-No Comercial-Licenciamiento Recíproco 2.5 México
http://creativecommons.org/licenses/by-nc-sa/2.5/mx/
Eres libre de: a) copiar, distribuir y comunicar públicamente la obra, b) hacer obras derivadas. Bajo las condiciones siguientes: a) Atribución. Debes reconocer la autoría de la obra en los términos especificados por el propio autor o licenciante. b) No comercial. No puedes utilizar esta obra para fines comerciales. c) Licenciamiento Recíproco. Si alteras, transformas o creas una obra a partir de esta obra, solo podrás distribuir la obra resultante bajo una licencia igual a ésta.
Al reutilizar o distribuir la obra, tiene que dejar bien claro los términos de la licencia de esta obra. Alguna de estas condiciones puede no aplicarse si se obtiene el permiso del titular de los derechos de autor. Nada en esta licencia menoscaba o restringe los derechos morales del autor.
Java and all Java-based trademarks and logos are trademarks of Sun Microsystems in the United States and/or other countries.
Other products and services are trademarks of their respective owners.
|




























