Linux Java EE Development environment and tomcat--(10)

Source: Internet
Author: User

1. Install MySQL

When installing MySQL on CentOS7, the following prompt appears:

The reasons are:

CentOS7 with mariadb instead of MySQL

Solution Solutions

If you have to install MySQL, you must first add the MySQL community repo by entering the command: sudo rpm-uvh http://dev.mysql.com/get/ MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM, and finally installs the Mysql:yum install MySQL mysql-server with the usual method like installing MySQL Mysql-libs Mysql-server

1. Online Installation Commands

Yum-y Install Mysql-server

2. Loading Service startup Services

/etc/rc.d/init.d/mysqld start or service mysqld restart

3. Setting up the MySQL service boot from boot

Chkconfig mysqld on

4. Check MySQL boot settings

chkconfig--list mysqld

(mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off) ← If 2--5 is on the status OK

5. View current MySQL version information

MySQL--version

6. Modify MySQL default encoding and the maximum length of SQL statement execution

Execute vi/etc/my.cnf command

Added at last [mysqld]:

Default-character-set=utf8

Character-set-server = UTF8

init_connect= ' Set names UTF8 '

Max_allowed_packet = 50M

wait_timeout=27594000

Restart MySQL command: service mysqld Restart

Go to MySQL to view time-out:show global variables like ' wait_timeout ';

7. Go to MySQL to view the current encoding

Mysql>Show variables like '%character% ';

8. Set access rights and Passwords

Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' admin ';

Mysql> Grant all privileges on * * to ' root ' @ ' localhost ' identified by ' admin ';

Mysql> flush Privileges;

9. View the status of the access rights that are currently set

Mysql> Select User,host,password from Mysql.user;

10. Restart the MySQL service

Service mysqld Restart or/etc/init.d/mysqld restart .

11. Delete MySQL (execute when installation is wrong)

Yum remove MySQL mysql-server mysql-libs compat-mysql51

Rm-rf/var/lib/mysql

Rm/etc/my.cnf

12. Check if MySQL is present (and then execute when installation is wrong)

Rpm-qa|grep MySQL//If any, continue to delete

RPM-QL MySQL//view file location

Note: Restart the server: Reboot

Test:

Mysql-u name-p

Enter Password:

Creating databases: Create Database xxx;

show databases;

Create a table xxxxxxx

2.JDK Installation

1. Copy the installation package jdk-7u71-linux-x64.tar.gz to the/opt/java directory

2. Change the package permissions to 777

chmod 777 jdk-7u71-linux-x64.tar.gz

3. Unzip

[Email protected] java]# TAR-XVF jdk-7u71-linux-x64.tar.gz

4. Modify the permissions of the extracted directory

[Email protected] java]# CHMOD-CFVR 777 jdk1.7.0_71/

5. Modify the Environment variables:

[Email protected] java]# VI ~/.BASHRC

Export java_home=/opt/java/jdk1.7.0_71

Export JRE_HOME=${JAVA_HOME}/JRE

Export Classpath=.:${java_home}/lib:${jre_home}/lib

Export Path=${java_home}/bin: $PATH

As follows:

6. Make the configured environment variable effective

[root@localhost java]# Source ~/.BASHRC

7. Making this JDK a system default JDK is useful for multi-JDK environments (if the environment is new, you do not need to execute the following statement)

[Root@localhost java]# update-alternatives--install/usr/bin/java Java/opt/java/jdk1.7.0_71/bin/java 300

[Root@localhost java]# update-alternatives--install/usr/bin/javac Javac/opt/java/jdk1.7.0_71/bin/javac 300

[Root@localhost java]# update-alternatives--install/usr/bin/jar Jar/opt/java/jdk1.7.0_71/bin/jar 300

[Root@localhost java]# update-alternatives--install/usr/bin/javah javah/opt/java/jdk1.7.0_71/bin/javah 300

[Root@localhost java]# update-alternatives--INSTALL/USR/BIN/JAVAP JAVAP/OPT/JAVA/JDK1.7.0_71/BIN/JAVAP 300

8. See if the installed JDK is usable

java-version

javac-version

After you enter two commands, the version information displayed is the same, indicating that you have successfully

3.Tomcat Installation

Steps:

1) upload Tomcat to Linux

2) Unzip Tomcat to/usr/local

3) Open Linux port 8080 for external access

/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT

/etc/rc.d/init.d/iptables Save

For CENTOS7

Turn on the Firewall service first (if the firewall is running, skip directly)

Systemctl Start Firewalld

Open port

Firewall-cmd--add-port=8080/tcp--permanent

4) Start off Tomcat

Enter Tomcat under the bin to start:./startup.sh (must be with a dot and slash, otherwise it will not run)

Enter Tomcat under the bin to close:./shutdown.sh

4. Release Javaweb Project

1. Packaging Web Projects

2. Look at the war package structure:

3. Test the War package to E:\tomcat\apache-tomcat-7.0.72\webapps (Linux is the same as Windows)

Note: When you run Tomcat, it automatically extracts

If Tomcat is running, the war package will be extracted, and Tomcat will scan the WebApps directory and extract the war packet from time to time.

4. Preparing the SQL file (Linux)

The database script for Windows is exported and then run to the Linux database.

Linux databases can be connected remotely through a visual interface in Windows.

5. Place the war package in the WebApps directory of the Linux tomcat:

Linux Java EE Development environment and tomcat--(10)

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.