The prerequisite for deploying the project is to prepare the environment, including: Java Runtime Environment (JDK), Tomcat,mysql database
1. First upload something to the server, I am installing the SSH tool in Windows (download and install git to http://gitforwindows.org/)
(1) Under Windows, export the project into a war package, exporting the database script
After export, change the database db.properties of the war package to the connection information on the Linux server.
(2) Upload the war package and script to the server
Liqiang@root~/c/Users/liqiang/Desktop/ Exam.war root@qiaoliqiang. CN://c/Users/Liqiang / Desktop/exam.sql root@qiaoliqiang. CN:/Home
(3) Run the SQL script, create the database, and import the SQL script:
- Viewing files that are passed from windows
$ ssh Root@qiaoliqiang. Cnlast Login:fri Jan + One: -: - 2018 from 218.26.54.83Welcome toAlibaba Cloud ElasticComputeService![[email protected] ~]# ls/Home/exam.sql Exam.war test.html[[email protected] ~]#
2. Import the MySQL script file
Mysql> Create DatabaseExam;mysql> Useexam; ReadingTableInformation forCompletion of Table and columnnamesyou can turnoffThis feature toGet a quicker startup with -ADatabaseChangedmysql>Source/Home/Exam.sql
2. Place the war package in the WebApps directory of the Tomcat installation directory: (or manually deploy the project from the Tomcat manager)
(1) If this item is not previously available, the war package can be placed directly in, and Tomcat will scan
[[email protected] ~] /Home//usr/local/Apache-Tomcat-7.0. the /WebApps/
(2) If the previous project needs to stop the service, delete the original war package and directory and restart the project
[[email protected] ~]# service Tomcat Stop[[email protected] ~]# CD/Usr/Local/Apache-Tomcat-7.0. the/WebApps/[[email protected] ~]# RM Exam-RF[[email protected] ~]# RM Exam.war[[email protected] ~]# CP/Home/Exam.war/Usr/Local/Apache-Tomcat-7.0. the/WebApps/[[email protected] ~]#service Tomcat Start
Add-RF after deleting the directory
3. Test Project deployment:
Curl localhost:88080
Simple steps to deploy a Java EE project under Linux