Install mysql, tomcat, and jdk on ubuntu server

Source: Internet
Author: User

 

If you use the 163 image source and then use sudo apt-get install mysql-server, you cannot install other dependent packages automatically. The solution is to change the source to another one, I will return to the default ubuntu source here. Then enter sudo apt-get install mysql-server. ubuntu will automatically download and install all the packages for you.

 

Go to mysql:

1) $ mysql-uroot-p123456 (-u user name and-p password)

2) $ mysql-uroot-p123456 mysql directly enters the mysql database

After successful entry:

1) view the database: $ show databases;

2) view the table: $ show tables;

3) use tables: use mysql;

4) import the SQL file to mysql:

Mysql-uroot-p123456 fws </opt/create_DDL. SQL

 

Install jdk:

1. Download jdk(jdk-7-linux-i586.tar.gz), unzip $ tar-zxvf jdk-7-linux-i586.tar.gz

2) Move the decompressed folder to the specified directory $ mv jdk1.7.0/usr/soft/

3) set environment variables:

$ Vi ~ /. Bashrc

Add:

Export JAVA_HOME =/usr/soft/jdk1.7.0

Export JRE_HOME =$ {JAVA_HOME}/jre

Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib

Export PATH =$ {JAVA_HOME}/bin: $ PATH

Save and exit: source ~ /. Bashrc

4) test: java-version

 

Install tomcat

1)download atat(apache-tomcat-7.0.22.tar.gz) unzip $ tar-zxvf apache-tomcat-7.0.22.tar.gz;

2) Move the decompressed folder to the specified directory $ mv apache-tomcat-7.0.22/usr/soft/

3) environment variables. If jdk is correctly installed, you do not need to set them.

 

Tomcat security:

1) shutdown Port:

The Tomcat server. xml file contains the following sentence:

<Server port = "8005" shutdown = "SHUTDOWN"> it indicates that we disable tomcat using port 8005, you can use the firewall to set 8005 to access only from a specified machine or change the shutdown parameter value to another value.

2) default error page:

The default error page protects some sensitive information. To prevent attacks, we need to hide this information. Open the/web. xml folder and add the following content after </welcome-file-list> at the end of the file:

<Error-page>

<Exception-type> java. lang. Throwable </exception-type>

<Location>/error. jsp </location>

</Error-page>

3) Delete the webapps sample file: delete project files such as ROOT.

 

From Java, go's

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.