sudo apt update
sudo apt install openjdk-11-jdk
java -version
- get latest tar.gz from tomcat
wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.28/bin/apache-tomcat-10.1.28.tar.gz
sudo mkdir -p /opt/tomcat
sudo tar xzvf apache-tomcat-*tar.gz -C /opt/tomcat --strip-components=1
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
sudo chown -R tomcat: /opt/tomcat
sudo sh -c 'chmod +x /opt/tomcat/bin/*.sh'
sudo update-alternatives --config java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java*
sudo nano /etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat Web Servlet Container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
# Restart settings
RestartSec=10
Restart=always
# Environment variables
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
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"
# Use catalina.sh for starting and stopping Tomcat
ExecStart=/opt/tomcat/bin/catalina.sh start
ExecStop=/opt/tomcat/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl enable tomcat
sudo systemctl status tomcat
sudo nano /opt/tomcat/conf/tomcat-users.xml
<role rolename="admin-gui,manager-gui,manager-script,manager-jmx,manager-status,admin-gui"/>
<user username="admin" password="admin" roles="admin-gui,manager-gui,manager-script"/>
- Deployment error so we have to commit these two lines
sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
- Comment this line
sudo systemctl restart tomcat
sudo su
cd /opt/tomcat/conf
sudo nano server.xml
- Java install
sudo apt update
sudo apt install openjdk-17-jre (For Jenkins)
java -version
- Jenkins install
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update
sudo apt-get install jenkins -y
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
- Firewall Enable
firewall-cmd —zone=public --permanent —add-port=8080/tcp firewall-cmd --reload
Skip this step
sudo nano /etc/sysconfig/jenkins
look for port 8080 and change to 8081
cat /etc/sysconfig/jenkins |grep JENKINS_PO
systemctl restart jenkins
systemctl start jenkins
systemctl status jenkins
Cat /var/lib/jenkins/secrets/initialAdminPassword
copy the password in this admin and create account
sudo apt install maven
mvn --version
- JDK| JDK-18= /usr/lib/jvm/java-11-openjdk-amd64
- GIT| /bin/git (which git)
- MVN| 3.9.4
Source code management
- GIT| Address for the repo ( from Git)
- Credential ( your git hub credentials)
- Branch| */master
Invoke Top-level Maven Targets Maven Version | mvm-394 Goal | Clean install
- WAR/EAR file | **/*.war
- Context path | /
- Container | Tomcat 9.x Remote
- Credentials | deployer | deployer
- Tomcat URL | URL IP with Port 8080
-----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn NhAAAAAwEAAQAAAYEA3Q2jkuptdIJ/U2ch+u5IF4M501Azr36yavmXia3mLyGjgmyJ3v3H uPXFCqe/sQKXCz/314HVR6z2G0re6iYnMV/UEfxI9YmunQJ3mQ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