Sunday, March 25, 2018

Installing Docker Java and Wildfly on DigitalOcean Centos7 droplet


https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7

https://devops.profitbricks.com/tutorials/how-to-install-and-configure-wildfly-application-server-on-centos-7/


Login as root

yum check-update
curl -fsSL https://get.docker.com/ | sh
sudo usermod -aG docker centos
sudo systemctl start docker
sudo systemctl status docker
sudo systemctl enable docker
#make sure that user centos exists
sudo su - centos // then exit
#download and copy here the jdk
tar -xzvf jdk-8u161-linux-x64.tar.gz -C /opt/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_161/bin/java 2
alternatives --config java
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_161/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_161/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_161/bin/jar
alternatives --set javac /opt/jdk1.8.0_161/bin/javac
java -version

vi /etc/profile.d/java.sh

if ! echo ${PATH} | grep -q /opt/jdk1.8.0_161/bin ; then
   export PATH=/opt/jdk1.8.0_161/bin:${PATH}
fi
if ! echo ${PATH} | grep -q /opt/jdk1.8.0_161/jre/bin ; then
   export PATH=/opt/jdk1.8.0_161/jre/bin:${PATH}
fi
export JAVA_HOME=/opt/jdk1.8.0_161
export JRE_HOME=/opt/jdk1.8.0_161/jre
export CLASSPATH=.:/opt/jdk1.8.0_161/lib/tools.jar:/opt/jdk1.8.0_161/jre/lib/rt.jar

vi /etc/profile.d/java.csh

if ( "${path}" !~ */opt/jdk1.8.0_161/bin* ) then
   set path = ( /opt/jdk1.8.0_161/bin $path )
endif
if ( "${path}" !~ */opt/jdk1.8.0_161/jre/bin* ) then
    set path = ( /opt/jdk1.8.0_161/jre/bin $path )
endif
setenv JAVA_HOME /opt/jdk1.8.0_161
setenv JRE_HOME /opt/jdk1.8.0_161/jre
setenv CLASSPATH .:/opt/jdk1.8.0_161/lib/tools.jar:/opt/jdk1.8.0_161/jre/lib/rt.jar



chmod 755 /etc/profile.d/java.sh
chmod 755 /etc/profile.d/java.csh
curl -O http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip
yum install unzip
unzip wildfly-10.1.0.Final.zip -d /opt/
#set JBOSS_HOME and JAVA_HOME
vi /opt/wildfly-10.1.0.Final/bin/standalone.conf
#set JBOSS_HOME and JAVA_HOME
vi /etc/profile
#set the right IP address
vi /opt/wildfly-10.1.0.Final/standalone/configuration/standalone.xml
cd /opt/wildfly-10.1.0.Final/bin/
./add-user.sh

chown -R centos:centos /opt/wildfly-10.1.0.Final/

su - centos
#start wildfly
cd /opt/wildfly-10.1.0.Final/bin
./standalone.sh



Create these entries in your /home/centos/.bash_profile

export WF_BIN=/opt/wildfly-10.1.0.Final/bin/
export WF_DEP=/opt/wildfly-10.1.0.Final/standalone/deployments/
export WF_TMP=/opt/wildfly-10.1.0.Final/standalone/tmp/
export WF_LOG=/opt/wildfly-10.1.0.Final/standalone/log/
alias STARTWF="cd $WF_BIN; nohup ./standalone.sh 2>&1 > standalone.log &"








No comments: