November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

install wildfly 10 on centos 7

Introduction
WildFly formerly known as JBoss web and application server is an open source high performance web application server written in Java.

It is specially designed for high throughput and is able to handle millions of connections. WildFly is a simple, flexible, lightweight, managed application runtime that can help you build amazing applications easily. WildFly’s architecture is based on pluggable subsystems, so you can easily add or remove. This will allow you to reduce the overall disk footprint and memory overhead of the server. WildFly supports two modes: a single JVM (standalone mode) and a multi-JVM (domain mode) that can be used to synchronize configuration across any number of processes and hosts.

In this tutorial we will learn how to install and configure the WildFly application server on a server running CentOS 7.

Requirements
A server running CentOS 7.
A non-root user with sudo privilege setup on your server.
A static IP address [example: 192.168.1.22] configured on your server.

header

wget http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz
UPDATED FOR JDK 8u151

TAR GZ:

wget –no-check-certificate -c –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
UPDATED FOR JDK 8u144

TAR GZ:

wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz”
RPM:

wget -c –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm
UPDATED FOR JDK 8u131

RPM:

wget -c –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
TAR GZ:

wget -c –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
RPM using curl:

curl -v -j -k -L -H “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm > jdk-8u112-linux-x64.rpm
In all cases above, subst ‘i586’ for ‘x64’ to download the 32-bit build.

-j -> junk cookies
-k -> ignore certificates
-L -> follow redirects
-H [arg] -> headers

To start the wildfly instance, we need to run the script named ‘standalone.sh’ located in the ‘bin’ directory,
$ cd /data/wildfly-10.1.0.Final/bin
$ sh standalone.sh
This will start the wildfly instance. To access the instance, open the web browser & enter the following URL in the web browser
http://192.168.1.100:8080
This will open default wildfly page on the browser.
Step 4 – Accessing management console
To access the management console, URL is
http://192.168.1.100:9990
But we can’t access the page just yet, we need to create a management user to access the console. To create a management user, firstly stop the running instance by pressing ‘ctrl + c’ & then in ‘bin’ directory itself, run script named ‘add-user.sh’ ,
$ cd /data/wildfly-10.1.0.Final/bin
$ sh add-user.sh
Once the script starts, follow the onscreen steps to create a management user. After the username and password has been set up, same can be used to access the management console from the URL mentioned above.
This was our step by step tutorial on wildfly 10.1.0 installation. Please feel free to send your queries/questions or suggestions using the comment box below.

Read more: http://linuxtechlab.com/wildfly-10-10-1-0-installation/#ixzz4wrx5sWFT

#!/bin/bash
#title :wildfly-install.sh
#usage :/bin/bash wildfly-install.sh
#tested-version1 :10.0.0.CR3
#tested-distros1 :Ubuntu 15.10; Debian 7,8; CentOS 7; Fedora 22
#tested-version2 :10.0.0.Final
#tested-distros2 :Debian 8

WILDFLY_VERSION=10.0.0.Final
WILDFLY_FILENAME=wildfly-$WILDFLY_VERSION
WILDFLY_ARCHIVE_NAME=$WILDFLY_FILENAME.tar.gz
WILDFLY_DOWNLOAD_ADDRESS=http://download.jboss.org/wildfly/$WILDFLY_VERSION/$WILDFLY_ARCHIVE_NAME

INSTALL_DIR=/data/app
WILDFLY_FULL_DIR=$INSTALL_DIR/$WILDFLY_FILENAME
WILDFLY_DIR=$INSTALL_DIR/wildfly

WILDFLY_USER=”wildfly”
WILDFLY_SERVICE=”wildfly”
WILDFLY_MODE=”standalone”

WILDFLY_STARTUP_TIMEOUT=240
WILDFLY_SHUTDOWN_TIMEOUT=30

SCRIPT_DIR=”$( cd “$( dirname “${BASH_SOURCE[0]}” )” && pwd )”

if [[ $EUID -ne 0 ]]; then
echo “This script must be run as root.”
exit 1
fi

echo “Downloading: $WILDFLY_DOWNLOAD_ADDRESS…”
[ -e “$WILDFLY_ARCHIVE_NAME” ] && echo ‘Wildfly archive already exists.’
if [ ! -e “$WILDFLY_ARCHIVE_NAME” ]; then
wget -q $WILDFLY_DOWNLOAD_ADDRESS
if [ $? -ne 0 ]; then
echo “Not possible to download Wildfly.”
exit 1
fi
fi

