In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to install Tomcat+JDK+Mysql, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. Background
JAVA projects often need to use multiple components at the same time, such as tomcat, jdk, mysql, nginx, etc. In order to facilitate the construction of client / server environment, relevant project components need to be uniformly packaged and installed with one click. In order to achieve the secondary goal, this test is carried out.
two。 Test scheme
(1) Environmental description
Operating system version: windows 7 x64 sp1
Tomcat version: apache-tomcat-8.5.47-windows-x64 decompressed version
JDK version: java 1.7 green version
Mysql version: mysql-5.5.62-winx64 decompressed version
Packaging tool: innosetup-5.6.1
(2) Test steps
① downloads the installation package for each component
Download address of Mysql:
Https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62-winx64.zip
Download address of JDK:
Link: https://pan.baidu.com/s/1STRuH2-lInjVN4K4KUKkOg
Extraction code: tke1
Tomcat download address: http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.47/bin/apache-tomcat-8.5.47-windows-x64.zip
Download address of Innosetup:
Http://files.jrsoftware.org/is/5/innosetup-5.6.1.exe
② Mysql configuration
1) decompress the Mysql to C:\ test\ mysql-5.5.62-winx64, and configure the my.ini file, as follows:
[client]
Port = 3306
Socket = / tmp/mysql.sock
[mysqld]
Port = 3306
Basedir = "C:/test/mysql-5.5.62-winx64"
Datadir = "C:/test/mysql-5.5.62-winx64/data/"
Character-set-server=utf8
Default-storage-engine=INNODB
Sql-mode= "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Socket = / tmp/mysql.sock
Skip-external-locking
Key_buffer_size = 16K
Max_allowed_packet = 1m
Table_open_cache = 128,
Sort_buffer_size = 64K
Read_buffer_size = 256K
Read_rnd_buffer_size = 256K
Net_buffer_length = 2K
Thread_stack = 512K
Server-id = 1
[mysqldump]
Quick
Max_allowed_packet = 16m
[mysql]
No-auto-rehash
Default-character-set=utf8
[myisamchk]
Key_buffer_size = 8m
Sort_buffer_size = 8m
[mysqlhotcopy]
Interactive-timeout
2) copy the database creation script create_db.sql and the table creation script hrdemo.sql to the directory C:\ test\ mysql-5.5.62-winx64\ data, and under C:\ test\ mysql-5.5.62-winx64\ bin, create the database installation configuration script mysql_init.bat, as follows:
Cd / d% ~ dp0
"% cd%\ mysqld.exe"-initialize-insecure-console
Echo-mysql init succee-
Pause
Mysqld install mysql--defaults-file= "C:\ test\ mysql-5.5.62-winx64\ my.ini"
Echo-mysql service install succee-
Pause
Net start mysql
Sc config mysql start= auto
Net stop mysql
Net start mysql
Echo service install finished
Pause
"% cd%\ mysqladmin"-u root password hr_1234
Echo change password finished
Pause
Cd..
"% cd%\ bin\ mysql.exe"-uroot-phr_1234 < "% cd%\ data\ create_db.sql"
Echo create database finished
Pause
"% cd%\ bin\ mysql.exe"-uroot-phr_1234 < "% cd%\ data\ hrdemo.sql"
Echo create table finished
Pause
Echo mysql setup finished
③ JAVA configuration
1) decompress JDK1.7 to C:\ test\ apache-tomcat-8.5.47\ bin\ Java\ jdk1.7.0_51, and create the JDK configuration script autoInstallJDK.bat under C:\ test\ apache-tomcat-8.5.47\ bin\ Java\ jdk1.7.0_51\ bin, as follows:
@ echo off
Echo
Cd..
Echo "% ~ dp0"
Echo "cd%"
Set jdkpath=%cd%
Echo jdkpath%
Setx JAVA_HOME "% jdkpath%"-m
Setx CLASSPATH ".% JAVA_HOME%%\ lib\ tools.jar;%%JAVA_HOME%%\ lib\ dt.jar"-m
Echo Path%
Echo% Path% | find / I "% java_home%" & & set IsNull=true | | set IsNull=false
Echo IsNull%
If not% IsNull%==true (
Reg add "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Environment" / v Path / t REG_SZ / d "% Path%;%%JAVA_HOME%%\ bin;%%JAVA_HOME%%\ jre\ bin" / f
Setx Path "% JAVA_HOME%%\ bin;%Path%")
Exit
④ Tomcat configuration
1) Unzip the Tomcat package to the directory C:\ test\ apache-tomcat-8.5.47, and create a configuration script tomcat_startup.bat in the directory C:\ test\ apache-tomcat-8.5.47\ bin, as follows:
Echo
Call "% ~ dp0%service.bat" install tomcat8
Echo
Sc config tomcat8 start= auto
Sc start tomcat8
The following two sentences of rem are set to start automatically in the service.
Wmic service where name= "tomcat8" changestartmode "automatic"
Wmic service where name= "tomcat8" startservice
Exit
2) modify the service.bat script in the C:\ test\ apache-tomcat-8.5.47\ bin directory, as follows:
Under start setlocal, add:
SET "% JAVA_HOME%" = "% cd%\ Java\ jdk1.7.0_51"
SET "% JRE_HOME%" = "% cd%\ Java\ jdk1.7.0_51\ jre"
3) copy the project war package to C:\ test\ apache-tomcat-8.5.47\ webapp.
⑤ Packaging script
1) install the packaging tool innosetup, select the default option, and create a packaging script pack.iss in the C:\ test directory, as follows:
The script is generated by the Inno Setup script wizard
[Setup]
Note: the value of AppId is to identify the application separately.
Do not use the same appId value for other installers.
; (generate a new GUID, click tools | generate GUID in IDE.)
AppId= {{9E044575-9CD9-4751-B0BE-F6758BA94548}
AppName=Test
AppVersion=V0.01
AppVerName=TestServer V0.01
AppPublisher=TestTechnology
AppPublisherURL= http://www.baidu.com/
AppSupportURL= http://www.baidu.com/
AppUpdatesURL= http://www.baidu.com/
DefaultDirName= {pf}\ Test
DefaultGroupName=TestSoftWare
AllowNoIcons=yes
OutputBaseFilename=Test
Compression=lzma
SolidCompression=yes
[Files]
; copy tomcat
Source: "C:\ test\ apache-tomcat-8.5.47\ *"; DestDir: "{app}\ apache-tomcat-8.5.47"; Flags:igNoreversion recursesubdirs createallsubdirs
; copy mysql
Source: "C:\ test\ mysql-5.5.62-winx64\ *"; DestDir: "{app}\ mysql-5.5.62-winx64"; Flags:igNoreversion recursesubdirs createallsubdirs
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Icons]
Name: "{group}\ {cm:UninstallProgram,OA platform}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\ OA platform"; Filename: http://localhost:8080/hr
[INI]
Modify the database configuration file
Filename: "{app}\ mysql-5.5.62-winx64\ my.ini"; Section: "mysqld"; Key: "basedir"; String: "{app}\ mysql-5.5.62-winx64"
Filename: "{app}\ mysql-5.5.62-winx64\ my.ini"; Section: "mysqld"; Key: "datadir"; String: "{app}\ mysql-5.5.62-winx64\ data"
Filename: "{app}\ mysql-5.5.62-winx64\ my.ini"; Section: "mysqld"; Key: "port"; String: "3306"
Filename: "{app}\ mysql-5.5.62-winx64\ my.ini"; Section: "client"; Key: "port"; String: "3306"
[Run]
Filename: "{app}\ apache-tomcat-8.5.47\ bin\ Java\ jdk1.7.0_51\ bin\ autoInstallJDK.bat"
Filename: "{app}\ mysql-5.5.62-winx64\ bin\ mysql_init.bat"
Filename: "{app}\ apache-tomcat-8.5.47\ bin\ tomcat_startup.bat"
[UninstallDelete]
Type:filesandordirs;Name: "{app}\ apache-tomcat-8.5.47"
Type:filesandordirs;Name: "{app}\ mysql-5.5.62-winx64"
⑥ Unified Packaging
1) compiling the script pack.iss with innosetup will eventually create the directory Output under C:\ test and generate the Test.exe executor.
⑦ installation test
1) in the pure windows 7 x64 sp1 system, run the Test.exe execution program, follow the steps to install, and eventually generate a login link on the desktop. Click the link to log in in the browser, and the login is successful. At this time, the experiment is completed.
Thank you for reading this article carefully. I hope the article "how to install Tomcat+JDK+Mysql" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.