1.5.2 Installing the Activiti tool stack (安装Activiti工具栈)
Tom Baeyens and his team have been able to provide a smooth installation process. The first thing you have to do is to point your web browser to the Activiti website at http://www.activiti.org. There you will be guided to the latest release of Activiti via the download button. Just download the latest version and unpack the distribution to a logical folder such as:
Tom Baeyens和他的团队已经能够提供一个平滑的安装过程。您所要做的第一件事情就是将web浏览器指向Activiti的:http://www.activiti.org。点击下载按钮,将导航至Activiti的最新版本。只要将最新版本下载下来并将分发解压至如下的逻辑文件夹:
1 C:\activiti (Windows)
2 /opt/activiti (Linux or Mac OS)
When working with other process engines downloading the distribution, which is also a lot larger than the couple of MBs of Activiti, is only the beginning of a long and complex installation procedure. With Activiti, there’s a setup directory which contains an Ant build file that installs the full Activiti suite. The directory structure of the distribution is shown in figure 1.10.
当使用其它的流程引擎,它只是漫长和复杂安装步骤的第一步。在Activiti里,有一个包含全部Activiti套件的ant构建文件。分发的目录结构如图1.10所示。
Figure 1.10 The directory structure of the Activiti distribution with the setup directory and the Ant build.xml
file as the main parts for the installation procedure.
图 1.10 Activiti分发包的目录结构,里面有setup目录以及作为安装过程主要部分的Ant build.xml文件。
Before you go further with the installation procedure, make sure that you have installed a Java 6 SDK, pointed the JAVA_HOME environment variable to the Java installation directory, and installed Ant (http://ant.apache.org). Shortcuts to the Java SDK and the Ant framework are also provided on the Activiti download page.
在进行安装过程之前,确保您已经安装了Java 6 JDK, 并将JAVA_HOME环境变量指向Java的安装目录,也安装了Ant(http://ant.apache.org). 在Activiti的下载页面也提供了Java SDK和ant框架的快捷方式。
Another prerequisite is that for Linux and Mac OS platforms the current user has permissions to create a directory downloads in the parent folder of the Activiti installation directory. So if you unpacked the distribution to /opt/activiti, the user should have permissions to create a folder /opt/downloads. The last thing to make sure is that you have a internet connection available without a proxy, because the Ant build file will download additional packages.
在Linux和Mac OS平台下,另外一个必要条件是当前用户具有在Activiti安装目录的父文件夹里建立目录downloads的权限。所以,如果您将发布包解压至/opt/activity,用户应该具有创建/opt/downloads/文件夹的权限。因为ant构建文件将下载另外的包,最后确定之事是确保一个无代理的互联网连接可用。
When you open a terminal or command prompt and go to the setup directory shown in figure 1.11, you only have to run the simple ant command. This will kick off the Ant process which will look for a build.xml file in the setup directory. The installation that now takes includes the following steps:
当您打开终端或命令行提示,切换至图1.11所示的setup目录,您只要简单运行ant命令即可。这将启动Ant过程,则将查找build.xml文件。安装包括下列步骤:
- 1. A H2 database is installed to /apps/h2 and the H2 database is started on port 9092.
- H2数据库安装至/apps/h2,H2在端口9092上启功。
- 2. The Activiti database is created in the running H2 database.
- 在运行的H2数据库上创建Activiti数据库。
- 3. Apache Tomcat 6.0.x is downloaded and installed to /apps/apache-tomcat-6.0.x, where x stands for the latest version.
- 下载Apache Tomcat 6.0.x并安装至/apps/apache-tomcat-6.0.x,这里x表示最新的版本号。
- 3. The Activiti engine libraries are copied to the lib directory of Tomcat
- 将Activiti引擎类库拷贝至Tomcat 的lib目录。
- 5. Demo data including users, groups and business processes are installed to the H2 database.
- 包括用户,组和业务流程的演示数据安装至H2数据库。
- 6. The Activiti engine, REST API, explorer, probe, cycle WARs are copied to the webapps directory of Tomcat.
- 拷贝Activiti引擎,REST API,Explorer,Probe,Cycle的WAR包至Tomcat的webapps的目录。
- 7. Tomcat is started with the Activiti toolstack.
- Tomcat和Activiti工具栈一起启动。
- 8. The modeler is downloaded and installed separately in the last step of the installation procedure.
- 安装的最后一步是分别下载并安装Modeler。
When the Ant script is ready, you have the Activiti toolstack installed and also running. That’s not bad for about a minute of installation time. The Ant build file is not only handy for the installation of Activiti, but also for doing common tasks like stopping and starting the H2 database (ant h2.stop, ant h2.start) and the Tomcat server (ant tomcat.stop,ant tomcat.start) and for re-creating a vanilla database schema (ant db.drop,ant db.create). So it’s worth the time to look at the Ant targets in the Ant build file.
当Ant脚本准备就绪,就可安装Activiti工具栈并运行它们了。安装时间仅仅几分钟,情况不是太糟。Ant build文件不仅方便Activiti安装,而且对下列公共服务也很方便:停止和启动H2数据库(ant h2.stop, ant h2.start),停止和启动Tomcat((ant tomcat.stop, ant tomcat.start),重建普通的数据库schema(ant db.drop, ant db.create),所以值得花时间来看看Ant构建文件的Ant目标。
The installation of Activiti consists foremost of several web applications being deployed to a Tomcat server with Activiti libraries and a ready-to-use H2 database with example processes, groups and users already loaded. For the full picture figure 1.11 shows the installation result in a schematic overview.
Activiti安装包括几个最重要的部署到Tomcat服务器的Web应用程序:Activiti类库,带有示例的H2数据库。为了展示全图,图 1.11以示意图的方式显示了安装结果。
Figure 1.11 An overview of the installation result of the Activiti tool stack, including a running Tomcat server and H2 database with all the Activiti web applications already deployed.
图 1.11 Activiti工具栈安装结果的概貌,包括运行的Tomcat服务器和H2数据库,以及已经部署的Activiti Web应用
To verify if the installation has succeeded the web applications listed in table 1.1 should be available via your favorite web browser. You can use the user kermit with the same password to login to these applications.
为了验证安装成功与否,应该使用您喜好的web 浏览器访问表 1.1所示的Web应用。您可以使用用户名和密码均为kermit登录到这些应用中。
Table 1.1 The URIs of the web applications available for you after the installation of Activiti
表 1.1 Activiti安装之后,您可访问的Web应用程序的URI
By trying the Activiti Probe application, you can verify if the installation was successful. After logging in, you should get a message saying that everything is running fine. Working with demo processes is fun, but it’s even better to try out your own developed business process.
通过尝试Activiti Probe应用程序,您可以验证安装成功与否。在登录之后,您应该得到一条消息,说明一切运行均好。尽管运行示例流程很愉快,但是最好尝试您自己开发的业务流程。