Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active September 28, 2022 19:31
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jniltinho/84042bd70a7415e3a7df8ab27b0c1761 to your computer and use it in GitHub Desktop.
Save jniltinho/84042bd70a7415e3a7df8ab27b0c1761 to your computer and use it in GitHub Desktop.
Install Jboss 7 + JRE 8 on Debian
#!/bin/bash
### Install Jboss 7 + JRE8 on Debian 64Bits
### Link: http://alexander.holbreich.org/jboss-7-setup-linux/
## First install wget
## Primeiro instale o wget
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "You must run the script as root or using sudo"
exit 1
fi
cd /usr/local/
wget --header 'Cookie: oraclelicense=a' http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jre-8u131-linux-x64.tar.gz
tar -xf jre-8u131-linux-x64.tar.gz && rm -f jre-8u131-linux-x64.tar.gz
mv jre1.8.0_131 java
echo 'JAVA_HOME=/usr/local/java
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH' >> /etc/profile
source /etc/profile
cd /usr/local/
wget http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz
tar -xvf jboss-as-web-7.0.2.Final.tar.gz
mv jboss-as-web-7.0.2.Final jboss && rm -f jboss-as-web-7.0.2.Final.tar.gz
groupadd jboss && useradd -M -s /bin/nologin -g jboss -d /usr/local/jboss jboss
chown -R jboss:jboss /usr/local/jboss
sed -i 's|<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>|<any-address/>|' /usr/local/jboss/standalone/configuration/standalone.xml
sed -i 's|<inet-address value="${jboss.bind.address:127.0.0.1}"/>|<any-address/>|' /usr/local/jboss/standalone/configuration/standalone.xml
echo '# Systemd unit file for jboss
[Unit]
Description=Jboss Web Application Server
After=syslog.target network.target
[Service]
Type=forking
RemainAfterExit=yes
Environment=JAVA_HOME=/usr/local/java
Environment="JBOSS_HOME=/usr/local/jboss"
#Environment="JBOSS_USER=eap"
#Environment="JBOSS_MODE=domain"
#PIDFile=/var/run/jboss.pid
ExecStart=/usr/local/jboss/bin/standalone.sh &
#ExecStop=/bin/kill -15 $MAINPID
ExecStop=/usr/local/jboss/bin/jboss-admin.sh --connect command=:shutdown
User=jboss
Group=jboss
[Install]
WantedBy=multi-user.target' > /etc/systemd/system/jboss.service
systemctl daemon-reload
systemctl start jboss
systemctl enable jboss
## Open in web browser:
## http://server_IP_address:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment