Creating a Development Server using JBoss 7 AS on Centos 7

In some cases a system administrator needs to use old versions of certain software in order to get a development version. In this case we need to deploy a JBoss 7 AS inside a Centos 7.

Remember that JBoss 7 AS is unmaintaned and no loger supported. Try Wildfly for production

Second this is a manual to configure a Development Server not suitable for production use.

We start this configuration from a Centos 7 minimal

1  Update system

simply execute

yum install epel-release
yum install htop vim wget
yum -y update

2 Download JBoss Server

we need to download JBoss Server from

cd /opt

3  Uncompress jboss

tar xzvf jboss-as-7.1.1.Final.tar.gz
mv jboss-as-7.1.1.Final jboss

4  create jboss user in system

adduser jboss

5 Change jboss ownership

chown -R jboss:jboss jboss

6 Install Java

in this case we will need java 1.7 you can use 1.6, 1.7 or 1.8

yum install java-1.7.0-openjdk

7 open ports

port 8080 must be opened

firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload

8 launch jboss to test

su jboss
cd /opt/jboss/bin
./ -b

from your favorite browse writing http://your_server_ip_goes_here:8080 you should view this screen

you can stop jboss pressing Ctrl+c in your keyboad

9  configure jboss binding IP

I don’t want pass parameters when starting jboss, in this case we need to configure binding address

vim /opt/jboss/standalone/configuration/standalone.xml

at line 280 we need to change our xml to look like this

 <interface name="public">
 <inet-address value="${jboss.bind.address:}"/>

to this

 <interface name="public">
 <inet-address value="${jboss.bind.address:}"/>

now executing


you should view your jboss screen

10 step configure jboss as a systemd service

at this point we can start our service manually, adding some automation is necessary to avoid midnight phone calls
we need to define a unit for jboss


vim /usr/lib/systemd/system/jboss.service

Add this content to unit file

description=JBoss 7 AS Application server



now you can enable your jboss service

systemctl start jboss

open your browser and check if you can see the magical screen

After this we need to enable the service

systemctl enable jboss

11 Enable access to Jboss admin console Optional

When we need to manage our jboss in this case we will need to execute these commands

systemctl stop jboss
cd /opt/jboss/bin/

follow screen instructions to add your desired admin user

[root@mymachine bin]# ./
What type of user do you wish to add?
a) Management User (
b) Application User (
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : desiredusername
Password :
Re-enter Password :
About to add user 'desiredusername' for realm 'ManagementRealm'
Is this correct yes/no? yes

Added user 'desiredusername' to file '/opt/jboss/standalone/configuration/'
Added user 'desiredusername' to file '/opt/jboss/domain/configuration/'

Getting access to management console requires open 9990 port

firewall-cmd --add-port=9990/tcp
cd /opt/jboss/bin/
./ -b -bmanagement

Now we can access to our management console using  the added username and  password.

When we have done our configurations we can stop our server pressing Ctrl+c

and closing ports running

firewall-cmd --reload
systemctl start jboss

12 Configurin MariaDB server

Our developer needs a MariaDB, Mysql Database in this server

yum install mariadb-server
systemctl start mariadb
systemctl enable mariadb
#follow instructions
mysql -uroot -p

create a database an user and grant priviledges

CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'new_password';
GRANT ALL ON my_db.* TO 'new_user'@'localhost';

13 Adding mysql driver

At this point Jboss needs talk to mysql/mariadb database, in this case we will download mysql driver

cd /opt


tar xzvf mysql-connector-java-5.1.43.tar.gz

mkdir -p /opt/jboss/modules/com/mysql/main

cp mysql*/mysql-*.jar /opt/jboss/modules/com/mysql/main

we need to define the module to deploy “describe” Mysql Driver

vim  /opt/jboss/modules/com/mysql/main/module.xml

fill with this content

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resource-root path="mysql-connector-java-5.1.43-bin.jar"/>
<module name="javax.api"/>

We configure JBoss to load Mysql jdbc driver

vim /opt/jboss/standalone/configuration/standalone.xml

driver section should look like these arround line 101

   <driver name="mysql" module="com.mysql">
 <driver name="h2" module="com.h2database.h2">

At this point our server is funcional, putting a war file at /opt/jboss/standalone/deployments should be enough to run a java program.

13 Compiling in our development machine.

In medium size projects some members does not have technical profiles, translators, designers …

Putting these profiles in front a Java development environment gives a sensation of they are controlling a space shuttle launch, compiler messages scrolling at high speeds running strange programs in their computer etc.

For minimize this sensation we will make that our development machine compile java sources and run user modifications.

Our project uses Maven for dependency resolution first of all we need to install maven in our development machine

yum install maven

14 Using git for deploy

We will use compile our sources and git for manage sourcecode changues

yum install git

We will use jboss user to deploy our sourcecode

as jboss user we will create an empty repository

su jboss
mkdir /home/jboss/my_project_repo
cd /home/jboss/my_project_repo
git init --bare

At this point we have a empty repository but we need to add our ssh key

mkdir -p /home/jboss/.ssh/

vim /home/jboss/.ssh/authorized_keys

paste your public key

now from our workstation we can add our deploy repo like this

git remote add dev_server ssh://jboss@<dev_server_ip>/home/jboss/my_project_repo

git push dev_server master

now we can send our source code modifications but we adapt our app configuration.

in this case in our source code we have a file called with configuration data we will personalize our config here a example

## set these properties to fit with your local JBoss installation


## context path

## wicket configuration - development or deployment

## persistence.xml settings
# relative to ${user.home}

## Business case data to be used

we will put this file in /home/jboss/ but we need to automatize our deploy

in our development server as jboos user

mkdir -p /home/jboss/my_project_compile

vim /home/jboss/my_project_repo/hooks/post-receive

a small example  script should look like this

git --work-tree=/home/jboss/my_project_compile --git-dir=/home/jboss/my_project_repo checkout -f
cd /home/jboss/my_project_compile
cp /home/jboss/ /home/jboss/my_project_compile/
mvn package
rm -f /opt/jboss/standalone/deployments/*
cp /home/jboss/ /home/jboss/my_project_compile/target/*.war /opt/jboss/standalone/deployments/

now with a git push we can view our changes


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.