Developers Getting Started With i2b2
Space shortcuts
Space Tools
Skip to end of metadata
Go 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.

Overview of Steps

These are the basic steps that will be taken to set up the Linux Service.


Step 1: Change Working Directory
Step 2: Copy Wildfly Init Directory
Step 3: Create a New Directory
Step 4: Copy Configuration File to the New Directory
Step 5: Edit Configuration File
Step 6: Start Wildfly and Verification

Overview of Directories Involved in the Process

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.
These services are usually those that are to automatically start when the system is rebooted.

/wildfly-17.0.0.Final/bin/init.d  

Wildfly directory that was created when Wildfly was installed.
It contains the configuration file and script to start Wildfly as a service.



The remaining sections will outline the steps to setup Wildfly to run as a Linux service.


Step 1: Change Working Directory

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


1. Open the terminal.
2. Enter the following command to change your directory to the int.d directory in your Wildfly directory.

Change Directory Command


CD YOUR_WILDFLY_HOME_DIR/docs/contrib/scripts/init.d


Example: cd /opt/wildfly-10.0.0.Final/docs/contrib/scripts/init.d


Step 2: Copy the Wildfly Init 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


1. Enter the following command to copy wildfly-init-redhat.sh file from the Wildfly directory.

Copy Command


cp wildfly-init-redhat.sh /etc/init.d/wildfly


2. A copy of the file now resides in the standard /etc/init.d directory


Step 3: Create a New Directory

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


1. Enter the following command to create a new directory called wildfly.

Create Directory Command


mkdir /etc/default/wildfly


2. A new directory called wildfly now resides in the /etc directory.


Step 4: Copy Configuration File to New Directory

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


1. Enter the following command to copy wildfly.conf file from your Wildfly directory.

Copy Command


cp wildfly.conf /etc/defaults/widlfly


2. A copy of the file now resides in the standard /etc/defaults/wildfly directory


Step 5: Edit Configuration File

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


1. Enter the following command to open the wildfly.conf file in your /etc/defaults/wildfly directory.

Open Command


open /etc/defaults/wildfly.conf

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


2. Edit the JBOSS_USER to the name of the wildfly user who is the owner of the process.
3. Save the changes and close the file.


Step 6: Start Wildfly and Verification

The sixth and final step is to start Wildfly and verify it is running correctly.

1. Enter the following command to start your Wildfly server.

Change Directory Command


/etc/init.d/wildfly start


2. The Wildfly server will run the commands to start.
3. Once it has finished you can open a web browser and enter the following address:
4. The Wildfly Welcome page will display if your Wildfly server started correctly.