weblogic安装与配置流程
精选
原创
©著作权归作者所有:来自51CTO博客作者丿十年的原创作品,请联系作者获取转载授权,否则将追究法律责任
准备一台linux操作系统,Oracle、CentOS、Redhat都可以,这里实验使用的是Oracle linux 6.7各版本区别不大。
1、首先安装JDK环境
首先配置好jdk环境,这里使用的版本为jdk1.8,
官网地址及下载方式:
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
选择后上传到系统任意目录,解压:
tar -xzvf jdk-8u333-linux-x64.tar.gz
mv jdk1.8.0_333 /usr/java
配置系统环境变量
cat /etc/profile
export JAVA_HOME=/usr/java/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source /etc/profile
java -version
出现如下界面表示jdk配置完成
2、 配置weblogic环境
WebLogic下载地址:
https://www.oracle.com/middleware/technologies/weblogic-server-downloads.html
不知道下载那个看看下图哦!
2.1 创建及配置用户信息
1、创建weblogic用户组
useradd -m -r weblogic
passwd weblogic
密 码:weblogic
这里是测试把密码和用户都创建为一样的。
2、切换至weblogic用户
[root@localhost ~]# su weblogic
[weblogic@localhost ~]$
2.2 weblogic安装前配置
这里主要为创建安装目录和数据存放目录
1、创建oraInventory目录
mkdir /home/weblogic/oraInventory
2、创建weblogic安装目录
mkdir /home/weblogic/weblogic_install
3、创配置文件目录,并将安装包拷贝到目录下
mkdir /home/weblogic/weblogic_dir
2.3 新建oraInst.loc文件
cat > /home/weblogic/weblogic_dir/oraInst.loc << EOF
inventory_loc=/home/weblogic/oraInventory
inst_group=weblogic
EOF
2.4 创建wls12c.resp文件
cat > /home/weblogic/weblogic_dir/wls12c.resp << EOF
[ENGINE]
#DO NOT CHANGE THIS.
Response File Versinotallow=1.0.0.0.0
[GENERIC]
#Set this to true if you wish to skip software updates
DECLINE_AUTO_UPDATES=true
#My Oracle Support User Name
MOS_USERNAME=
#My Oracle Support Password
MOS_PASSWORD=<SECURE VALUE>
#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
AUTO_UPDATES_LOCATION=
#Proxy Server Name to connect to My Oracle Support
SOFTWARE_UPDATES_PROXY_SERVER=
#Proxy Server Port
SOFTWARE_UPDATES_PROXY_PORT=
#Proxy Server Username
SOFTWARE_UPDATES_PROXY_USER=
#Proxy Server Password
SOFTWARE_UPDATES_PROXY_PASSWORD=<SECURE VALUE>
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/home/weblogic/weblogic_install/
#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=
EOF
3、开始部署weblogic服务
安装weblogic:
java -jar fmw_12.2.1.4.0_wls_lite_generic.jar -silent -responseFile /home/weblogic/weblogic_dir/wls12c.resp -invPtrLoc /home/weblogic/weblogic_dir/oraInst.loc
出现上面信息表示安装成功,继续下一步配置
4、weblogic创建新域
说明:这只是weblogic创建域的一种方式,还可以使用py脚本或者其他脚本执行去创建。
4.1 配置weblogic环境变量
[weblogic@localhost ~]$ su root
cd /home/weblogic/
cat >> .bashrc << EOF
export MW_HOME="/home/weblogic/weblogic_install/"
export WL_HOME="/home/weblogic/weblogic_install/oracle_common"
EOF
配置完成后,切回weblogic用户查看变量是否设置成功
[root@localhost weblogic]# echo $MW_HOME
二、创建自定义domain的文件夹路径
mkdir -p /home/weblogic/weblogic_install/user_projects/domains/base_domain/
4.2、运行wlst.sh开始设置域
1、进入weblogic中的common的bin目录下
cd /home/weblogic/weblogic_install/wlserver/common/bin
[weblogic@localhost bin]$ ./wlst.sh
WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin.
Initializing WebLogic Scripting Tool (WLST) ...
Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
readTemplate('/home/weblogic/weblogic_install/wlserver/common/templates/wls/wls.jar')
警告: readTemplate 已过时。在 selectTemplate 后请使用 loadTemplates 以取代 readTemplate。
cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', 7001)
cd('../..')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('weblogic123')
setOption('OverwriteDomain', 'true')
writeDomain('/home/weblogic/weblogic_install/user_projects/domains/base_domain')
closeTemplate()
exit()
说明:
1、只需要输入 wls:…>后边的命令就行了
2、set(‘ListenAddress’,’’)
这个我默认为空,不设置也可以
3、set(‘ListenPort’, 7001)
welogic域监听的端口号,修改成自己想要设置的
4、cmo.setPassword(‘weblogic123’)
设置域的登录密码
5、writeDomain(’/home/weblogic/weblogic_install/user_projects/domains/base_domain’)
设置上边新建的目录为新建域的工作目录
6、其他的基本是固定
启动方式一:
这样启动后,按ctrl + c , 服务就会停止
启动方式二:
将启动日志写入到nohup.out文件中:
nohup sh startWebLogic.sh &
查看nohup.out文件
五、查看服务
或者直接根据端口号查找
六、停止服务
kill -9 4975 4976
或
kill -9 1380
4.3、weblogic域管理控制台访问
http://192.168.40.180:7001/console/
用户名:weblogic
密 码:weblogic123
等待一会会弹出如下登录页面