{"id":7119,"date":"2017-10-29T12:43:46","date_gmt":"2017-10-29T04:43:46","guid":{"rendered":"http:\/\/rmohan.com\/?p=7119"},"modified":"2017-10-29T12:46:54","modified_gmt":"2017-10-29T04:46:54","slug":"install-wildfly-10-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7119","title":{"rendered":"install wildfly 10 on centos 7"},"content":{"rendered":"<p>Introduction<br \/>\nWildFly formerly known as JBoss web and application server is an open source high performance web application server written in Java.<\/p>\n<p>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&#8217;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.<\/p>\n<p>In this tutorial we will learn how to install and configure the WildFly application server on a server running CentOS 7.<\/p>\n<p>Requirements<br \/>\nA server running CentOS 7.<br \/>\nA non-root user with sudo privilege setup on your server.<br \/>\nA static IP address [example: 192.168.1.22] configured on your server.<\/p>\n<p> header<\/p>\n<p>wget http:\/\/download.java.net\/java\/GA\/jdk9\/9\/binaries\/jdk-9+181_linux-x64_bin.tar.gz<br \/>\nUPDATED FOR JDK 8u151<\/p>\n<p>TAR GZ:<\/p>\n<p>wget &#8211;no-check-certificate -c &#8211;header &#8220;Cookie: oraclelicense=accept-securebackup-cookie&#8221; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u151-b12\/e758a0de34e24606bca991d704f6dcbf\/jdk-8u151-linux-x64.tar.gz<br \/>\nUPDATED FOR JDK 8u144<\/p>\n<p>TAR GZ:<\/p>\n<p>wget &#8211;no-cookies &#8211;no-check-certificate &#8211;header &#8220;Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie&#8221; &#8220;http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u144-b01\/090f390dda5b47b9b721c7dfaa008135\/jdk-8u144-linux-x64.tar.gz&#8221;<br \/>\nRPM:<\/p>\n<p>wget -c &#8211;header &#8220;Cookie: oraclelicense=accept-securebackup-cookie&#8221; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u144-b01\/090f390dda5b47b9b721c7dfaa008135\/jdk-8u144-linux-x64.rpm<br \/>\nUPDATED FOR JDK 8u131<\/p>\n<p>RPM:<\/p>\n<p>  wget -c &#8211;header &#8220;Cookie: oraclelicense=accept-securebackup-cookie&#8221; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u131-b11\/d54c1d3a095b4ff2b6607d096fa80163\/jdk-8u131-linux-x64.rpm<br \/>\nTAR GZ:<\/p>\n<p> wget -c &#8211;header &#8220;Cookie: oraclelicense=accept-securebackup-cookie&#8221; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u131-b11\/d54c1d3a095b4ff2b6607d096fa80163\/jdk-8u131-linux-x64.tar.gz<br \/>\nRPM using curl:<\/p>\n<p> curl -v -j -k -L -H &#8220;Cookie: oraclelicense=accept-securebackup-cookie&#8221; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u131-b11\/d54c1d3a095b4ff2b6607d096fa80163\/jdk-8u131-linux-x64.rpm > jdk-8u112-linux-x64.rpm<br \/>\nIn all cases above, subst &#8216;i586&#8217; for &#8216;x64&#8217; to download the 32-bit build.<\/p>\n<p>-j -> junk cookies<br \/>\n-k -> ignore certificates<br \/>\n-L -> follow redirects<br \/>\n-H [arg] -> headers<\/p>\n<p>To start the wildfly instance, we need to run the script named \u2018standalone.sh\u2019 located in the \u2018bin\u2019 directory,<br \/>\n$ cd \/data\/wildfly-10.1.0.Final\/bin<br \/>\n$ sh standalone.sh<br \/>\nThis will start the wildfly instance. To access the instance, open the web browser &#038; enter the following URL in the web browser<br \/>\nhttp:\/\/192.168.1.100:8080<br \/>\nThis will open default wildfly page on the browser.<br \/>\nStep 4 \u2013 Accessing management console<br \/>\nTo access the management console, URL is<br \/>\nhttp:\/\/192.168.1.100:9990<br \/>\nBut we can\u2019t 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 \u2018ctrl + c\u2019 &#038; then in \u2018bin\u2019 directory itself, run script named \u2018add-user.sh\u2019 ,<br \/>\n$ cd \/data\/wildfly-10.1.0.Final\/bin<br \/>\n$ sh add-user.sh<br \/>\nOnce 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.<br \/>\nThis 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.<\/p>\n<p>Read more: http:\/\/linuxtechlab.com\/wildfly-10-10-1-0-installation\/#ixzz4wrx5sWFT<\/p>\n<p>#!\/bin\/bash<br \/>\n#title           :wildfly-install.sh<br \/>\n#usage           :\/bin\/bash wildfly-install.sh<br \/>\n#tested-version1 :10.0.0.CR3<br \/>\n#tested-distros1 :Ubuntu 15.10; Debian 7,8; CentOS 7; Fedora 22<br \/>\n#tested-version2 :10.0.0.Final<br \/>\n#tested-distros2 :Debian 8<\/p>\n<p>WILDFLY_VERSION=10.0.0.Final<br \/>\nWILDFLY_FILENAME=wildfly-$WILDFLY_VERSION<br \/>\nWILDFLY_ARCHIVE_NAME=$WILDFLY_FILENAME.tar.gz<br \/>\nWILDFLY_DOWNLOAD_ADDRESS=http:\/\/download.jboss.org\/wildfly\/$WILDFLY_VERSION\/$WILDFLY_ARCHIVE_NAME<\/p>\n<p>INSTALL_DIR=\/data\/app<br \/>\nWILDFLY_FULL_DIR=$INSTALL_DIR\/$WILDFLY_FILENAME<br \/>\nWILDFLY_DIR=$INSTALL_DIR\/wildfly<\/p>\n<p>WILDFLY_USER=&#8221;wildfly&#8221;<br \/>\nWILDFLY_SERVICE=&#8221;wildfly&#8221;<br \/>\nWILDFLY_MODE=&#8221;standalone&#8221;<\/p>\n<p>WILDFLY_STARTUP_TIMEOUT=240<br \/>\nWILDFLY_SHUTDOWN_TIMEOUT=30<\/p>\n<p>SCRIPT_DIR=&#8221;$( cd &#8220;$( dirname &#8220;${BASH_SOURCE[0]}&#8221; )&#8221; &#038;&#038; pwd )&#8221;<\/p>\n<p>if [[ $EUID -ne 0 ]]; then<br \/>\n   echo &#8220;This script must be run as root.&#8221;<br \/>\n   exit 1<br \/>\nfi<\/p>\n<p>echo &#8220;Downloading: $WILDFLY_DOWNLOAD_ADDRESS&#8230;&#8221;<br \/>\n[ -e &#8220;$WILDFLY_ARCHIVE_NAME&#8221; ] &#038;&#038; echo &#8216;Wildfly archive already exists.&#8217;<br \/>\nif [ ! -e &#8220;$WILDFLY_ARCHIVE_NAME&#8221; ]; then<br \/>\n  wget -q $WILDFLY_DOWNLOAD_ADDRESS<br \/>\n  if [ $? -ne 0 ]; then<br \/>\n    echo &#8220;Not possible to download Wildfly.&#8221;<br \/>\n    exit 1<br \/>\n  fi<br \/>\nfi<\/p>\n<p>echo &#8220;Cleaning up&#8230;&#8221;<br \/>\nrm -f &#8220;$WILDFLY_DIR&#8221;<br \/>\nrm -rf &#8220;$WILDFLY_FULL_DIR&#8221;<br \/>\nrm -rf &#8220;\/var\/run\/$WILDFLY_SERVICE\/&#8221;<br \/>\nrm -f &#8220;\/etc\/init.d\/$WILDFLY_SERVICE&#8221;<\/p>\n<p>echo &#8220;Installation&#8230;&#8221;<br \/>\nmkdir $WILDFLY_FULL_DIR<br \/>\ntar -xzf $WILDFLY_ARCHIVE_NAME -C $INSTALL_DIR<br \/>\nln -s $WILDFLY_FULL_DIR\/ $WILDFLY_DIR<br \/>\nuseradd -s \/sbin\/nologin $WILDFLY_USER<br \/>\nchown -R $WILDFLY_USER:$WILDFLY_USER $WILDFLY_DIR<br \/>\nchown -R $WILDFLY_USER:$WILDFLY_USER $WILDFLY_DIR\/<\/p>\n<p>#mkdir -p \/var\/log\/$WILDFLY_SERVICE<\/p>\n<p>echo &#8220;Registrating Wildfly as service&#8230;&#8221;<br \/>\n# if should use systemd<br \/>\nif [ -x \/bin\/systemctl ]; then<br \/>\n    # Script from $WILDFLY_DIR\/docs\/contrib\/scripts\/systemd\/launch.sh didn&#8217;t work for me<br \/>\n    cat > $WILDFLY_DIR\/bin\/launch.sh << \"EOF\"\n#!\/bin\/sh\n\nif [ \"x$WILDFLY_HOME\" = \"x\" ]; then\n    WILDFLY_HOME=\"\/data\/app\/wildfly\"\nfi\n\nif [ \"x$1\" = \"xdomain\" ]; then\n    echo 'Starting Wildfly in domain mode.'\n    $WILDFLY_HOME\/bin\/domain.sh -c $2 -b $3\n    #>> \/var\/log\/$WILDFLY_SERVICE\/server-`date +%Y-%m-%d`.log<br \/>\nelse<br \/>\n    echo &#8216;Starting Wildfly in standalone mode.&#8217;<br \/>\n    $WILDFLY_HOME\/bin\/standalone.sh -c $2 -b $3<br \/>\n    #>> \/var\/log\/$WILDFLY_SERVICE\/server-`date +%Y-%m-%d`.log<br \/>\nfi<br \/>\nEOF<br \/>\n    # $WILDFLY_HOME is not visible here<br \/>\n    sed -i -e &#8216;s,WILDFLY_HOME=.*,WILDFLY_HOME=&#8217;$WILDFLY_DIR&#8217;,g&#8217; $WILDFLY_DIR\/bin\/launch.sh<br \/>\n    #sed -i -e &#8216;s,$WILDFLY_SERVICE,&#8217;$WILDFLY_SERVICE&#8217;,g&#8217; $WILDFLY_DIR\/bin\/launch.sh<br \/>\n    chmod +x $WILDFLY_DIR\/bin\/launch.sh<\/p>\n<p>    cp $WILDFLY_DIR\/docs\/contrib\/scripts\/systemd\/wildfly.service \/etc\/systemd\/system\/$WILDFLY_SERVICE.service<br \/>\n    WILDFLY_SERVICE_CONF=\/etc\/default\/$WILDFLY_SERVICE<br \/>\n    # To install multiple instances of Wildfly replace all hardcoding in systemd file<br \/>\n    sed -i -e &#8216;s,EnvironmentFile=.*,EnvironmentFile=&#8217;$WILDFLY_SERVICE_CONF&#8217;,g&#8217; \/etc\/systemd\/system\/$WILDFLY_SERVICE.service<br \/>\n    sed -i -e &#8216;s,User=.*,User=&#8217;$WILDFLY_USER&#8217;,g&#8217; \/etc\/systemd\/system\/$WILDFLY_SERVICE.service<br \/>\n    sed -i -e &#8216;s,PIDFile=.*,PIDFile=\/var\/run\/wildfly\/&#8217;$WILDFLY_SERVICE&#8217;.pid,g&#8217; \/etc\/systemd\/system\/$WILDFLY_SERVICE.service<br \/>\n    sed -i -e &#8216;s,ExecStart=.*,ExecStart=&#8217;$WILDFLY_DIR&#8217;\/bin\/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND,g&#8217; \/etc\/systemd\/system\/$WILDFLY_SERVICE.service<br \/>\n    systemctl daemon-reload<br \/>\n    #systemctl enable $WILDFLY_SERVICE.service<br \/>\nfi<\/p>\n<p># if non-systemd Debian-like distribution<br \/>\nif [ ! -x \/bin\/systemctl -a -r \/lib\/lsb\/init-functions ]; then<br \/>\n    cp $WILDFLY_DIR\/docs\/contrib\/scripts\/init.d\/wildfly-init-debian.sh \/etc\/init.d\/$WILDFLY_SERVICE<br \/>\n    sed -i -e &#8216;s,NAME=wildfly,NAME=&#8217;$WILDFLY_SERVICE&#8217;,g&#8217; \/etc\/init.d\/$WILDFLY_SERVICE<br \/>\n    WILDFLY_SERVICE_CONF=\/etc\/default\/$WILDFLY_SERVICE<br \/>\nfi<\/p>\n<p># if non-systemd RHEL-like distribution<br \/>\nif [ ! -x \/bin\/systemctl -a -r \/etc\/init.d\/functions ]; then<br \/>\n    cp $WILDFLY_DIR\/docs\/contrib\/scripts\/init.d\/wildfly-init-redhat.sh \/etc\/init.d\/$WILDFLY_SERVICE<br \/>\n    WILDFLY_SERVICE_CONF=\/etc\/default\/wildfly.conf<br \/>\n    chmod 755 \/etc\/init.d\/$WILDFLY_SERVICE<br \/>\nfi<\/p>\n<p># if neither Debian nor RHEL like distribution<br \/>\nif [ ! -x \/bin\/systemctl -a ! -r \/lib\/lsb\/init-functions -a ! -r \/etc\/init.d\/functions ]; then<br \/>\ncat > \/etc\/init.d\/$WILDFLY_SERVICE << \"EOF\"\n#!\/bin\/sh\n### BEGIN INIT INFO\n# Provides:          ${WILDFLY_SERVICE}\n# Required-Start:    $local_fs $remote_fs $network $syslog\n# Required-Stop:     $local_fs $remote_fs $network $syslog\n# Default-Start:     2 3 4 5\n# Default-Stop:      0 1 6\n# Short-Description: Start\/Stop ${WILDFLY_FILENAME}\n### END INIT INFO\n\nWILDFLY_USER=${WILDFLY_USER}\nWILDFLY_DIR=${WILDFLY_DIR}\n\ncase \"$1\" in\nstart)\necho \"Starting ${WILDFLY_FILENAME}...\"\nstart-stop-daemon --start --background --chuid $WILDFLY_USER --exec $WILDFLY_DIR\/bin\/standalone.sh\nexit $?\n;;\nstop)\necho \"Stopping ${WILDFLY_FILENAME}...\"\n\nstart-stop-daemon --start --quiet --background --chuid $WILDFLY_USER --exec $WILDFLY_DIR\/bin\/jboss-cli.sh -- --connect command=:shutdown\nexit $?\n;;\nlog)\necho \"Showing server.log...\"\ntail -500f $WILDFLY_DIR\/standalone\/log\/server.log\n;;\n*)\necho \"Usage: \/etc\/init.d\/wildfly {start|stop}\"\nexit 1\n;;\nesac\nexit 0\nEOF\nsed -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\nchmod 755 \/etc\/init.d\/$WILDFLY_SERVICE\nfi\n\nif [ ! -z \"$WILDFLY_SERVICE_CONF\" ]; then\n    echo \"Configuring service...\"\n    echo JBOSS_HOME=\\\"$WILDFLY_DIR\\\" > $WILDFLY_SERVICE_CONF<br \/>\n    echo JBOSS_USER=$WILDFLY_USER >> $WILDFLY_SERVICE_CONF<br \/>\n    echo WILDFLY_HOME=\\&#8221;$WILDFLY_DIR\\&#8221; > $WILDFLY_SERVICE_CONF<br \/>\n    echo WILDFLY_USER=\\&#8221;$WILDFLY_USER\\&#8221; > $WILDFLY_SERVICE_CONF<br \/>\n    echo STARTUP_WAIT=$WILDFLY_STARTUP_TIMEOUT >> $WILDFLY_SERVICE_CONF<br \/>\n    echo SHUTDOWN_WAIT=$WILDFLY_SHUTDOWN_TIMEOUT >> $WILDFLY_SERVICE_CONF<br \/>\n    echo WILDFLY_CONFIG=$WILDFLY_MODE.xml >> $WILDFLY_SERVICE_CONF<br \/>\n    echo WILDFLY_MODE=$WILDFLY_MODE >> $WILDFLY_SERVICE_CONF<br \/>\n    echo WILDFLY_BIND=0.0.0.0 >> $WILDFLY_SERVICE_CONF<br \/>\nfi<\/p>\n<p>echo &#8220;Configuring application server&#8230;&#8221;<br \/>\nsed -i -e &#8216;s,<deployment-scanner path=\"deployments\" relative-to=\"jboss.server.base.dir\" scan-interval=\"5000\",<deployment-scanner path=\"deployments\" relative-to=\"jboss.server.base.dir\" scan-interval=\"5000\" deployment-timeout=\"'$WILDFLY_STARTUP_TIMEOUT'\",g' $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml\nsed -i -e 's,<inet-address value=\"${jboss.bind.address:127.0.0.1}\"\/>,<any-address\/>,g&#8217; $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml<br \/>\nsed -i -e &#8216;s,<socket-binding name=\"ajp\" port=\"${jboss.ajp.port:8009}\"\/>,<socket-binding name=\"ajp\" port=\"${jboss.ajp.port:28009}\"\/>,g&#8217; $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml<br \/>\nsed -i -e &#8216;s,<socket-binding name=\"http\" port=\"${jboss.http.port:8080}\"\/>,<socket-binding name=\"http\" port=\"${jboss.http.port:28080}\"\/>,g&#8217; $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml<br \/>\nsed -i -e &#8216;s,<socket-binding name=\"https\" port=\"${jboss.https.port:8443}\"\/>,<socket-binding name=\"https\" port=\"${jboss.https.port:28443}\"\/>,g&#8217; $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml<br \/>\nsed -i -e &#8216;s,<socket-binding name=\"osgi-http\" interface=\"management\" port=\"8090\"\/>,<socket-binding name=\"osgi-http\" interface=\"management\" port=\"28090\"\/>,g&#8217; $WILDFLY_DIR\/$WILDFLY_MODE\/configuration\/$WILDFLY_MODE.xml<\/p>\n<p>[ -x \/bin\/systemctl ] &#038;&#038; systemctl start $WILDFLY_SERVICE || service $WILDFLY_SERVICE start<\/p>\n<p>echo &#8220;Done.&#8221;<\/p>\n<p>To start the wildfly instance, we need to run the script named \u2018standalone.sh\u2019 located in the \u2018bin\u2019 directory,<br \/>\n$ cd \/data\/wildfly\/bin<br \/>\n$ sh standalone.sh<br \/>\nThis will start the wildfly instance. To access the instance, open the web browser &#038; enter the following URL in the web browser<br \/>\nhttp:\/\/192.168.1.22:8080<br \/>\nThis will open default wildfly page on the browser.<\/p>\n<p>To access the management console, URL is<br \/>\nhttp:\/\/192.168.1.22:9990<br \/>\nBut we can\u2019t 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 \u2018ctrl + c\u2019 &#038; then in \u2018bin\u2019 directory itself, run script named \u2018add-user.sh\u2019 ,<br \/>\n$ cd \/data\/wildfly\/bin<br \/>\n$ sh add-user.sh<br \/>\nOnce 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.<br \/>\nThis 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction WildFly formerly known as JBoss web and application server is an open source high performance web application server written in Java.<\/p>\n<p>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&#8217;s [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7119"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7119"}],"version-history":[{"count":4,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7119\/revisions"}],"predecessor-version":[{"id":7123,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7119\/revisions\/7123"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}