On the General tab, in the Service to protect field, choose the WildFly windows service. There will be a green circle on the left if WildFly is already running, as was the case on our server: There are a few reports of WildFly occasionally getting stuck in the 'Stopping' state. We will install the latest version of WildFly 20, enable admin console for WildFly, create the WildFly admin user, and setup Nginx as a reverse proxy for WildFly. Prerequisites For this guide, we will install WildFly on the latest Ubuntu Server 20.04 FocalFossa with 2 GB of RAM, 50 GB free disk space, and 2 CPUs.
This tutorial covers WildFly application server installation and configuration as a Service on Windows.
First off, you need to download a JDK which is supported by WildFly. If you are not sure which one to download, check this article: Choosing the right JDK for WildFly and JBoss EAP 7 . Now Install the JDK : https://www.oracle.com/technetwork/java/javase/downloads/index.html
Once you have installed WildFly, set the JAVA_HOME as follows:
- Locate your Java installation directory.
- Click the Environment Variables button.
- Under System Variables, click New.
- In the Variable Name field, enter 'JAVA_HOME'
- In the Variable Value field, enter your JDK or JRE installation path . ...
- Click OK and Apply Changes as prompted.
Install WildFly on Windows
Navigate to https://wildfly.org/downloads/ and download the zip file with the latest stable version of WildFly application server. Unzip the archive and move to the 'bin' folder.
Move to the folder 'bin' which is under WildFly installation and start WildFly with:
The application server will start as you can see from the Console:
You can check that it's running, by reaching the home page at localhost:8080
Installing WildFly as a service.
In order to install WildFly as service on Windows:
- Navigate to the dolder 'JBOSS_HOMEdocscontribscripts'.
- Copy the service directory to JBOSS_HOMEbin
- Open an Admin Shell and navigate into the service folder
- Run 'service.bat install'
Next open windows Services, you should see Wildfly installed, you can now start it from here and set it to automatic:
Skip to end of metadataGo to start of metadata
Setting up a Linux service to run your Wildfly Web Server will allow the server to continuously run in the background, without any user interaction. Another advantage of a Linux service is that it will run no matter which user is logged onto the machine. This means you do not have to leave a user logged onto the server just to keep Wildfly running. You can also configure the service to start automatically if the system is rebooted.
The information in this section will guide you through setting up Wildfly 17 to run as a Linux Service.
These are the basic steps that will be taken to set up the Linux Service.
The following is an overview of the directories that will be used and referenced during the process of setting up JBoss to run as a service.
Directory | Description |
---|---|
/etc | Standard Linux directory that contains the configuration files for the system. |
/etc/init.d | Standard Linux directory that contains the startup scripts for various system services. |
/wildfly-17.0.0.Final/bin/init.d | Wildfly directory that was created when Wildfly was installed. |
Wildfly Configuration
The remaining sections will outline the steps to setup Wildfly to run as a Linux service.
The first step is to log into the terminal and change your working directory to the init.d directory in your Wildfly directory. The init.d directory in your Wildfly directory contains the configuration file and script to start Wildfly.
Steps to Change Working Directory
The second step in this process is to copy the Wildfly Control Script called wildfly-init-redhat.sh to the initialization directory on your Linux server. The wildfly-init-redhat.sh file contains the start and stop commands for the Wildfly Server and by copying it to your initialization directory the Wildfly server will be able to start automatically when the system is rebooted.
Steps to Copy jboss-as-standalone.sh File
Assumptions: you are still logged into the terminal and the working directory is /jboss-as-7.1.1.1.Final/bin/init.d
The third step in this process is to create a new directory in the standard etc directory. This new directory will contain the configuration file for when the JBoss service is started.
Create Directory Steps
The fourth step is to copy the configuration file called wildfly.conf to the directory you just created in the previous step. This file contains the general configuration for the init.d scripts.
Steps to Copy wildflyconf File
Assumptions: you are still logged into the terminal and the working directory is /wildfly-10.0.0.Final/docs/contrib/scripts/init.d
The fifth step is to edit the JBOSS_USER in the jwildfly.conf file that you just copied to the wildfly directory in your etc directory. The JBoss user is the person who owns the process of stopping and starting the Wildfly server.
Steps to Update JBOSS_USER
Important
If you are connected to the server remotely then you will need to alter the above command to open it with a text editor. Instead of open you would type vi or whatever editor command is appropriate for your environment.
Example: vi /etc/defaults/wildfly.conf
The sixth and final step is to start Wildfly and verify it is running correctly.