安裝與組態 > 安裝 ThingWorx > Ubuntu 安裝 > H2/Azure SQL > 安裝 ThingWorx (Ubuntu/RHEL)
安裝 ThingWorx (Ubuntu/RHEL)
1. 建立 /ThingworxStorage/ThingworxBackupStorage 目錄。否則,請建立 /ThingworxPlatform 目錄:
$ sudo mkdir /ThingworxStorage /ThingworxBackupStorage /ThingworxPlatform
2. 變更 /ThingworxPlatform、/ThingworxStorage/ThingworxBackupStorage 的擁有者與存取權限。如果沒有這些權限,伺服器將無法啟動。
$ sudo chown tomcat8.5:tomcat8.5 /ThingworxStorage /ThingworxBackupStorage /ThingworxPlatform
$ sudo chmod 775 /ThingworxStorage /ThingworxBackupStorage /ThingworxPlatform
3. 如果您尚未執行此操作,請從 PTC 軟體下載中取得 Thingworx.war 檔案。
4. Thingworx.war 移至 $CATALINA_HOME/webapps
$ sudo mv Thingworx.war $CATALINA_HOME/webapps
$ sudo chown tomcat8.5:tomcat8.5 $CATALINA_HOME/webapps/Thingworx.war
$ sudo chmod 775 $CATALINA_HOME/webapps/Thingworx.war
5. platform-settings.json 放置在 ThingworxPlatform 資料夾中。
6. 如果您使用 H2 作為資料庫,請執行此步驟。如果您未將 H2 作為資料庫使用,請轉至下一個步驟。在 platform-settings.json 檔案中新增 H2 的使用者名稱與密碼。如需詳細資訊,請參閱 platform-settings.json 組態詳細資訊
* 
ThingWorx 與 H2 資料庫的連線需要使用者定義的使用者名稱與密碼,否則伺服器將不會啟動。此設計完全降低了 CVE-2018-10054 所表示的任何潛在弱點。
},
"PersistenceProviderPackageConfigs":{
"H2PersistenceProviderPackage":{
"ConnectionInformation":
{
"password": "<addsecurepassword>",
"username": "twadmin"
}
},
7. 如果您使用 Azure SQL 作為資料庫,請執行此步驟。如果您未將 Azure SQL 作為資料庫使用,請轉至下一個步驟。開啟 platform-settings.json 檔案並新增 Azure SQL 持續性提供者參數:
"PersistenceProviderPackageConfigs": {
"AzuresqlPersistenceProviderPackage": {
"ConnectionInformation": {
"driverClass": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"jdbcUrl": "jdbc:sqlserver://<server name>:<port>;databaseName=thingworx;applicationName=Thingworx;",
"password": "<database password>",
"username": "twadmin"
}
}
}
8. 配置管理員密碼。
將下列 AdministratorUserSettings 部份 (在 PlatformSettingsConfig 中) 新增至您的 platform-settings.json 檔案,並附上長度至少為 14 個字元的密碼。如需有關放置的詳細資訊,請參閱 platform-settings.json 組態詳細資訊。如需有關設定密碼的其他資訊,請參閱密碼 密碼。請勿複製並貼上下列範例,因為它可能導致 platform-settings.json 中的格式錯誤。相反,請按一下 此處並從檔案進行複製。

{
"PlatformSettingsConfig": {
"AdministratorUserSettings": {
"InitialPassword": "changeme"
}
}
}
* 
如果 Tomcat 無法啟動,並報告錯誤訊息:Check the InitialPassword setting in the AdministratorUserPassword section in platform-settings.json...,請檢查下列內容:
密碼設定存在於 platform-settings.json
密碼有效 (依預設為14 個或更多字元)
platform-settings.json 檔案將正確格式化,錯誤格式會導致錯誤
:
9. 啟用延伸功能匯入。依預設,延伸功能匯入針對所有使用者皆為禁用。
將下列內容新增到 platform-settings.json 檔案中。將下列 ExtensionPackageImportPolicy 參數更新為 true 以允許匯入延伸功能。有關組態的最佳作法,請參閱 匯入副檔名
"ExtensionPackageImportPolicy": {
"importEnabled": <true or false>,
"allowJarResources": <true or false>,
"allowJavascriptResources": <true or false>,
"allowCSSResources": <true or false>,
"allowJSONResources": <true or false>,
"allowWebAppResources": <true or false>,
"allowEntities": <true or false>,
"allowExtensibleEntities": <true or false>
},
10. 配置授權:
開啟 platform-settings.json 檔案,並將下列項目新增至 PlatformSettingsConfig 部份 (如需有關放置的詳細資訊,請參閱 platform-settings.json 組態選項)。
* 
如果您執行的是已中斷連線的安裝 (無網際網路存取),則不需要將授權資訊新增至 platform-settings.json 檔案。如需已中斷連線的網站,請參閱 授權指南並略過此步驟。
"LicensingConnectionSettings":{
"username":"PTC Support site user name",
"password":"PTC Support site password"
}
* 
如果設定填寫錯誤或伺服器無法連線,則會在 ThingworxPlatform 資料夾中建立授權請求文字檔案 (licenseRequestFile.txt)。在此情況下,必須手動建立授權。(如果未建立,ThingWorx 將在限制模式下啟動。限制模式下不允許您將授權的實體保存至資料庫。授權的實體是「物件」、「混搭」、「主物件」、「小工具」、「使用者」和「持續性提供者」)。
如需有關透過授權管理網站取得 ThingWorx 已中斷連線網站授權的詳細資訊,請參閱已中斷連線網站 (未連線至 PTC 支援入口網站) 的 授權指南
11. 依照 加密密碼中的步驟加密授權伺服器密碼。
12. 如果您使用 Azure SQL 作為資料庫,請遵循下列步驟下載 JDBC 驅動程式。如果您不使用 Azure SQL,請略過此步驟。
a. 轉至 Azure 入口網站,並導覽至您的 ThingWorx 資料庫。
b. 選取「連接字串」
c. 選取 JDBC 標籤。
d. 選取「下載 Microsoft JDBC Driver for SQL Server」
e. 選取 Microsoft JDBC Driver 6.0 for SQL Server
f. 將 ThingWorx VM 中的已下載二進位檔案解壓縮並複製到 Tomcat lib 目錄中。
13. 啟動 Tomcat。
(UBUNTU) sudo service tomcat8.5 start
(RHEL) $ sudo systemctl start tomcat
請核對是否在 ThingworxPlatform 資料夾中建立了授權檔案 (successful_license_capability_response.bin)。
14. 欲啟動 ThingWorx,請在 Web 瀏覽器中轉至 http://<伺服器名稱>:<埠>/Thingworx
15. 變更初始管理員密碼:
a. 在 Composer 中,選取「管理員」>「變更密碼」
b. 「變更密碼」視窗中,輸入「目前密碼」「新密碼」「確認密碼」
* 
密碼應不易猜測,也不應為已知的通用密碼,建議其長度應至少為 14 個字元,其中包含大寫與小寫字母、數字和特殊字元的混合。
c. platform-settings.json 檔案中刪除初始密碼。
16. 選取「完成」
17. (選用步驟) 欲確定授權狀況,請在 Composer 中開啟「監視」>「子系統」>「授權子系統設定」以確認包含在授權中的功能 (授權實體) 清單。如果不存在授權實體,您將處於限制模式。