1. Installing the Java Environment
Apt-get Update
Apt-get Install OPENJDK-7-JDK
2. Configure the Java environment variables:
Vim/etc/environment
JAVA_HOME=JDK directory (generally in =/usr/lib/jvm/jdk1.7.0_04/)
classpath=.:/ Usr/lib/jvm/jdk1.7.0_04/lib
3. Get the Tomcat installation package
Official download a decompression can,: http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.67/bin/apache-tomcat-7.0.67.tar.gz
Extract to/usr/local directory, rename apache-tomcat-7.0.67 to Tomcat (sudo mv apache-tomcat-7.0.67 Tomcat)
#打开终端, enter the following command to add a system user tomcat and set it to a non-logon system.
useradd-d/usr/local/tomcat-s/usr/sbin/nologin Tomcat
4. Set user tomcat access to the Tomcat directory
Chown-r tomcat.tomcat/usr/local/tomcat/
5. Configuring the Tomcat environment variable
sudo vim/etc/environment, and finally add two lines to the following:
Catalina_base=/usr/local/tomcat
Catalina_home=/usr/local/tomcat
Tomcat_user=tomcat
Use the following command to make the configuration effective at the current terminal
Source/etc/environment
6. Start Tomcat
sudo sh/usr/local/tomcat/bin/startup.sh appears as follows to indicate a successful start:
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/lib/jvm/jdk1.8.0_65
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
7. Testing
Access to http://localhost:8080/, if you see the provincial boundaries face of Tomcat, indicates success.
8. Set up Tomcat Administrator account
Vim/usr/local/webserver/tomcat/conf/tomcat-users.xml
Added under the <tomcat-users> tab
<role rolename= "Admin-gui"/>
<role rolename= "Admin-script"/>
<role rolename= "Manager-gui"/>
<role rolename= "Manager-script"/>
<role rolename= "Manager-jmx"/>
<role rolename= "Manager-status"/>
<user username= "admin" password= "123456" roles= "Manager-gui,manager-script,manager-jmx,manager-status, Admin-script,admin-gui "/>
Where admin is the user name, 123456 is the password, it is recommended to change their usual security user name and password
After saving is turned off, rerun Tomcat, open the browser input localhost:8080 to open the Tomcat Welcome page, click the Server Status button to enter the user name and Password dialog box, enter the user name and password to access the Administration page
9. Stop the Tomcat server
sudo sh/usr/local/tomcat/bin/shutdown.sh
10. Managing the Tomcat server with service commands
sudo cp/usr/local/tomcat/bin/catalina.sh/etc/init.d/tomcat
You can then manage the start and stop of the Tomcat service in the form of a common service tomcat Start|stop|status
11. Set up tomcat boot from boot
sudo update-rc.d–f tomcat defaults
Reference:
- Tomcat installation configuration: Ubuntu12.04 installation configuration Tomcat7.0 server: http://www.33lc.com/article/7459.html
- Build Tomcat7.0 server under Ubuntu12.04: http://www.linuxidc.com/Linux/2012-07/66722.htm
- Ubuntu12.04 installation tomcat7.0:http://mikey1101.iteye.com/blog/1704250
Ubuntu12.04 Build Tomcat7.0