Apache Linux Installation Steps
Add User and Group
$ groupadd tomcat
$ useradd -s /sbin/nologin -g tomcat -d /path/to/tomcat tomcat
$ passwd tomcat
Extract the package
tar xvzf apache-tomcat-[#].tar.gz
mv apache-tomcat-[#] /desiredpath/tomcat
# chown -R tomcat:tomcat /desiredpath/tomcat
# ls -l /desiredpath/tomcat
create a tomcat.service
Copy and paste the following configuration in the tomcat.service file.
Setup JAVA_HOME if required. Most like the path will be /etc/alternatives/java
If fails verify the tomcat.service file throughly
Enable Remote Access to Tomcat Manager and Host Manager
To enable remote access to the Manager app, open and edit the configuration file /opt/apache-tomcat-9.0.24/webapps/host-manager/META-INF/context.xml.
Then look for the following line.
change it to this to allow tomcat access from IP address * from any host or network.
Similarly, enable remote access to the Host Manager app in the file /usr/local/tomcat9/webapps/host-manager/META-INF/context.xml as shown above.
Relay Traffic For Non-Root Tomcat User
When running Tomcat as a user other than the root user, you will not be able to bind to port 80, which is where Tomcat listens for HTTP requests. To get around this, you can use Netfilter, which is packaged with all major Linux distributions:
# iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
# iptables -t nat -I OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables-save
Sometimes, the service may not start because of the permissions on /desirectpath/tomcat/bin directory files
Switch to root user and give 777 on all the files in bin directory
Reboot the server. It should automatically bring up the tomcat web server.If not, run systemctl start tomcat.service
Apache Linux Basic Configuration Steps
Edit the /conf/tomcat-users.xml file carefully.Uncomment the users section and add the roles.
Example:<role rolename="admin"/><role rolename="manager-status"/><role rolename="manager-gui"/> <user username="admin" password="Winter123" roles="manager-gui"/> <user username="manager" password="Winter123" roles="manager-status,admin-gui"/> <user username="robot" password="Winter123" roles="manager-script"/>
<role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="Winter123" roles="tomcat,manager-gui,admin-gui"/> <user username="both" password="Winter123" roles="tomcat,role1"/> <user username="role1" password="Winter123" roles="role1"/>
That is it I know.
Comments
Post a Comment