Here is a step by step guide to get WildFly 9 running as service
1. sudo ln -s /home/kamal/wildfly-9.0.1.Final /opt/wildfly
2. sudo cp /opt/wildfly/bin/init.d/wildfly.conf /etc/default/wildfly.conf
3. sudo vi /etc/default/wildfly.conf
Edit
JAVA_HOME=”/usr/java/jdk1.7.0_71″
JBOSS_HOME=”/opt/wildfly”
JBOSS_USER=wildfly ##root
JBOSS_MODE=standalone
JBOSS_CONFIG=standalone.xml
STARTUP_WAIT=60
SHUTDOWN_WAIT=60
JBOSS_CONSOLE_LOG=”/var/log/wildfly/console.log”
4. sudo cp /opt/wildfly/bin/init.d/wildfly-init-redhat.sh /etc/init.d/wildfly
5. sudo chkconfig –add wildfly
6. sudo chkconfig wildfly on
7. sudo mkdir -p /var/log/wildfly
8. sudo adduser wildfly
9. sudo chown -R wildfly:wildfly /opt/wildfly-8.2.0.Final
10. sudo chown -R wildfly:wildfly /home/kamal/wildfly-9.0.1.Final
11. sudo chown wildfly:wildfly /opt/wildfly
12. sudo chown wildfly:wildfly /var/log/wildfly
Finally sudo service wildfly start
Check logs
$ vi /var/log/wildfly/console.log
If you are facing issues with permission, you might want to set user as root in wildfly.conf file
Source:
developer-should-know.tumblr.com/post/112230363742/how-to-install-wildfly-as-a-service-on-linux