Installing WildFly as a service on Linux have multiple advantages like automatic start on system boot, convinient managemen T service
with command, better security and other.
To install the WildFly as a service on the CentOS and other rpm-based Linux distributions do steps described below.
This are suitable for installing WildFly 8 and 9.
Install Java (requires JDK in order-to-support JSP)
yum install java-1.8.0-openjdk-devel
Download WildFly and unpack binaries
wget http://download.jboss.org/wildfly/9.0.1.Final/wildfly-9.0.1.Final.zipunzip wildfly-9.0.1.Final.zip -d /opt/
Create Symbolic link in order to simplify WildFly updates on future
-s /opt/wildfly-9.0.1.Final /opt/wildfly
Copy and edit init script configuration
cp /opt/wildfly/bin/init.d/wildfly.conf /etc/default/wildfly.conf
Edit variables in /etc/default/wildfly.conf
# # Location of Jdkjava_home="/usr/lib/jvm/java-1.8.0"# # Location of Wildflyjboss_home="/opt/wildfly"# # The username who should own the process. Jboss_user=wildfly# # The mode WildFly should start, standalone or Domainjboss_mode=standalone# # Configuration for standalone Modejbo Ss_config=standalone-full-ha.xml ## Configuration for domain mode# jboss_domain_config=domain.xml# Jboss_ Host_config=host-master.xml# # The amount of time to wait forstartupstartup_wait=# # # The amount of time to WA It for shutdownshutdown_wait=# # # location to keep the console logjboss_console_log="/var/log/wildfly/ Console.log "# Additionals args to include in startup# jboss_opts="--admin-only-b 172.0.0.1 "
Copy init script
cp /opt/wildfly/bin/init.d/wildfly-init-redhat.sh /etc/init.d/wildfly
ADD WildFly as a service
chkconfig --add wildflychkconfig wildfly on
Create Directory for logs
mkdir -p /var/log/wildfly
ADD user to run WildFly
adduser wildfly
Change the owner of WildFly directories
chown -R wildfly:wildfly /opt/wildfly-9.0.1.Finalchown -R wildfly:wildfly /opt/wildflychown -R wildfly:wildfly /var/log/wildfly
Start WildFly
service wildfly start
See also what to install WildFly on Ubuntu.
Just to add a bit:
You can create a nologin/no home user with
# AddUser--no-create-home Wildfly
# usermod-s/sbin/nologin Wildlfy
------------------------------------
Http://developer-should-know.com/post/112230363742/how-to-install-wildfly-as-a-service-on-linux
http://blog.csdn.net/yuqiongran/article/details/52524483
How to Install the WildFly as a Service on Linux