Setup TomCat on centOS7 with the none-admin account

 The TomCat is very easy to deploy on the cent OS, as you just need to extract it to the folder, and set the the folder path as the environment variable.

How to configure the system environment variable?

1. only for the current shell: input the command as below:

"export CATALINA_HOME="/opt/tomcat ......""

(you need to input the path where tomcat located on your computer.)

2. only effective for one user

switch to the file of  home/.bashrc, open it with gEditor or VIM, to add the command above into the file, save and exit.

3. effective for all users

find the file of /etc/profile, open it with GEditor or VIM, to add the command above into the file, save and exit.

you need also to setup the system environment variable for  CATALINA_BASE if you want to run several instance of TomCat on your linux. If you don't need it, the tomcat will config the CATALINA_BASE default same with CATALINA_HOME.

How to start/shutdown the TomCat with none-root user account?

execute the command of

"sh $CATALINA_HOME/bin/startup.sh"     or

"sh $CATALINA_HOME/bin/catalina.sh start"

Then you will see the "TomCat started." at the end of the executing result.



if you meet problem when you execute the either of above commands,  got the error of "touch: cannot touch ‘/opt/apache-tomcat-7.0.81/logs/catalina.out’: Permission denied" similarly, that is because your current account has no permission to access the logs directory under the tomcat path.

Here you need to execute the command of

chmod a+rwx -R $CATALINA_HOME/logs

to get the permission to read/write/execute(+rwx)the all directory(-R); but often you cannot execute this command, because this command need the root access.

Here you can log in root or just use the sudo to execute the command with 5 minutes' root access.

You need to use the VIM to edit the sodo configuration with command below:

visudo

add "username ALL=(ALL)    ALL "to allow the user to use sudo command.

Then you can execute the chmod command and get the all read/write/execute permission for the /logs directory.

And of course then you can execute the start command .

Thank you. contact me with email [email protected]



猜你喜欢

转载自blog.csdn.net/zw3413/article/details/78138164
今日推荐