echo “Cleaning up…”
rm -f “$WILDFLY_DIR”
rm -rf “$WILDFLY_FULL_DIR”
rm -rf “/var/run/$WILDFLY_SERVICE/”
rm -f “/etc/init.d/$WILDFLY_SERVICE”

echo “Installation…”
mkdir $WILDFLY_FULL_DIR
tar -xzf $WILDFLY_ARCHIVE_NAME -C $INSTALL_DIR
ln -s $WILDFLY_FULL_DIR/ $WILDFLY_DIR
useradd -s /sbin/nologin $WILDFLY_USER
chown -R $WILDFLY_USER:$WILDFLY_USER $WILDFLY_DIR
chown -R $WILDFLY_USER:$WILDFLY_USER $WILDFLY_DIR/

#mkdir -p /var/log/$WILDFLY_SERVICE

echo “Registrating Wildfly as service…”
# if should use systemd
if [ -x /bin/systemctl ]; then
# Script from $WILDFLY_DIR/docs/contrib/scripts/systemd/launch.sh didn’t work for me
cat > $WILDFLY_DIR/bin/launch.sh << "EOF" #!/bin/sh if [ "x$WILDFLY_HOME" = "x" ]; then WILDFLY_HOME="/data/app/wildfly" fi if [ "x$1" = "xdomain" ]; then echo 'Starting Wildfly in domain mode.' $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 #>> /var/log/$WILDFLY_SERVICE/server-`date +%Y-%m-%d`.log
else
echo ‘Starting Wildfly in standalone mode.’
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
#>> /var/log/$WILDFLY_SERVICE/server-`date +%Y-%m-%d`.log
fi
EOF
# $WILDFLY_HOME is not visible here
sed -i -e ‘s,WILDFLY_HOME=.*,WILDFLY_HOME=’$WILDFLY_DIR’,g’ $WILDFLY_DIR/bin/launch.sh
#sed -i -e ‘s,$WILDFLY_SERVICE,’$WILDFLY_SERVICE’,g’ $WILDFLY_DIR/bin/launch.sh
chmod +x $WILDFLY_DIR/bin/launch.sh

cp $WILDFLY_DIR/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/$WILDFLY_SERVICE.service
WILDFLY_SERVICE_CONF=/etc/default/$WILDFLY_SERVICE
# To install multiple instances of Wildfly replace all hardcoding in systemd file
sed -i -e ‘s,EnvironmentFile=.*,EnvironmentFile=’$WILDFLY_SERVICE_CONF’,g’ /etc/systemd/system/$WILDFLY_SERVICE.service
sed -i -e ‘s,User=.*,User=’$WILDFLY_USER’,g’ /etc/systemd/system/$WILDFLY_SERVICE.service
sed -i -e ‘s,PIDFile=.*,PIDFile=/var/run/wildfly/’$WILDFLY_SERVICE’.pid,g’ /etc/systemd/system/$WILDFLY_SERVICE.service
sed -i -e ‘s,ExecStart=.*,ExecStart=’$WILDFLY_DIR’/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND,g’ /etc/systemd/system/$WILDFLY_SERVICE.service
systemctl daemon-reload
#systemctl enable $WILDFLY_SERVICE.service
fi

# if non-systemd Debian-like distribution
if [ ! -x /bin/systemctl -a -r /lib/lsb/init-functions ]; then
cp $WILDFLY_DIR/docs/contrib/scripts/init.d/wildfly-init-debian.sh /etc/init.d/$WILDFLY_SERVICE
sed -i -e ‘s,NAME=wildfly,NAME=’$WILDFLY_SERVICE’,g’ /etc/init.d/$WILDFLY_SERVICE
WILDFLY_SERVICE_CONF=/etc/default/$WILDFLY_SERVICE
fi

# if non-systemd RHEL-like distribution
if [ ! -x /bin/systemctl -a -r /etc/init.d/functions ]; then
cp $WILDFLY_DIR/docs/contrib/scripts/init.d/wildfly-init-redhat.sh /etc/init.d/$WILDFLY_SERVICE
WILDFLY_SERVICE_CONF=/etc/default/wildfly.conf
chmod 755 /etc/init.d/$WILDFLY_SERVICE
fi

