Staging installation for 3kosh

Installation of application stack on a single node Ubuntu server

Required system configuration

Component Version/Specification
Operating system ubuntu 22.04
Architecture x86_64(amd64)
Disk >64GB

Installation Procedure

Application Stack versions

Application Version
Open-JDK 11.0.20
Apache maven latest LTS
Tomcat 9.0.80
MySQL 8.0.34
ScyllaDB 5.0.13
Redpanda 23.1.12
Git Latest
HAproxy 2.4.22

Open-JDK-11

Download the archived binary using wget

sudo wget https://builds.openlogic.com/downloadJDK/openlogic-openjdk/11.0.20+8/openlogic-openjdk-11.0.20+8-linux-x64.tar.gz -O /tmp/jdk-11.0.20.tar.gz

Verify the download by listing all files in the /tmp folder

sudo ls /tmp

Create a directory /usr/java

sudo mkdir /usr/java

Extract the open-jdk binary to this now created folder as:

sudo tar -xzvf /tmp/jdk-11.0.20.tar.gz -C /usr/java

Rename the extracted folder to jdk-11.0.20

sudo mv /usr/java/openlogic-openjdk-11.0.20+8-linux-x64 /usr/java/jdk-11.0.20

Now, we need to create environement variable for JAVA_HOME and add java’s bin directory to PATH environment variable. To do so, we can modify the .bashrc file to export these variables whenever a new shell is created

sudo echo -e "export JAVA_HOME=/usr/java/jdk-11.0.20\nexport PATH=$PATH:/usr/java/jdk-11.0.20/bin" >> ~/.bashrc

To make the changes effective in the current session:

source ~/.bashrc

Now check the installation using:

java --version

Apache maven

Download the archived binary using:

Please make sure of the JAVA_HOME path as maven uses jdk to build artifacts

sudo wget https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz -O /tmp/apache-maven-3.9.5.tar.gz

Now extract the downloaded binary file to /opt directory

sudo tar -xzvf /tmp/apache-maven-3.9.5.tar.gz -C /opt

Now, set the M2_HOME and M2 environments variables and update the PATH environment variable as given:

sudo echo -e "export M2_HOME=/opt/apache-maven-3.9.5\nexport M2=/opt/apache-maven-3.9.5/bin\nPATH=$PATH:/opt/apache-maven-3.9.5/bin" >> ~/.bashrc

To make the changes effective:

source ~/.bashrc

To verify the installation:

mvn --version

Tomcat

Create a user called tomcat with primary group name same as user name:

sudo useradd -m -d /opt/tomcat -s /bin/false -U tomcat

Verify user creation using:

sudo cat /etc/passwd | grep tomcat

Download the binary using:

sudo wget -P /tmp https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.80/bin/apache-tomcat-9.0.80.tar.gz

Now, extract the downloaded binary to tomcat user’s home directory:

sudo tar -xvzf /tmp/apache-tomcat-9.0.80.tar.gz -C /opt/tomcat/ --strip-components=1

Check the extraction status:

sudo ls /opt/tomcat/

Now, modify the tomcat directories as below:

Permissions need to be changes for directories such as conf to be owned by root, to prevent deploying applications by any intruders if tomcat user got compromised

sudo chown -R tomcat:tomcat /opt/tomcat
sudo chown -R root /opt/tomcat/conf
sudo chmod 750 /opt/tomcat/conf
sudo find /opt/tomcat/conf -type d -print -exec chmod 750 {} \;
sudo find /opt/tomcat/conf -type f -print -exec chmod 440 {} \;
sudo chown -R root:tomcat /opt/tomcat/lib /opt/tomcat/bin

Please modify the /opt/tomcat/bin/catalina.sh by Replace following line by using vi editor

To open:

sudo vi /opt/tomcat/bin/catalina.sh

On line 226:

CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar:

With:

CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar:$CATALINA_HOME/log4j2/lib/*:$CATALINA_HOME/log4j2/conf

To run tomcat as a system service, create a system unit file and append the following content:

sudo vi /etc/systemd/system/tomcat.service

Content to be added:

[Unit]
Description=Apache Tomcat Web Application Container 
After=syslog.target network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment=JAVA_HOME=/usr/java/jdk-11.0.20
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:////dev/urandom'

Environment=CATALINA_BASE=/opt/tomcat 
Environment=CATALINA_HOME=/opt/tomcat 
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid 
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/bin/kill -15 $MAINPID
ExecStop=/opt/tomcat/bin/shutdown.sh

UMask=0007
RestartSec=10
Restart=always

[Install] 
WantedBy=multi-user.target

To introduce the system with newly added service:

sudo systemctl daemon-reload

To enable the tomcat service to be started automatically when the system boots:

sudo systemctl enable tomcat

Start the tomcat server by running:

sudo systemctl start tomcat

Check if tomcat is running:

sudo systemctl status tomcat

MySQL

Download the MySQL setup repository package:

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.26-1_all.deb

Run the downloaded deb file to install mysql-server

sudo apt install ./mysql-apt-config_0.8.26-1_all.deb

Follow the screenshots:

select MySQL Server & Cluster from the options given and select ok

select ok on the window appearing

Select the server version mysql-8.0 from the optiond given and select

select ok on the window appearing

Now, we have configured the repository to be installed, install the mysql server using:

sudo apt install mysql-server -y

Now, setup the mysql server to run right when the system boots up

sudo systemctl enable mysql

Check if mysql server is running

systemctl status mysql

if mysql isn’t running:

sudo systemctl start mysql

ScyllaDB

Install a repo file and add the ScyllaDB APT repository to your system.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys d0a112e067426ab2

Download the available package list

sudo wget -O /etc/apt/sources.list.d/scylla.list http://downloads.scylladb.com/deb/debian/scylla-5.0.list

Install packages(apt-get update can be skipped if you have updated the repo recently)

sudo apt-get update
sudo apt-get install -y scylla 

To list available releases

sudo apt-cache madison scylla

Similar output can be seen

You’ll see a list of available version

From the list install scylla 5.0.13 using:

sudo apt install scylla{,-server,-jmx,-tools,-tools-core,-kernel-conf,-node-exporter,-conf,-python3}=5.0.13-0.20230423.a0ca8abe4-1 -y

Now run the scylla_setup with following options to complete the setup:

sudo scylla_setup --no-raid-setup --online-discard 1 --nic ens4 --io-setup 1 --no-version-check

Start the scylla-server

sudo systemctl start scylla-server

RedPanda

Download redpanda setup using shell script by redpanda which compiles for given OS

curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | \
sudo -E bash && sudo apt install redpanda -y

Install redpanda console

curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | \
sudo -E bash && sudo apt-get install redpanda-console -y

Change the mode of redpanda installed from development to production

sudo rpk redpanda mode production

we need to benchmark the ssd we are using so, redpanda knows about the performance of the hardware

sudo rpk redpanda tune all

Start redpanda-console(optional)

sudo systemctl start redpanda-console

Start redpanda server

sudo systemctl start redpanda

Confirm the status of redpanda by running:

sudo systemctl start redpanda

Git

Update apt package repository

sudo apt update

Install using apt

sudo apt-get install git

HAproxy

Install from PPA

sudo apt-get install --no-install-recommends software-properties-common

Add HAproxy’s repository to apt

sudo add-apt-repository ppa:vbernat/haproxy-2.8

Now, install the added repository

sudo apt-get install haproxy=2.8.\*