一、環境准備
1. 用戶准備
Generic通用版weblogic不能用ROOT用戶安裝,如無其他用戶需先創建用戶,創建用戶步驟此處略過
2. 下載weblogic
在官網下載weblogic,將下載好的jar包上傳到linux服務器上
3. JDK環境
如果原來已配置好JDK環境可跳過該步驟
步驟
- 編輯器打開.bash_profile文件
vi ~/.bash_profile
- 填寫jdk相關環境變量
export JAVA_HOME=/usr/local/jdk1.7.0_80 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$JAVA_HOME/bin:$PATH
- 使配置生效
source ~/.bash_profile
二、安裝
0. 約定
-
本例中安裝路徑為/usr/local/weblogic12c,可根據自己情況修改
最終目錄結構為/usr/local/weblogic12 |--bea // 程序目錄 |--user_projects // 域集合 |--xxxDomain // 域
注:weblogic下可以創建多個域,很多教程創建域時目錄命名為domain,與bea同級,如此不利於多個域的管理,所以把域歸集到user_projects目錄下,一個項目對應一個域
-
用戶 weblogic
用戶組 weblgoicgroup
1. 創建oraInst.loc文件
注:文件路徑無所謂,注意修改inst_group為實際的組名
vi oraInst.loc
inventory_loc=/home/weblogic/oraInventory
inst_group=weblgoicgroup
安裝程序使用Oracle清單目錄來跟蹤安裝在計算機上的所有Oracle產品。清單目錄中存放的文件名為orainst.loc。如果該文件不存在於您的系統上,則必須在啟動靜默安裝之前創建該文件。安裝程序使用此文件。
用你想要安裝程序創建清單目錄的完整路徑目錄替換oui_inventory_directory。然后,用其成員有這個目錄的寫權限的組的名稱替換oui_install_group。
2. 創建響應文件wls.rsp
注:文件路徑無所謂,注意修改ORACLE_HOME
vi wls.rsp
[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/usr/local/weblogic12c/bea
#Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.
INSTALL_TYPE=WebLogic Server
#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
MYORACLESUPPORT_USERNAME=
#Provide the My Oracle Support Password
MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true
#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
#Provide the Proxy Host
PROXY_HOST=
#Provide the Proxy Port
PROXY_PORT=
#Provide the Proxy Username
PROXY_USER=
#Provide the Proxy Password
PROXY_PWD=<SECURE VALUE>
#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
COLLECTOR_SUPPORTHUB_URL=
3. 安裝
注:注意指定wls.rsp和oraInst.loc路徑
java -jar fmw_12.1.3.0.0_wls.jar -silent -responseFile /usr/local/weblogic12c/wls.rsp -invPtrLoc /usr/local/weblogic12c/oraInst.loc
安裝過程比較久,耐心等待即可
三、創建域
0. 准備
- 由於Linux下的Java生成隨機數規則與Windows的機制不一樣,需要修改securerandom.source為/dev/./urandom (原值為/dev/random),否則會出現創建、啟動域的時候耗時非常長的問題。(共性問題,請放心更改,如不放心可百度權威解釋)
cd $JAVA_HOME/jre/lib/security vi java.security securerandom.source=file:/dev/random # 修改為 securerandom.source=file:/dev/./urandom
- 配置環境變量
vi ~/.bash_profile
export MW_HOME=/usr/local/weblogic12c/bea
source ~/.bash_profile
1. 創建域
- 創建目錄
mkdir /usr/local/weblogic12c/user_projects/xxxDomain
- 執行運行文件
cd $MW_HOME/wlserver/common/bin ./commEnv.sh ./wlst.sh
注:注意根據需要修改端口、密碼、域路徑wls:/offline> wls:/offline> readTemplate('/usr/local/weblogic12c/bea/wlserver/common/templates/wls/wls.jar') wls:/offline/base_domain>cd('Servers/AdminServer') wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','') wls:/offline/base_domain/Server/AdminServer>set('ListenPort', 7001) wls:/offline/base_domain/Server/AdminServer>cd('/') wls:/offline/base_domain>cd('Security/base_domain/User/weblogic') wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('YourPassword') wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('OverwriteDomain', 'true') wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/usr/local/weblogic12c/user_projects/xxxDomain') wls:/offline/domain/Security/domain/User/weblogic>closeTemplate() wls:/offline>exit()
四、啟動weblogic
cd /usr/local/weblogic12c/user_projects/xxxDomain/bin/ -- 進入創建的域目錄bin下
./startWebLogic.sh -- 后台啟動使用nohup ./startWebLogic.sh &
./stopWeblogic.sh -- 關閉weblogic
啟動瀏覽器訪問weblogic控制台http://IP:7001/console,用戶名默認是weblogic,密碼是創建域時設置的。