Install WildFly (12) as a Service on Ubuntu 16.04

Today, I was setting up a WildFly application server on an Amazon EC2 machine.

After som swearing and teeth grinding I discovered that the old systems of init.d files and rc files has been abandoned for a couple of years… Thanks to Ask Ubuntu user JdeBP for that.

Looking further, I went to the cornucopia of knowledge that is the StackExchange universe. Here Oleg Gritsak suggested creating a file /etc/systemd/system/wildfly.service with the content

Description=WildFly application server



His answer on StackOverflow is found here.

So I removed all wildfly scripts and symlinks from /etc/init.d and the /etc/rc[0-6].d directories. Enabled the new /etc/systemd/system/wildfly.service script by issuing

$ sudo systemctl enable wildfly

It did, however, not work instantly.

Issuing systemctl start wildfly did not show any output and did not start WildFly either, but when I rebooted the EC2 instance WildFly was (suddenly) running. Issuing

$ curl http://localhost:8080 


$ less /usr/local/wildfly-12.0.0.Final/standalone/log/server.log

gave me the expected output and “my system was a GO”!

Thanks to Oleg Gritsak for the answer that gave me the solution and Mehrdad Islamkhah who asked the question, as well as JdeBP and Dor who discussed init scripts on AskUbuntu.

Leave a comment