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
- nano/etc/DEFAULT/TOMCAT7
Remove the comment hash "#" in front of the Authbind property and set the value to "yes"
- 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.
- Touch/etc/authbind/byport/80
- touch/etc/authbind/byport/443
- chmod 0755/etc/authbind/byport/80
- chmod 0755/etc/authbind/byport/443
- Chown tomcat7:tomcat7/etc/authbind/byport/80
- 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
- Nano/etc/tomcat7/server.xml
Find the connector for port 8080 to port, and the redirect port from 8443 to 443:
C code
- <connector port= "protocol="http/1.1 "
- connectiontimeout= "20000" uriencoding="UTF-8 "
- redirectport="443" >
- </Connector>
Restart the Tomcat service
- 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
- Cd/usr/share/tomcat7
- sudo mkdir logs
- sudo chmod 755 logs
3, create Root.xml file content as follows:
- <!--the contents of this file is loaded for each Web application --
- <context path="" Docbase="/usr/share/tomcat7/root.war" displayname="tomcat_1" reload="false"
- debug="0" privileged="true" >
- <!--Default set of monitored resources--
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
- </Context>
where docbase= "/usr/share/tomcat7/root.war" points to the address of the file where the application is deployed.
4. Restart Tomcat
- sudo service tomcat7 restart
The following information is indicated:
- * Stopping Tomcat servlet engine TOMCAT7
- ... done.
- * Starting Tomcat servlet engine TOMCAT7
- ... 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.
- /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