...
Code Block |
---|
|
useradd -d /usr/local/wildfly-x.x.x.Final -M wildfly
chown -R wildfly. /usr/local/wildfly-x.x.x.Final |
On Enterprise Linux 6 and older:
Copy the files from the $WILDFLY_HOME/docs/contrib/scripts/init.d
folder as follows:
Code Block |
---|
|
cd /usr/local/wildfly-x.x.x.Final/docs/contrib/scripts/init.d
cp wildfly.conf /etc/default/wildfly
cp wildfly-init-redhat.sh /etc/init.d/wildfly
chmod 544 /etc/init.d/wildfly |
Open /etc/default/wildfly
in your favorite text editor, and set the following variables properly:
Code Block |
---|
language | text |
---|
title | /etc/default/wildfly |
---|
|
JAVA_HOME=/usr/local/java/jdk1.8.0_181
JBOSS_HOME=/usr/local/wildfly-x.x.x.Final
JBOSS_USER=wildfly
JBOSS_MODE=standalone
JBOSS_CONFIG=standalone.xml |
Having done that, use chkconfig
to install WildFly as a service to all relevant run levels.
Code Block |
---|
|
chkconfig --level 2345 wildfly on |
On Enterprise Linux 7 and newer:
Create the file wildfly-Create the file wildfly-service
as a systemd service in /etc/systemd/system/
:
Code Block |
---|
language | text |
---|
title | /etc/systemd/system/wildfly.service |
---|
|
[Unit]
Description=WildFly {{ wildfly_version }} Java EE Application Server
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User={{ wildfly_user }}
Group={{ wildfly_user }}
ExecStart={{ wildfly_home }}/bin/standalone.sh -b=0.0.0.0 -bmanagement=0.0.0.0
[Install]
WantedBy=multi-user.target |
...
In case you need to uninstall WildFly as a systemd service, here are the instructions for it. To uninstall WildFly just remove the service files. :
Code Block |
---|
|
systemctl stop wildfly.service
systemctl disable wildfly.service
chkconfigrm --level 2345 wildfly off
rf /etc/systemd/system/wildfly*
rm -rrf /etc/init.d/wildflylib/systemd/system/wildfly* # optional
systemctl daemon-reload
systemctl reset-failed # optional
rm /etc/default/wildfly
userdel wildfly |
...