# if neither Debian nor RHEL like distribution
if [ ! -x /bin/systemctl -a ! -r /lib/lsb/init-functions -a ! -r /etc/init.d/functions ]; then
cat > /etc/init.d/$WILDFLY_SERVICE << "EOF" #!/bin/sh ### BEGIN INIT INFO # Provides: ${WILDFLY_SERVICE} # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop ${WILDFLY_FILENAME} ### END INIT INFO WILDFLY_USER=${WILDFLY_USER} WILDFLY_DIR=${WILDFLY_DIR} case "$1" in start) echo "Starting ${WILDFLY_FILENAME}..." start-stop-daemon --start --background --chuid $WILDFLY_USER --exec $WILDFLY_DIR/bin/standalone.sh exit $? ;; stop) echo "Stopping ${WILDFLY_FILENAME}..." start-stop-daemon --start --quiet --background --chuid $WILDFLY_USER --exec $WILDFLY_DIR/bin/jboss-cli.sh -- --connect command=:shutdown exit $? ;; log) echo "Showing server.log..." tail -500f $WILDFLY_DIR/standalone/log/server.log ;; *) echo "Usage: /etc/init.d/wildfly {start|stop}" exit 1 ;; esac exit 0 EOF sed -i -e 's,${WILDFLY_USER},'$WILDFLY_USER',g; s,${WILDFLY_FILENAME},'$WILDFLY_FILENAME',g; s,${WILDFLY_SERVICE},'$WILDFLY_SERVICE',g; s,${WILDFLY_DIR},'$WILDFLY_DIR',g' /etc/init.d/$WILDFLY_SERVICE chmod 755 /etc/init.d/$WILDFLY_SERVICE fi if [ ! -z "$WILDFLY_SERVICE_CONF" ]; then echo "Configuring service..." echo JBOSS_HOME=\"$WILDFLY_DIR\" > $WILDFLY_SERVICE_CONF
echo JBOSS_USER=$WILDFLY_USER >> $WILDFLY_SERVICE_CONF
echo WILDFLY_HOME=\”$WILDFLY_DIR\” > $WILDFLY_SERVICE_CONF
echo WILDFLY_USER=\”$WILDFLY_USER\” > $WILDFLY_SERVICE_CONF
echo STARTUP_WAIT=$WILDFLY_STARTUP_TIMEOUT >> $WILDFLY_SERVICE_CONF
echo SHUTDOWN_WAIT=$WILDFLY_SHUTDOWN_TIMEOUT >> $WILDFLY_SERVICE_CONF
echo WILDFLY_CONFIG=$WILDFLY_MODE.xml >> $WILDFLY_SERVICE_CONF
echo WILDFLY_MODE=$WILDFLY_MODE >> $WILDFLY_SERVICE_CONF
echo WILDFLY_BIND=0.0.0.0 >> $WILDFLY_SERVICE_CONF
fi

echo “Configuring application server…”
sed -i -e ‘s,,,g’ $WILDFLY_DIR/$WILDFLY_MODE/configuration/$WILDFLY_MODE.xml
sed -i -e ‘s,,,g’ $WILDFLY_DIR/$WILDFLY_MODE/configuration/$WILDFLY_MODE.xml
sed -i -e ‘s,,,g’ $WILDFLY_DIR/$WILDFLY_MODE/configuration/$WILDFLY_MODE.xml
sed -i -e ‘s,,,g’ $WILDFLY_DIR/$WILDFLY_MODE/configuration/$WILDFLY_MODE.xml
sed -i -e ‘s,,,g’ $WILDFLY_DIR/$WILDFLY_MODE/configuration/$WILDFLY_MODE.xml

[ -x /bin/systemctl ] && systemctl start $WILDFLY_SERVICE || service $WILDFLY_SERVICE start

echo “Done.”

To start the wildfly instance, we need to run the script named ‘standalone.sh’ located in the ‘bin’ directory,
$ cd /data/wildfly/bin
$ sh standalone.sh
This will start the wildfly instance. To access the instance, open the web browser & enter the following URL in the web browser
http://192.168.1.22:8080
This will open default wildfly page on the browser.

To access the management console, URL is
http://192.168.1.22:9990
But we can’t access the page just yet, we need to create a management user to access the console. To create a management user, firstly stop the running instance by pressing ‘ctrl + c’ & then in ‘bin’ directory itself, run script named ‘add-user.sh’ ,
$ cd /data/wildfly/bin
$ sh add-user.sh
Once the script starts, follow the onscreen steps to create a management user. After the username and password has been set up, same can be used to access the management console from the URL mentioned above.
This was our step by step tutorial on wildfly 10.1.0 installation. Please feel free to send your queries/questions or suggestions using the comment box below.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>