用inno Setup制作web项目安装包

inno Setup制作安装包

新建一个文件夹exambody,放apache-tomcat-6.0.33、mysql-5.1.37-win32、java(注:jdk)和图标exambody.ico

 

  1. 1.       批处理安装mysql服务:

在mysql-5.1.37-win32\bin 的目录下:

新建一个文件:启动服务.bat

里面写:

cd /d %~dp0                                           (切换到当前目录)

"%cd%\mysqld.exe" -install exambodyMysql 

(安装mysqld服务,并命名为exambodyMysql)

net start exambodyMysql               (关闭exambodyMysql服务)

 

新建一个文件:关闭服务.bat

里面写:

net stop exambodyMysql          (关闭exambodyMysql服务)

  1. 2.       批处理安装tomcat服务:

在apache-tomcat-6.0.33目录下:

新建一个文件:启动服务.bat

cd /d %~dp0                            (切换到当前目录)

"%cd%\service.bat" install                  (安装tomcat服务)

然后在当前目录下找到service.bat:

找到:           

rem Guess CATALINA_HOME if not defined

set "CURRENT_DIR=%cd%"

if not "%CATALINA_HOME%" == "" goto gotHome

set "CATALINA_HOME=%cd%"

if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome

rem CD to the upper dir

:gotHome

修改成:

rem Guess CATALINA_HOME if not defined

set "CURRENT_DIR=%cd%"

rem if not "%CATALINA_HOME%" == "" goto gotHome

rem set "CATALINA_HOME=%cd%"

rem if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome

rem CD to the upper dir

cd ..

set "CATALINA_HOME=%cd%"

:gotHome

注:rem是注释掉那四行。

cd..是跳到当前目录的上级目录,即apache-tomcat-6.0.33,

set "CATALINA_HOME=%cd%"  是设置CATALINA_HOME为当前目录

 

找到:

set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"

rem Set default Service name

set SERVICE_NAME=Tomcat6

set PR_DISPLAYNAME=Apache Tomcat 6

修改成:

set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"

rem Set default Service name

set SERVICE_NAME=exambodyTomcat

set PR_DISPLAYNAME= exambodyTomcat

注:

第一个:exambodyTomcat    修改服务名

第二个:exambodyTomcat    服务显示名

 

找到:

:doInstall

rem Install the service

echo Installing the service '%SERVICE_NAME%' ...

echo Using CATALINA_HOME:    "%CATALINA_HOME%"

echo Using CATALINA_BASE:    "%CATALINA_BASE%"

echo Using JAVA_HOME:        "%JAVA_HOME%"

rem Use the environment variables as an example

rem Each command line option is prefixed with PR_

修改成:

:doInstall

cd..

set "JAVA_HOME=%cd%\java\jdk1.6.0_21"

rem Install the service

echo Installing the service '%SERVICE_NAME%' ...

echo Using CATALINA_HOME:    "%CATALINA_HOME%"

echo Using CATALINA_BASE:    "%CATALINA_BASE%"

echo Using JAVA_HOME:        "%JAVA_HOME%"

rem Use the environment variables as an example

rem Each command line option is prefixed with PR_

注:cd..是跳到当前目录的上级目录,即exambody

set "JAVA_HOME=%cd%\java\jdk1.6.0_21"

  是设置JAVA_HOME为exambody\java\jdk1.6.0_21

找到:

echo The service '%SERVICE_NAME%' has been installed.

:end

cd "%CURRENT_DIR%"

修改成:

echo The service '%SERVICE_NAME%' has been installed.

sc config exambodyTomcat start= auto

sc start exambodyTomcat

:end

cd "%CURRENT_DIR%"

注:sc config exambodyTomcat start= auto             

设置exambodyTomcat为自启动

sc start exambodyTomcat        启动 exambodyTomcat服务

新建一个文件:关闭服务.bat

net stop exambodyTomcat            (关闭exambodyTomcat服务)

  1. 3.       新建一个编译文件exambody

代码如下:

#define MyAppName "查体管理系统"

#define MyAppVersion "1.0"

 [Setup]

AppName={#MyAppName}(安装程序名)

AppVersion={#MyAppVersion}(设置版本)

;AppVerName={#MyAppName} {#MyAppVersion}

DefaultDirName=D:\exambody(安装默认路径)

DefaultGroupName={#MyAppName}

AllowNoIcons=yes

OutputDir=output(输出路径)

OutputBaseFilename=setup(安装程序名)

SetupIconFile=exambody\exambody.ico(设置图标)

Compression=lzma

SolidCompression=yes

 

[Languages](设置语言)

Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

 

[Files](复制文件)

Source: "exambody\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

 

[Icons]

Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"(卸载文件,并在开始菜单生成快捷键)

Name: "{commondesktop}\查体"; Filename: http://localhost:8080(桌面创建主页的快捷方式)

 

[Run](装完后自动运行的 文件)

Filename: "{app}\mysql-5.1.37-win32\bin\启动服务.bat"; Flags: nowait runhidden;(启动mysql服务)

Filename: "{app}\apache-tomcat-6.0.33\bin\启动服务.bat"; Flags: nowait runhidden;(启动tomcat服务)

 

posted on 2012-03-22 10:37  _安静  阅读(8052)  评论(0编辑  收藏  举报

导航