Construction of JDK+TOMCAT+MYSQL Environment under Ubuntu

Source: Internet
Author: User

3. Installing MySql3.1 Installation

Installation using Apt-get install, terminal input:
sudo apt-get install mysql-server-5.1

Tips:
Search Software: Apt-cache search software name keyword, support fuzzy query,
For example: Apt-cache search MySQL

During the installation, two prompts to enter the password for the root account of MySQL, enter root, OK, until the installation is complete.

3.2 Creating a user

After Mysql has been installed, it is automatically started and is powered on from boot by default.
Terminal input:
Mysql–uroot–proot
Go to MySQL console. Create a User (username: test, Password: 123456), and authorize for remote access to MySQL (if required):
Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ' with GRANT option;
Input:
Exit
Quit MySQL
Terminal input:
mysql–utest–p123456
Test whether the account you just created will log in to MySQL properly

3.3 Modifying MySQL files

Terminal input:
sudo vi/etc/mysql/my.cnf
Open the/etc/mysql/my.cnf file and locate the following line:
Bind-address = 127.0.0.1
Comment out this line, or MYSQL remote may still be inaccessible.
Save and exit.

4. Installing the JDK

Refer to Other Essays

5. Install Tomcat

Direct Apt-get,

Modify sudo vim/etc/init.d/tomcat7

Add/usr/lib/jvm/java-8-oracle at the end of the jdk_dirs variable

Restart Service

Enable Port 80

Enable Authbind
Open a text editor like VIM and load the default tomcat configuration file

    1. nano/etc/DEFAULT/TOMCAT7

Remove the comment hash "#" in front of the Authbind property and set the value to "yes"

    1. Authbind=yes


Create authbind bind permission files for ports and 443. Authbind would loop through the directory structure and try to find a Byport file referencing the port number attempting to Be bound. Authorization'll is granted if the user attempting to bind have execute permission.

    1. Touch/etc/authbind/byport/80
    2. touch/etc/authbind/byport/443
    3. chmod 0755/etc/authbind/byport/80
    4. chmod 0755/etc/authbind/byport/443
    5. Chown tomcat7:tomcat7/etc/authbind/byport/80
    6. Chown tomcat7:tomcat7/etc/authbind/byport/443



Change the Tomcat Port from 8080/8443 to 80/443
Open a text editor like VIM and load the server configuration file

    1. Nano/etc/tomcat7/server.xml



Find the connector for port 8080 to port, and the redirect port from 8443 to 443:

C code
    1. <connector port= "protocol="http/1.1 "
    2. connectiontimeout= "20000" uriencoding="UTF-8 "
    3. redirectport="443" >
    4. </Connector>


Restart the Tomcat service

    1. sudo service tomcat7 restart


View the Catalina.out log after restart and look for any errors. If you see the permission denied errors, then your may has missed a step like:
Forgetting to uncomment the Authbind setting and putting it to "yes"
Forgetting to restart the TOMCAT7 service as Sudo

Finally run Netstat-ant to see if Port 80 is up.

II. Deployment of applications

After the tomcat configuration succeeds, you need to deploy the developed app to the Tomcat server. The steps are as follows:

1. Package the app as Root.war

2. Create the logs directory in/USR/SHARE/TOMCAT7

    1. Cd/usr/share/tomcat7
    2. sudo mkdir logs
    3. sudo chmod 755 logs

3, create Root.xml file content as follows:

  1. <!--the contents of this file is loaded for each Web application --
  2. <context path="" Docbase="/usr/share/tomcat7/root.war" displayname="tomcat_1" reload="false"
  3. debug="0" privileged="true" >
  4. <!--Default set of monitored resources--
  5. <WatchedResource>WEB-INF/web.xml</WatchedResource>
  6. </Context>

where docbase= "/usr/share/tomcat7/root.war" points to the address of the file where the application is deployed.

4. Restart Tomcat

    1. sudo service tomcat7 restart

The following information is indicated:

    1. * Stopping Tomcat servlet engine TOMCAT7
    2. ... done.
    3. * Starting Tomcat servlet engine TOMCAT7
    4. ... done.

5. After the launch, login to the application address to view. If it is not successful, copy the Root.xml file to the following directory, and repeat Tomcat.

      1. /var/lib/tomcat7/conf/catalina/localhost

Modify the default directory, in the server.xml of Tomcat

Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >

</Host>

Middle Plus

<context path= "" docbase= "D:\Tomcat 6.0\webapps\menu" debug= "0" reloadable= "true"/>

My project is placed under the D:\Tomcat 6.0\webapps, the project name is menu, so only need to put the project address in the docbase is OK

Construction of JDK+TOMCAT+MYSQL Environment under Ubuntu

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.