Tomcat is installed on Mac Platform

Source: Internet
Author: User
Security Department Hudson
    1. To the http://tomcat.apache.org under Tomcat 6.x, such as apache-atat-6.0.24.zip
    2. Unzip apache-tomcat-6.0.24.zip to resolve the issue to $ your_profile $/library, $ your_profile $ for your users in Mac OS X, such as/users/admin
    3. Chmod A + x $ your_profile $/library/Apache-Tomcat-6.0.24/bin/*. Sh
    4. Set the Administrator's role and password:
      $ Your_profile $/library/Apache-Tomcat-6.0.24/CONF/tomcat-users.xml, add
    
<RoleRolename= "Manager"/>

<UserUsername= "Tomcat"Password= "XXXX"Roles= "Manager"/>

Set the setting to $ your_profile $/library/Apache-Tomcat-6.0.24/bin/startup. sh, and then use browser hosts to http: // localhost: 8080. If you can see the following hosts, the Tomcat server security is initially complete.

Use launchd to activate Tomcat server

When launchd is set to be active on Mac OS X Server, Tomcat server is also triggered, which is similar to Windows NT Service.

1. to $ your_profile $/library/Apache-Tomcat-6.0.24/bin/directory, add a launch case launchd_wrapper.sh. The content is as follows:

 1     #  ! /Bin/bash  
2
3 Function Shutdown ()
4
5 {
6
7 Date
8
9 Echo " Shutting down Tomcat "
10
11 $ Catalina_home / Bin / Catalina . Sh stop
12
13 }
14
15 Date
16
17 Echo " Starting Tomcat server "
18
19 Export catalina_pid =/ TMP / $
20
21 # Uncomment to increase Tomcat's maximum heap allocation
22
23 # Export java_opts =-xmx512m $ java_opts
24
25 Export java_opts = " -Xms256m-xmx512m-XX: maxpermsize = 256 m "
26
27 Export catalina_opts = " -Dhudson_home =/users/admin/Hudson "
28
29 . $ Catalina_home / Bin / Catalina . Sh start
30
31 # Allow any signal which wowould kill a process to stop Tomcat
32
33 Trap Shutdown Hup Int Quit abrt Kill Alrm term tstp

Please note that, for/users/admin, change it to your $ your_profile $ location. For launchd_wrapper.sh, use chmod A + x launchd_wrapper.sh to make it have limit on Row permissions.

2. join the Tomcat for launchd attack case and use sudo touch tomcat in the/library/launchdaemons directory. plist adds tomcat. plist, this command will require login into the Manager password

3. use sudo VI tomcat. plist, Zookeeper tomcat. plist: the content of the hosts file is as follows. Note that/users/admin is the administrator's security category. Please change it to your $ your_profile $ contents.

    <?  XML version = "1.0" encoding = "UTF-8"  ?>  

<! Doctype plist public "-// Apple Computer // DTD plist 1.0 // en" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" >

< Plist Version = "1.0" >

< Dict >

< Key > Disabled </ Key >

< False />

< Key > Environmentvariables </ Key >

< Dict >

< Key > Catalina_home </ Key >

< String > /Users/admin/library/Apache-Tomcat-6.0.24 </ String >

< Key > Java_home </ Key >

< String > /Library/Java/home </ String >

</ Dict >

< Key > Label </ Key >

< String > Com. Apache. Tomcat </ String >

< Key > OnDemand </ Key >

< False />

< Key > Programarguments </ Key >

< Array >

< String > /Users/admin/library/Apache-Tomcat-6.0.24/bin/launchd_wrapper.sh </ String >

</ Array >

< Key > Runatload </ Key >

< True />

< Key > Servicedescription </ Key >

< String > Tomcat </ String >

< Key > Standarderrorpath </ Key >

< String > /Users/admin/Apache-Tomcat-6.0.24/logs/launchd. stderr </ String >

< Key > Standardoutpath </ Key >

< String > /Users/admin/Apache-Tomcat-6.0.24/logs/launchd. stdout </ String >

< Key > Username </ Key >

< String > Root </ String >

</ Dict >

</ Plist >

4. Manual manual launch and launch commands

 
Sudo launchctl Load-W/Library/Lauhchdaemons/Tomcat.Plist

Stop command

Sudo launchctl unload-W/Library/Launchdaemons/Tomcat.Plist
 

After the restart operation is OK, the next time you restart the Tomcat server, you will be logged on.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.