<\/span><\/h2>\nIn order to run WildFly on the server, we have to install Java. We will install and use OpenJDK, which is a free and open-source implementation of the Java Platform. To install it on your Ubuntu 18.04 server, just run the following command.<\/p>\n
install -y default-jdk<\/pre>\nOnce all necessary packages are installed, you can then check the version of Java that’s installed on your server.<\/p>\n
Java --version<\/pre>\nThe output should look something like this:<\/p>\n
openjdk 10.0.2 2018-07-17\r\nOpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)\r\nOpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)<\/pre>\n<\/span>Step 3: Create a system user<\/strong><\/span><\/h2>\nIt is not recommended to run WildFly as the root uset, so we’ll have to create a new system user. Execute the following commands to create a ‘wildfly’ system user and group:<\/p>\n
groupadd -r wildfly\r\nuseradd -r -g wildfly -d \/opt\/wildfly -s \/sbin\/nologin wildfly<\/pre>\n<\/span>Step 4: Download WildFly<\/strong><\/span><\/h2>\nGo to WildFly’s official website and download the latest stable release of the application to your server. At the moment of writing this tutorial it is version 16.0.0. We have included the link in our command below.<\/p>\n
wget https:\/\/download.jboss.org\/wildfly\/16.0.0.Final\/wildfly-16.0.0.Final.zip<\/pre>\nOnce the downloaded ZIP arhive is downloaded, unpack it by executing the following command.<\/p>\n
unzip wildfly-16.0.0.Final.zip -d \/opt<\/pre>\nAll of WildFly’s files and directories will be stored in a new ‘wildfly-16.0.0.Final’ directory. We will rename it simply to ‘wildfly’<\/p>\n
mv wildfly-16.0.0.Final wildfly<\/pre>\nSince we will run WildFly under the newly created ‘wildfly’ user, set the correct ownership to the WildFly files:<\/p>\n
chown -R wildfly:wildfly \/opt\/wildfly<\/pre>\n<\/span>Step 5: Configure WildFly<\/strong><\/span><\/h2>\nNext, we will configure WildFly to run as a service. We will start by creating a ‘\/etc\/wildfly’ directory.<\/p>\n
mkdir \/etc\/wildfly<\/pre>\nWildFly comes with all of the necessary scripts and configuration files needed to run. Copy the configuration file to the newly created directory:<\/p>\n
cp \/opt\/wildfly\/docs\/contrib\/scripts\/systemd\/wildfly.conf \/etc\/wildfly<\/pre>\nThen copy the launch.sh script and the systemd unit file to the appropriate directories, as shown below.<\/p>\n
cp \/opt\/wildfly\/docs\/contrib\/scripts\/systemd\/wildfly.service \/etc\/systemd\/system\/wildfly.service\r\ncp \/opt\/wildfly\/docs\/contrib\/scripts\/systemd\/launch.sh \/opt\/wildfly\/bin\/launch.sh<\/pre>\nEnable and start the WildFly service:<\/p>\n
systemctl enable wildfly\r\nsystemctl start wildfly<\/pre>\nYou can verify that WildFly is running on your server using the following command:<\/p>\n
systemctl status wildfly<\/pre>\nIf everything is OK, you will get an output that looks similar to the following:<\/p>\n
wildfly.service - The WildFly Application Server\r\n Loaded: loaded (\/etc\/systemd\/system\/wildfly.service; enabled; vendor preset: enabled)\r\n Active: active (running)\r\n Main PID: 9294 (launch.sh)\r\n Tasks: 25 (limit: 2320)\r\n CGroup: \/system.slice\/wildfly.service\r\n \u00e2\u00e29294 \/bin\/bash \/opt\/wildfly\/bin\/launch.sh standalone standalone.xml 0.0.0.0\r\n \u00e2\u00e29295 \/bin\/sh \/opt\/wildfly\/bin\/standalone.sh -c standalone.xml -b 0.0.0.0\r\n \u00e2\u00e29388 java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.base\r\nsystemd[1]: Started The WildFly Application Server.<\/pre>\nAt this point, you should be able to access your WildFly instance at http:\/\/IP_Address:8080<\/code> and you will get the default WildFly home page.<\/p>\n<\/p>\n