Activity 4: Installing tomcat on ubuntu
- Refer Here for manual steps
sudo apt update
sudo apt install openjdk-11-jdk -y
sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcat
cd /tmp/
wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.10/bin/apache-tomcat-10.0.10.tar.gz
- The command
sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcatmeans create a user tomcat with- home directory in /opt/tomcat
- tomcat as a system user
- ensure there is group called as tomcat
- shell is /bin/false
-
Refer Here for the playbook to automate the above steps and execute the playbook
-
Refer Here for debug messages added.
- Next set of steps
sudo tar xzf apache-tomcat-*.tar.gz -C /opt/tomcat
- Refer Here for the changes done to extract tomcat and Refer Here for the remote src to yes for downloading from external sources
Exercise:
- Make changes in the above playbook to work on centos 8
- Ensure /opt/tomcat/apache-tomcat-10.0.10 has tomcat user and tomcat group as owner.
References
- Understanding previlege escalation i.e. using become Refer Here
- printing messages during execution of playbook is considered to be a good ractice. we can use debug module Refer Here
