Configuring Tomcat

You can configure the Tomcat server in two ways—either using the Terminal or from the IDE. To set up the server, you have to download the Tomcat server's content from https://tomcat.apache.org/download-90.cgi

Configuring Tomcat by these following steps:

  1. Download a binary distribution of the core module from the link.
  2. Extract the file. This creates a folder named apache-tomcat-9.0.11 (version number can be changed).

 

  1. To access it with ease, rename the folder Tomcat and move it to /usr/local (for Linux) or /Library (for macOS):

Project files
  • For Linux, use these steps:
// If you have an older version of Tomcat, then remove it before using the newer one
sudo rm -rf /usr/local/Tomcat // To remove exist TomCat

sudo mv ~/Download/Tomcat /usr/local // To move TomCat from the download directory to your desire direction
  • For macOS, use these steps:
// If you have an older version of Tomcat, then remove it before using the newer one
sudo rm -rf /Library/Tomcat // To remove exist TomCat

sudo mv Downloads/Tomcat /Library/ // To move TomCat from the download directory to your desire direction

To check the current directory, type the following:

  • For Linux: cd /usr/local/Tomcat/
  • For macOS: cd /Library/Tomcat/
  1. Type ls to see a list of this directory:

check tomcat files in terminal
  1. Change the ownership of the /usr/local/Tomcat or /Library/Tomcat folder hierarchy:
  • For Linux: sudo chown -R <your_username> /usr/local/Tomcat/
  • For macOS: sudo chown -R <your_username> /Library/Tomcat/
  1. Make all scripts executable:
  • For Linux: sudo chmod +x /usr/local/Tomcat/bin/*.sh
  • For macOS: sudo chmod +x /Library/Tomcat/bin/*.sh
  1. To check the contents of Tomcat, use the following command:
  • For Linux: ls -al /usr/local/Tomcat/bin/*.sh
  • For macOS: ls -al /Library/Tomcat/bin/*.sh
  1. You can see that every file is listed with -rwxr-xr-x@, where -x means executable. Executable demonstrates to us the authorization status to get to the files:

Check the tomcat executable files in terminal
  1. To start and stop, type the following:
  • For macOS:
/Library/Tomcat/bin/startup.sh
/Library/Tomcat/bin/shutdown.sh
  • For Linux:
/usr/local/Tomcat/bin/startup.sh
/usr/local/Tomcat/bin/shutdown.sh
  1. To turn on and off the Tomcat server, use this command:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.158.165