這是小弟的fb粉絲頁,有空歡迎來幫我按個贊^^ 

Step 1: 下載 & 安裝 the Java Development Kit (JDK)


J
ava 官網  點我

這裡是用 JDK 6 update24 當作例子,

你可以下載JDK在這裡--> JDK下載

我的電腦是 64bit , 所以我這裡是用 jdk-6u24-linux-x64.bin 

如果你是32 bit , 請下載 jdk-6u24-linux-i586.bin

Download the appropriate JDK and save it to a directory. 

因為我有UI介面,所以我是存在桌面(Desktop)

1.Move (mv) or copy (cp) the file to the /opt directory

2013-07-15_115614.jpg

2.Create the directory /usr/java

2013-07-15_115625.jpg

3.Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin' 

2013-07-15_115631.jpg  

安裝中

安裝中.jpg

完成後輸入  java -version,有看到下圖就代表成功,後面會設定JAVA_HOME

 

安裝完成.jpg  

We now have the JDK installed at /usr/java/jdk1.6.0_24. We'll use this for our JAVA_HOME a bit later in step 

Step 2: 下載 and 安裝 JBoss 5.1 Application Server

瑞里這裡用 Jboss 5.1 當作例子,提供兩種下載方法: 

(1.)自行Download --> 下載點我

(2.)另一種是用 wget:

1.jpg

 

Move (mv) or copy (cp) the file to /usr/share/jboss-5.1.0.GA.zip.

2.jpg

Change to the /usr/share directory and 解壓縮檔案:

3.jpg  

The unzip will create the following directory: /usr/share/jboss-5.1.0.GA

將會在Step 4 below,將前面的JAVA_HOME & JBOSS_HOME 一同設定

 

Step 3: Create the user, jboss, who will own and run JBoss (創造一個user for Jboss)


Since we will want to run JBoss as a non-root user with minimal privileges, we'll create a user,jboss, who will own the JBoss files and JBoss will run under his account.

Create a new group, jboss, and then create the user jboss and add the user to the jboss group.

4.jpg

 

5.jpg

 

Step 4: Set the required JAVA_HOME and JBOSS_HOME paths(環境設定)


We no need to set the JAVA_HOME and JBOSS_HOME.

The JAVA_HOME is where we installed the JDK above, /usr/java/jdk1.6.0_24,
The JBOSS_HOME is where we installed JBoss above /usr/share/jboss-5.1.0.GA.


Add the following to the jboss users .bash_profile:

小弟對Linux 還不是很熟,所以在找.bash_profile時,還有去爬文一下,

因為預設是隱藏的,所以可以直接下 vi ~/.bash_profile

6.jpg

JAVA_HOME=/usr/java/jdk1.6.0_24
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
JBOSS_HOME=/usr/share/jboss-5.1.0.GA
export JBOSS_HOME

 

 

To set the JAVA_HOME for users, we add this to the user ~/.bashrc or ~/.bash_profile of the user. We can also add it /etc/profile and then source it to give to all users.

指令:  在 /etc 下 vi ~/.bashrc 

7.jpg

 

JAVA_HOME=/usr/java/jdk1.6.0_24
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

 

如果設定正確,就會如下圖:

8.jpg         

瑞里的也正確:p

[root@localhost ~]# su jboss

[jboss@localhost root]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_24


[jboss@localhost root]$ echo $JBOSS_HOME
/usr/share/jboss-5.1.0.GA

 

參考網站 

David Ghedini's Blogog

 

瑞、瑪姬與小昆妮 發表在 痞客邦 留言(0) 人氣()