Centos7.3 Tomcat and MySQL to install and deploy applications JavaWeb

CentOS version View:

rpm -q centos-release

 

A, Tomcat installation

1. Download

One way: I'm in the / home directory installation

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.49/bin/apache-tomcat-8.5.49.tar.gz

 Installing a compressed packet generated

Second way: Tomcat-8.5.49 download archive to a folder

 2. Extract

tar zxvf apache-tomcat Over 8.5 . 49 . tar .gz

After decompression will generate a folder in the current directory

 If that name is too long to be a change of name

# Change the file name
 mv the Apache-tomcat- 8.5 . 49 Tomcat 

# delete the installation package 
RM -rf tomcat- the Apache- 8.5 . 49 . Tar .gz

3. Turn on the firewall access to port

# Check firewall status 
Firewall -cmd - State 

# turn on the firewall 
systemctl Start firewalld 

# Turn on the firewall access to port --zone for the scope, - Permanent permanent setting, this parameter is no need to re-set after the restart 
Firewall -cmd --permanent = public --add-port --zone = 8080 / tcp 

# reload firewall configuration 
firewall -cmd - reload 

# Check whether the port is open 
firewall -cmd --query-port = 8080 / tcp

Success configuration is as follows:

 4. Start

Start Tomcat

./tomcat/bin/startup. SH 

# To turn off, the executable 
. / Tomcat / bin / the shutdown. SH

Test: Open your browser and enter ip + port number, you can see the following page

Two, MySQL (installed can skip this step)

1. Installation kit yum-utils

yum -y install yum-utils

 2. Download

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

3. Install mysql

yum localinstall mysql-community-release-el6-5.noarch.rpm

Half-way to select y

4. Installation server

yum install mysql-community-server

5. Turn on the firewall access to port

# Enable Access Port 
Firewall -cmd --permanent --zone = public --add-Port = 3306 / tcp 

# reload firewall configuration 
Firewall -cmd --reload

6. profile, provided the coding and non-capitalization

# Edit the configuration file 
vim /etc/my.cnf

I press enter edit mode, to add the following two lines in the [mysqld] in

lower_case_table_names=1
character_set_server=utf8

esc exit edit mode, enter : wq  to save and exit (including the colon) 

7. Start MySQL

service mysqld start

8. Log

# No password, you can directly enter 
MySQL -u root -p

9. Set password

10. Authorizes Telnet

. Grant all privileges on the database name table name to 'username' @ 'IP address' identified by 'password' with grant option;

grant all privileges on *.* to root@'%' identified by '123456' with grant option;

Refresh rights

flush privileges;

 11. If you need to import a database, just create a database and import the database file

# Create a database
 the Create  Database the Test; 

# to switch the current database 
use the Test; 

# import sql file, I will sql file in the Home 
Source   / Home / test.sql;

Third, the application deployment JavaWeb

webapps folder under the file into the tomcat, the war package in this folder, restart tomcat will generate the corresponding name of the folder, enter the corresponding path can be accessed in a browser

 

Guess you like

Origin www.cnblogs.com/zkchan/p/11921178.html