Mudanças entre as edições de "Instala Jboss"
(Criou página com '{{Article | description= __NOTOC__ In this HOWTO, we are using CentOS 5.0, JDK6 and JBoss 5.1.x.Let's go ! By default, CentOS 5.0 contains the package java-1.4.2-gcj-compat-1.4.…') |
|||
Linha 11: | Linha 11: | ||
This is free software; see the source for copying conditions. There is NO | This is free software; see the source for copying conditions. There is NO | ||
warranty; not even for MERCHANTABILITY ... | warranty; not even for MERCHANTABILITY ... | ||
− | }} | + | }}Neste HOWTO, nós estamos usando o CentOS 5.4, JDK6 e JBoss 5.1.x. |
− | = | + | = Instalando o Java SE 6 = |
− | + | Vamos lá ! | |
− | + | Por padrão, CentOS 5.4 contém o pacote java-1.4.2-gcj-compat-1.4.2.0-40jpp.115. | |
[neodoo@neodoo-02 downloads]$ java --version | [neodoo@neodoo-02 downloads]$ java --version | ||
Linha 26: | Linha 26: | ||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PART ... | warranty; not even for MERCHANTABILITY or FITNESS FOR A PART ... | ||
− | + | Primeiro remova todos os pacotes java que estiver na distribuição | |
− | In this article, I have download ''Java SE Development Kit 6u16 for Platform Linux x64'' (jdk-6u16-linux-x64-rpm.bin). | + | First, you have to install the latest Java SE Development Kit (JDK) that you can download from [http://java.sun.com/javase/downloads http://java.sun.com/javase/downloads] |
+ | |||
+ | In this article, I have download ''Java SE Development Kit 6u16 for Platform Linux x64'' (jdk-6u16-linux-x64-rpm.bin). | ||
For install JDK, you have to put execution permissions to the file. | For install JDK, you have to put execution permissions to the file. | ||
Linha 36: | Linha 38: | ||
[root@neodoo-02 downloads]$ ./jdk-6u16-linux-x64-rpm.bin | [root@neodoo-02 downloads]$ ./jdk-6u16-linux-x64-rpm.bin | ||
− | You can verify that Java SE is installed in /usr/java/ | + | You can verify that Java SE is installed in /usr/java/ |
I verify the Java version of the operating system. | I verify the Java version of the operating system. | ||
Linha 45: | Linha 47: | ||
Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) | Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) | ||
− | I create dynamic links that let us not to modify scripts if I change Java versions. | + | I create dynamic links that let us not to modify scripts if I change Java versions. |
[root@neodoo-00 downloads]# mkdir /opt/java | [root@neodoo-00 downloads]# mkdir /opt/java | ||
Linha 51: | Linha 53: | ||
[root@neodoo-02 downloads]$ ln -s /usr/java/jdk1.6.0_16 /opt/java/jdk | [root@neodoo-02 downloads]$ ln -s /usr/java/jdk1.6.0_16 /opt/java/jdk | ||
− | Next, I create the environment variables for Java | + | Next, I create the environment variables for Java |
[root@neodoo-02 downloads]$ sudo vi /etc/profile.d/java.sh | [root@neodoo-02 downloads]$ sudo vi /etc/profile.d/java.sh | ||
Linha 67: | Linha 69: | ||
export JAVA_HOME PATH CLASSPATH LD_LIBRARY_PATH #JAVA_OPTS | export JAVA_HOME PATH CLASSPATH LD_LIBRARY_PATH #JAVA_OPTS | ||
− | I add execution permissions to the file. | + | I add execution permissions to the file. |
[root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/java.sh | [root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/java.sh | ||
− | And execute the file for update environment variables. | + | And execute the file for update environment variables. |
[root@neodoo-02 downloads]$ . /etc/profile.d/java.sh | [root@neodoo-02 downloads]$ . /etc/profile.d/java.sh | ||
− | This operation let us to maintain scripts intact and upgrade versions only changing dynamic links. | + | This operation let us to maintain scripts intact and upgrade versions only changing dynamic links. |
− | = Installing JBoss AS 5.1.x = | + | = Installing JBoss AS 5.1.x = |
− | Now let's go to install JBoss AS. | + | Now let's go to install JBoss AS. |
− | Download JBoss AS from [http://jboss.org/jbossas/downloads JBoss.ORG]. | + | Download JBoss AS from [http://jboss.org/jbossas/downloads JBoss.ORG]. |
I have choose JBoss AS 5.1.0.GA (zip format). | I have choose JBoss AS 5.1.0.GA (zip format). | ||
− | Because I have installed JDK6, I have downloaded jboss-5.1.0.GA-jdk6.zip because the sources of the aplication server are compiled with JDK6. | + | Because I have installed JDK6, I have downloaded jboss-5.1.0.GA-jdk6.zip because the sources of the aplication server are compiled with JDK6. Also, you can use jboss-5.1.0.GA.zip which is compiled with JDK5 (forward compatibility). |
− | We uncompress zip file in /usr/java directory. | + | We uncompress zip file in /usr/java directory. |
[root@neodoo-02 downloads]$ unzip jboss-5.1.0.GA-jdk6.zip -d /usr/java/ | [root@neodoo-02 downloads]$ unzip jboss-5.1.0.GA-jdk6.zip -d /usr/java/ | ||
− | I create dynamic links that let us not to modify scripts if I change JBoss AS versions. | + | I create dynamic links that let us not to modify scripts if I change JBoss AS versions. |
[root@neodoo-00 downloads]# ln -s /usr/java/jboss-5.1.0.GA /opt/java/jboss | [root@neodoo-00 downloads]# ln -s /usr/java/jboss-5.1.0.GA /opt/java/jboss | ||
− | We create environment variables for JBoss | + | We create environment variables for JBoss |
[root@neodoo-02 ~]# vi /etc/profile.d/jboss.sh | [root@neodoo-02 ~]# vi /etc/profile.d/jboss.sh | ||
Linha 108: | Linha 110: | ||
export JBOSS_HOME PATH | export JBOSS_HOME PATH | ||
− | I add execution permissions to the file. | + | I add execution permissions to the file. |
[root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/jboss.sh | [root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/jboss.sh | ||
− | And execute the file for update environment variables. | + | And execute the file for update environment variables. |
[root@neodoo-02 downloads]$ . /etc/profile.d/jboss.sh | [root@neodoo-02 downloads]$ . /etc/profile.d/jboss.sh | ||
− | I create a new user called jboss and assign this user to jboss directory. Don't start JBoss AS with root user ! | + | I create a new user called jboss and assign this user to jboss directory. Don't start JBoss AS with root user ! |
[root@neodoo-02 ~]# adduser jboss | [root@neodoo-02 ~]# adduser jboss | ||
Linha 122: | Linha 124: | ||
[root@neodoo-02 bin]$ chown -Rf jboss.jboss /opt/java/jboss/ | [root@neodoo-02 bin]$ chown -Rf jboss.jboss /opt/java/jboss/ | ||
− | You can start JBoss AS manually. | + | You can start JBoss AS manually. |
[root@neodoo-00 bin]# su jboss | [root@neodoo-00 bin]# su jboss | ||
Linha 128: | Linha 130: | ||
[jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh | [jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh | ||
− | By default, this is the same sentence than | + | By default, this is the same sentence than |
[jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 127.0.0.1 -c default | [jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 127.0.0.1 -c default | ||
− | With this sentence, you will only access to JBoss AS from localhost. | + | With this sentence, you will only access to JBoss AS from localhost. |
+ | |||
+ | If you want to access from a remote IP, put -b 0.0.0.0 for any IP address (or -b you_ip_server). | ||
− | |||
[root@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 0.0.0.0 | [root@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 0.0.0.0 | ||
− | By default, we use default profile which it corresponds to the directory $JBOSS_HOME/server/default that JBoss AS uses. | + | By default, we use default profile which it corresponds to the directory $JBOSS_HOME/server/default that JBoss AS uses. |
− | You will see a log detail from JBoss AS in the console and if JBoss AS starts OK, you will see something like this: | + | You will see a log detail from JBoss AS in the console and if JBoss AS starts OK, you will see something like this: |
15:53:50,035 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:15s:485ms | 15:53:50,035 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:15s:485ms | ||
− | Once the server is raised, you can access to it in the url http://your_ip_server:8080 | + | Once the server is raised, you can access to it in the url http://your_ip_server:8080 |
− | [[Image: | + | [[Image:Jboss console.png]] |
− | You can stop JBoss AS with CTRC-L o using this sentence in another console | + | You can stop JBoss AS with CTRC-L o using this sentence in another console |
[jboss@neodoo-00 bin]$ ./shutdown.sh -S | [jboss@neodoo-00 bin]$ ./shutdown.sh -S | ||
− | Now, we are going to create JBoss service. Remember to return to root user (exit). | + | Now, we are going to create JBoss service. Remember to return to root user (exit). |
[root@neodoo-02 bin]$ cd /opt/java/jboss/bin | [root@neodoo-02 bin]$ cd /opt/java/jboss/bin | ||
Linha 159: | Linha 162: | ||
[root@neodoo-02 bin]$ chmod +x /etc/init.d/jboss | [root@neodoo-02 bin]$ chmod +x /etc/init.d/jboss | ||
− | I modify this file: | + | I modify this file: |
[root@neodoo-02 bin]$ vi /etc/init.d/jboss | [root@neodoo-02 bin]$ vi /etc/init.d/jboss | ||
'''# chkconfig: - 64 36''' | '''# chkconfig: - 64 36''' | ||
− | + | '''# description: Jboss Start|Restart|Stop Application Server''' | |
− | + | '''# pidfile: /var/run/jboss.pid''' | |
− | + | .... | |
− | + | ||
− | + | JBOSS_HOME=${JBOSS_HOME:-"'''/opt/java/jboss'''"} | |
#define the user under which jboss will run, or use 'RUNASIS' to run as the current user | #define the user under which jboss will run, or use 'RUNASIS' to run as the current user | ||
Linha 182: | Linha 185: | ||
#if JBOSS_HOST specified, use -b to bind jboss services to that address | #if JBOSS_HOST specified, use -b to bind jboss services to that address | ||
'''JBOSS_HOST="0.0.0.0"''' | '''JBOSS_HOST="0.0.0.0"''' | ||
− | + | JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"} | |
− | + | ||
− | + | ... | |
Look that JBOSS_HOST corresponds to -c ip_server, JBOSS_CONF to -b profile and JBOSS_USER to user that starts JBoss AS like a service. | Look that JBOSS_HOST corresponds to -c ip_server, JBOSS_CONF to -b profile and JBOSS_USER to user that starts JBoss AS like a service. | ||
Linha 196: | Linha 199: | ||
[root@neodoo-02 init.d]# chkconfig jboss --level 3 on | [root@neodoo-02 init.d]# chkconfig jboss --level 3 on | ||
− | You can start JBoss AS | + | You can start JBoss AS |
[root@neodoo-02 bin]$ service jboss start | [root@neodoo-02 bin]$ service jboss start | ||
Linha 204: | Linha 207: | ||
[root@neodoo-02 bin]$ sudo /etc/init.d/iptables stop | [root@neodoo-02 bin]$ sudo /etc/init.d/iptables stop | ||
− | You can stop JBoss AS | + | You can stop JBoss AS |
[root@neodoo-02 bin]$ service jboss stop | [root@neodoo-02 bin]$ service jboss stop | ||
− | + | <br> '''Thanks to [http://www.apser.es Apser] to leave us the virtual machines !''' | |
− | '''Thanks to [http://www.apser.es Apser] to leave us the virtual machines !''' | + |
Edição das 23h09min de 23 de março de 2010
Predefinição:ArticleNeste HOWTO, nós estamos usando o CentOS 5.4, JDK6 e JBoss 5.1.x.
Instalando o Java SE 6
Vamos lá !
Por padrão, CentOS 5.4 contém o pacote java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.
[neodoo@neodoo-02 downloads]$ java --version java version "1.4.2" gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-44) 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 PART ...
Primeiro remova todos os pacotes java que estiver na distribuição
First, you have to install the latest Java SE Development Kit (JDK) that you can download from http://java.sun.com/javase/downloads
In this article, I have download Java SE Development Kit 6u16 for Platform Linux x64 (jdk-6u16-linux-x64-rpm.bin).
For install JDK, you have to put execution permissions to the file.
[root@neodoo-02 downloads]$ chmod 755 jdk-6u16-linux-x64-rpm.bin
[root@neodoo-02 downloads]$ ./jdk-6u16-linux-x64-rpm.bin
You can verify that Java SE is installed in /usr/java/
I verify the Java version of the operating system.
[root@neodoo-00 downloads]# java -version java version "1.6.0_16" Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
I create dynamic links that let us not to modify scripts if I change Java versions.
[root@neodoo-00 downloads]# mkdir /opt/java
[root@neodoo-02 downloads]$ ln -s /usr/java/jdk1.6.0_16 /opt/java/jdk
Next, I create the environment variables for Java
[root@neodoo-02 downloads]$ sudo vi /etc/profile.d/java.sh # # Java # JAVA_HOME=/opt/java/jdk PATH=$PATH:$JAVA_HOME/bin CLASSPATH=$JAVA_HOME/lib LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/i386 #JAVA_OPTS="-Djava.awt.headless=true" export JAVA_HOME PATH CLASSPATH LD_LIBRARY_PATH #JAVA_OPTS
I add execution permissions to the file.
[root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/java.sh
And execute the file for update environment variables.
[root@neodoo-02 downloads]$ . /etc/profile.d/java.sh
This operation let us to maintain scripts intact and upgrade versions only changing dynamic links.
Installing JBoss AS 5.1.x
Now let's go to install JBoss AS.
Download JBoss AS from JBoss.ORG.
I have choose JBoss AS 5.1.0.GA (zip format).
Because I have installed JDK6, I have downloaded jboss-5.1.0.GA-jdk6.zip because the sources of the aplication server are compiled with JDK6. Also, you can use jboss-5.1.0.GA.zip which is compiled with JDK5 (forward compatibility).
We uncompress zip file in /usr/java directory.
[root@neodoo-02 downloads]$ unzip jboss-5.1.0.GA-jdk6.zip -d /usr/java/
I create dynamic links that let us not to modify scripts if I change JBoss AS versions.
[root@neodoo-00 downloads]# ln -s /usr/java/jboss-5.1.0.GA /opt/java/jboss
We create environment variables for JBoss
[root@neodoo-02 ~]# vi /etc/profile.d/jboss.sh
# # JBoss AS # JBOSS_HOME=/opt/java/jboss PATH=$PATH:$JBOSS_HOME/bin export JBOSS_HOME PATH
I add execution permissions to the file.
[root@neodoo-02 downloads]$ chmod 755 /etc/profile.d/jboss.sh
And execute the file for update environment variables.
[root@neodoo-02 downloads]$ . /etc/profile.d/jboss.sh
I create a new user called jboss and assign this user to jboss directory. Don't start JBoss AS with root user !
[root@neodoo-02 ~]# adduser jboss
[root@neodoo-02 bin]$ chown -Rf jboss.jboss /opt/java/jboss/
You can start JBoss AS manually.
[root@neodoo-00 bin]# su jboss
[jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh
By default, this is the same sentence than
[jboss@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 127.0.0.1 -c default
With this sentence, you will only access to JBoss AS from localhost.
If you want to access from a remote IP, put -b 0.0.0.0 for any IP address (or -b you_ip_server).
[root@neodoo-02 bin]$ /opt/java/jboss/bin/run.sh -b 0.0.0.0
By default, we use default profile which it corresponds to the directory $JBOSS_HOME/server/default that JBoss AS uses.
You will see a log detail from JBoss AS in the console and if JBoss AS starts OK, you will see something like this:
15:53:50,035 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:15s:485ms
Once the server is raised, you can access to it in the url http://your_ip_server:8080
You can stop JBoss AS with CTRC-L o using this sentence in another console
[jboss@neodoo-00 bin]$ ./shutdown.sh -S
Now, we are going to create JBoss service. Remember to return to root user (exit).
[root@neodoo-02 bin]$ cd /opt/java/jboss/bin
[root@neodoo-02 bin]$ cp jboss_init_redhat.sh /etc/init.d/jboss
[root@neodoo-02 bin]$ chmod +x /etc/init.d/jboss
I modify this file:
[root@neodoo-02 bin]$ vi /etc/init.d/jboss
# chkconfig: - 64 36 # description: Jboss Start|Restart|Stop Application Server # pidfile: /var/run/jboss.pid .... JBOSS_HOME=${JBOSS_HOME:-"/opt/java/jboss"} #define the user under which jboss will run, or use 'RUNASIS' to run as the current user JBOSS_USER=${JBOSS_USER:-"jboss"} #make sure java is in your path JAVAPTH=${JAVAPTH:-"/opt/java/jdk"} #configuration to use, usually one of 'minimal', 'default', 'all' JBOSS_CONF=${JBOSS_CONF:-"default"} #if JBOSS_HOST specified, use -b to bind jboss services to that address JBOSS_HOST="0.0.0.0" JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"} ...
Look that JBOSS_HOST corresponds to -c ip_server, JBOSS_CONF to -b profile and JBOSS_USER to user that starts JBoss AS like a service.
We are going to add JBoss like a service.
[root@neodoo-02 init.d]# chkconfig --add jboss
[root@neodoo-02 init.d]# chkconfig --list
[root@neodoo-02 init.d]# chkconfig jboss --level 3 on
You can start JBoss AS
[root@neodoo-02 bin]$ service jboss start
If you can't access, verify you don't have any mistake or you have iptables on blocking port 8080.
[root@neodoo-02 bin]$ sudo /etc/init.d/iptables stop
You can stop JBoss AS
[root@neodoo-02 bin]$ service jboss stop
Thanks to Apser to leave us the virtual machines !