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應用程序,您可以驗證安裝成功與否。在登錄之后,您應該得到一條消息,說明一切運行均好。盡管運行示例流程很愉快,但是最好嘗試您自己開發的業務流程。