How to install Wildfly 9 on Debian-based Linux distribution

5 Comments

Wildfly 9 is the latest version of previously known Jboss Application Server (Jboss AS). In this tutorial we’re going to see how we can download, install, configure and start Wildfly 9 on Linux.

wildfly logo

0- Requisites

Java!

1- Download

First we need to get the download link, simply browse to http://wildfly.org/downloads/ and you will see the list of available versions that can be downloaded, we’re going to choose the latest one, copy the download link from the ZIP hyperlink as seen below:

wildfly-download-link

Now we have the link, and assuming we are in the downloads directory of the user, we must execute the following command in order to download Wildfly 9:

1
2
cd /home/ali/downloads
wget http://download.jboss.org/wildfly/9.0.1.Final/wildfly-9.0.1.Final.zip

The shell will then inform us of the download progress, and when it’s done, we will have a new zip file in our downloads directory: wildfly-9.0.1.Final.zip

2- Install

Installing Wildfly is pretty straightforward, first we need to unzip:

1
unzip wildfly-9.0.1.Final.zip

Now will have a new directory in our downloads directory, named wildfly-9.0.1.Final

We just need to place it somewhere, you can actually place it wherever you want, maybe in your home directory, but it’s mostly preferable to place it under /opt (you need sudo), so either way, you can execute the following command to place the new directory someplace more convenient for you:

1
mv wildfly-9.0.1.Final /home/ali/wildfly

In case you want to place it in /opt:

1
2
3
sudo -i
[Provide your password......]
mv wildfly-9.0.1.Final /opt/wildfly

The directory where Wildfly was installed, and the user who controls this installation and directory are two important parameters that we’re going to use later.

3- Configure

Before we run Wildfly, some configurations must be done.

Port

The default HTTP port for Wildfly is 8080, but maybe you have installed Tomcat before so you need Wildfly to run on a different port, whatever the reason is, to change the port you need to edit the standalone.xml file located at:

1
[WILDFLY_INSTALLATION_DIRECTORY]/standalone/configuration/standalone.xml

Locate the following:

1
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

And change the offset to a value of your choice, for example, if I change the offset to 10:

1
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:10}">

Then all default ports will change and increase by 10, HTTP port will be 8090 instead of 8080.

Management User

You need a management user in case you want to use the management web interface, to do so, you need to execute the following script:

1
[WILDFLY_INSTALLATION_DIRECTORY]/bin/add-user.sh

It will ask you to provide a username and a password, simply do, and the user will be created.

Web Access

By default, you will be able to access Wildfly via web only on your local system, by browsing to:

http://localhost:8090 [or any port that you have previously configured]

If you need access from outside, you must locate the following in standalone.xml:

1
2
3
4
5
6
<interface name="management">
    <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
    <inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>

And change that to:

1
2
3
4
5
6
<interface name="management">
    <any-address/>
</interface>
<interface name="public">
    <any-address/>
</interface>

4- Run

To run Wildfly you can simply execute the standalone.sh script located at:

1
[WILDFLY_INSTALLATION_DIRECTORY]/bin/standalone.sh

This is a pretty straightforward approach and it does not require any configuration.

If you need Wildfly to run in the background (and maybe at system startup), you must install Wildfly as a service:

Copy wildfly.conf to /etc/default/ and change the name to wildfly

1
cp [WILDFLY_INSTALLATION_DIRECTORY]/bin/init.d/wildfly.conf /etc/default/wildfly

Edit this file to set your own configurations, they will be discarded by default because of the #.

You need to set some values, for example, JAVA_HOME must be set to where you have Java installed, JBOSS_USER (default: wildfly) must be set to the user who will be running Wildfly and who owns the main directory, JBOSS_HOME (default: /opt/widlfly) is the main directory where you have placed the installation files, JBOSS_CONSOLE_LOG is where logs will be stored (make sure the user have write access to this file).

Now you need to copy the wildfly-init-debian.sh to /etc/init.d and rename it to wildfly.

1
cp [WILDFLY_INSTALLATION_DIRECTORY]/bin/init.d/wildfly-init-debian.sh /etc/init.d/wildfly

And this is enough to install Wildfly as a service, to run the service, simply execute:

1
service wildfly start

wildfly-homepage

Categories: Java, Web Servers Tags: Tags: ,

5 Replies to “How to install Wildfly 9 on Debian-based Linux distribution”

  1. I have followed all of the steps but it still says wildfly is an unrecognized service.
    Any advice for this?
    Thanks

  2. Hello, I followed your guide, which by the way is very clear. But I’m not able to acces to my console.

    Let me explain better. I’m using Linux, and decided to offset all the port numbers by 1. So once JBOSS starts I’m able to access to Wildfly on port 8081, but I’m not able to access the admin console at port 9991.

    In fact, if I change back ad reset the port offset to 0 (default ) I’m able to access the public interface at port 8080 and admin console to 9990.

    I don’t understand what I’m doing wrong.

    Thank you

Leave a Reply

%d bloggers like this: