Try   HackMD

Dcm4chee PACS Server 5.29.1架設筆記

Table of Contents

使用Docker架設

References

docker-compose.yml

version: "3" services: ldap: image: dcm4che/slapd-dcm4chee:2.6.3-29.1 logging: driver: json-file options: max-size: "10m" ports: - "389:389" env_file: docker-compose.env volumes: - /var/local/dcm4chee-arc/ldap:/var/lib/openldap/openldap-data - /var/local/dcm4chee-arc/slapd.d:/etc/openldap/slapd.d db: image: dcm4che/postgres-dcm4chee:14.5-29 logging: driver: json-file options: max-size: "10m" ports: - "5432:5432" env_file: docker-compose.env volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - /var/local/dcm4chee-arc/db:/var/lib/postgresql/data arc: image: dcm4che/dcm4chee-arc-psql:5.29.1 logging: driver: json-file options: max-size: "10m" ports: - "8080:8080" - "8443:8443" - "9990:9990" - "9993:9993" - "11112:11112" - "2762:2762" - "2575:2575" - "12575:12575" env_file: docker-compose.env environment: WILDFLY_CHOWN: /opt/wildfly/standalone /storage WILDFLY_WAIT_FOR: ldap:389 db:5432 depends_on: - ldap - db volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - /var/local/dcm4chee-arc/wildfly:/opt/wildfly/standalone - /var/local/dcm4chee-arc/storage:/storage

docker-compose.env

STORAGE_DIR=/storage/fs1 POSTGRES_DB=pacsdb POSTGRES_USER=pacs POSTGRES_PASSWORD=pacs

創建並啟動指令

docker-compose.ymldocker-compose.env存放的目錄底下執行以下指令

docker-compose -p dcm4chee up -d

停止/啟動指令

docker-compose -p dcm4chee stop docker-compose -p dcm4chee start

刪除指令

docker-compose -p dcm4chee down

伺服器存取網址

The received images should show up in the UI of the Archive at


在Windows Local端使用binary files架設

架設環境與選用套件資訊

  • OS: Windows10 Pro 22H2 19045.2486

    注意: Windows與MacOS因為壓縮影像相關的模組會無法執行,因此安裝好後可能會有部分功能無法使用,詳情參閱官網文件備份內的說明但仍需照常安裝JAI Image IO 1.2模組,否則dcm4chee後端無法正常部署

    • 20230201實測於原生Windows Server2016 Local環境安裝成功
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • 估計只要使用Windows Server2016以上的版本都可以直接參照官方手冊安裝在本地端
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • 20230202於Windows11 Pro 22H2 Local安裝成功,官方文件的警示可能有誤!
    • 20230203於Windows10 Pro 21H1 Local安裝成功,排除無法在Windows環境架設dcm4chee的可能性,但是官方的警示仍須注意,在Windows環境運行dcm4chee可能無法使用內建的影像壓縮功能
  • Binary Package: dcm4chee-arc-5.29.1-mysql
  • JDK: jdk-17
  • MariaDB: 10.4.27 (using XAMPP)
  • OpenLDAP: 2.4.49 直接下載該版本的Windows 64bits安裝包
  • Wildfly-26.1.2.Final
  • Apache Directory Studio 2.0.0-M17

DCM4CHEE 5.29.1 Local安裝手冊完整備份

重要!
文件中提到的 $DCM4CHEE_ARC (Linux)或是 %DCM4CHEE_ARC% (Windows)
就是指下載的dcm4chee Binary Package解壓縮後的資料夾路徑
例如: 我下載 dcm4chee-arc-5.29.1-mysql.zip
解壓縮後放在C:/Services/dcm4chee-arc-5.29.1-mysql,這個路徑就是我的 %DCM4CHEE_ARC%

$WILDFLY_HOME 與 %WILDFLY_HOME%也是相同的邏輯

OpenLDAP Server架設紀錄

建議選用OpenLDAP,有如下圖的安裝引導介面(我已經安裝好了,所以選項不同於安裝時)

Windows版OpenLDAP官網: 2.4.49

也可以點我直接下載該版本的Windows 64bits安裝包

除了安裝路徑建議改為 C:\Program Files\OpenLDAP
其餘安裝設定都建議直接使用預設值

另外值得注意的是設定dcm4chee OpenLDPA時文件有提供兩種方式可任選

我建議直接使用OpenLDAP with slapd.conf configuration file
只需要修改config檔案和複製 %DCM4CHEE_ARC% 內含的設定檔即可

成功匯入設定檔後 記得重新啟動OpenLDPA Server的服務


點選右鍵 -> 重新啟動

導入dcm4chee預設LDAP設定檔紀錄

這部分對應到官方文件中Import default configuration into LDAP Server的章節

主要針對Apache Directory Studio 2.0.0的操作進行說明,以下操作步驟都對應到官方文件中的步驟標號,我只挑比較需要注意的說明,因此跳號是正常的

1.新增連線LDAP連線


上下兩張圖的設定就是按照官方文件的預設值,如果你有修改再依情況調整

其餘設定直接使用Apache Directory Studio提供的預設值即可


好了之後對該連線設定圖示快速點兩下即可連線至OpenLDPA Server

2.修改預設值

如果你有把dcm4chee提供的預設值改掉,需參照官方文件進行設定,不然這部分可以直接省略

3~5.使用Apache Directory Studio的LDIF匯入功能

於已連線狀態下再參照下圖點選


點選Next之後選擇要匯入的LDIF檔案 重複操作直到把3~5點的檔案都順利匯入

6.匯入vendor-data.zip

文件有提供a、b兩個選項可任選
我是使用方法a:繼續透過Apache Directory Studio操作較為方便

值得注意的是,必須先點選進入到dcm4chee-arc device level(如下圖所示)

然後參閱下圖點選New Attribute的圖示(這很重要,我當初找很久)

接著照官方文件的設定為dicomVendorData後,直接點選Finish

會跳出如下圖的視窗,這時候再選擇Load Data去找到
$DCM4CHEE_ARC/ldap/vendor-data.zip 匯入即可

7.我是用dcm4chee的預設值,所以直接跳過

資料庫設定檔add-data-source-mysql.cli

檔案路徑%DCM4CHEE_ARC%/cli/

請先參照以下說明修改好設定檔後再往下設定Wildfly

此部分沒有設定好後端無法正常部屬及啟動

官方範例設定

/subsystem=datasources/jdbc-driver=mysql:add(driver-module-name=com.mysql,driver-name=mysql)
data-source add --name=pacsds --driver-name=mysql --jndi-name=java:/PacsDS \
--connection-url=jdbc:mysql://<host>:3306/<database-name>?serverTimezone=<timezone> \
--user-name=<user-name> --password=<user-password>

我的設定範例

/subsystem=datasources/jdbc-driver=mysql:add(driver-module-name=com.mysql,driver-name=mysql)
data-source add --name=pacsds --driver-name=mysql --jndi-name=java:/PacsDS \
--connection-url=jdbc:mysql://127.0.0.1:3306/dcm4chee_pacs?serverTimezone=Asia/Taipei \
--user-name=dcm4chee_local --password=<密碼>

務必要確定提供的資料庫可正常連線,且DB帳號具有該資料庫的完整權限

設定WildFly紀錄

注意! 建議跳過官方文件在Setup WildFly步驟10,改為使用步驟11匯入add-data-source-mysql.cli,藉此來完成資料庫連線資訊的設定,因為步驟10的設定指令有包含在上述的檔案中,若匯入步驟10的設定會導致步驟11出現錯誤

首次於Windows環境安裝時,我就是因為這步驟沒有成功匯入,加上官方文件有寫到Windows環境有不支援的相依套件,因而誤以為無法在Windows環境下部署dcm4chee

其中%DCM4CHEE_ARC%/cli/add-data-source-mysql.cli這個檔案非常關鍵!
請一定要反覆檢查與測試提供的連線資訊是否正確!

因為官網文件的步驟都寫得蠻詳細的,因此我簡單列出以下幾項比較會常用的指令以及需要修改檔案路徑的指令,和關於上述問題在Windows下出現錯誤訊息

  • 啟動WildFly

    ​​​​%WILDFLY_HOME%\bin\standalone.bat -c dcm4chee-arc.xml
    
  • 進入jboss-cli互動模式

    ​​​​%WILDFLY_HOME%\bin\jboss-cli.bat -c
    
  • 匯入資料庫設定資訊(以下路徑的檔案有更改過,需依照自己的檔案位置修改)

    ​​​​%WILDFLY_HOME%\bin\jboss-cli.bat -c --file=C:\Services\dcm4chee\dcm4chee-arc-5.29.1-mysql\cli\add-data-source-mysql.cli
    
  • 更改JBoss管理參數(第14點Enable property replacement in deployment descriptors)

    ​​​​%WILDFLY_HOME%\bin\jboss-cli.bat -c --file=C:\Services\dcm4chee\dcm4chee-arc-5.29.1-mysql\cli\adjust-managed-executor.cli
    
  • 需在jboss-cli互動模式下執行-dcm4chee前端介面

    ​​​​deploy C:\Services\dcm4chee\dcm4chee-arc-5.29.1-mysql\deploy\dcm4chee-arc-ui2-5.29.1.war
    
  • 需在jboss-cli互動模式下執行-dcm4chee後端

    ​​​​deploy C:\Services\dcm4chee\dcm4chee-arc-5.29.1-mysql\deploy\dcm4chee-arc-ear-5.29.1-mysql.ear
    

後端於Windows部署,可能會出現錯誤如下
(此錯誤已證實與資料庫連線有關!
請參考:https://stackoverflow.com/questions/36345377/unable-to-create-requested-service-org-hibernate-engine-jdbc-env-spi-jdbcenviro)

deploy-ear_log-20230201.txt
C:\Windows\system32>%WILDFLY_HOME%\bin\jboss-cli.bat -c
[standalone@localhost:9990 /] deploy C:\Services\dcm4chee\dcm4chee-arc-5.29.1-mysql\deploy\dcm4chee-arc-ear-5.29.1-mysql.ear
{"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" =>
 {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"dcm4chee-arc-ear-5.29.1-mysql.ear#dcm4chee-arc\"" => "org
.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvi
ronment]
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdb
c.env.spi.JdbcEnvironment]
    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect
' not set"}}}}

[standalone@localhost:9990 /]

要設定Address Binding或是Port Forwarding才能正常從外部網址存取

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
小提醒: 不論是透過哪個方法設定,都要再額外設定Windows防火牆的輸出/入規則,外部才能正常存取

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
歡迎贊助筆者一杯或多杯咖啡(Donate)

如果您覺得本篇筆記對您有實質的幫助😊
歡迎考慮贊助在下(LuckyPig)一杯咖啡

If you found this note helpful, it would mean a lot to me (LuckyPig) if you considered buying me a cup of coffee as a way of showing your support and appreciation. Thank you so much! 😊

方法一:更改Wildfly設定檔to bind any address

開啟以下路徑的設定檔:
%WILDFLY_HOME%\standalone\configuration\dcm4chee-arc.xml

找到設定檔中的這段

<interface name="public"> <inet-address value="${jboss.bind.address:127.0.0.1}"/> </interface>

並修改為如下的範例設定

<interface name="public"> <any-address/> </interface>

REF: https://stackoverflow.com/questions/31716540/configuring-wildfly-to-listen-any-address

方法二:以系統管理員權限開啟CMD或Powershell來執行以下指令

netsh interface portproxy show v4tov4 # 用0.0.0.0來允許任何外部連線,亦可指定要綁定的外部ip netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=127.0.0.1 # 8080為dcm4chee WebUI, 11112為傳輸影像的port netsh interface portproxy add v4tov4 listenport=11112 listenaddress=0.0.0.0 connectport=11112 connectaddress=127.0.0.1 netsh interface portproxy show v4tov4 # 缺點:重啟Wildfly時需刪除Port Forwarding設定,才能正常啟動 netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=0.0.0.0 netsh interface portproxy delete v4tov4 listenport=11112 listenaddress=0.0.0.0

REF1: https://youtu.be/ACjlvzw4bVE
REF2: https://stackoverflow.com/questions/11525703/port-forwarding-in-windows


在Ubuntu Desktop Local端使用binary files架設

安裝JDK及MySQL與下載所需安裝包

sudo apt update sudo apt-get update sudo apt install openjdk-17-jdk -y java --version sudo apt-get install mysql-server mysql-client libmysqlclient-dev -y sudo apt-get install net-tools -y sudo netstat -tap | grep mysql sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf # comment this line: bind-address = 127.0.0.1 sudo cat /etc/mysql/debian.cnf # use this command to see your MySQL ACC&PWD mysql -u debian-sys-maint -p # test MySQL login sudo service mysql restart cd ~/Downloads sudo apt install curl -y curl -o wildfly-26.1.2.Final.zip -L https://github.com/wildfly/wildfly/releases/download/26.1.2.Final/wildfly-26.1.2.Final.zip curl -o ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz https://dlcdn.apache.org/directory/studio/2.0.0.v20210717-M17/ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz curl -o dcm4chee-arc-5.29.1-mysql.zip -L https://sourceforge.net/projects/dcm4che/files/dcm4chee-arc-light5/5.29.1/dcm4chee-arc-5.29.1-mysql.zip/download # 上方三行下載DCM4CHEE所需安裝包 tar -xvzf ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz # 解壓縮ApacheDirectoryStudio unzip dcm4chee-arc-5.29.1-mysql.zip unzip wildfly-26.1.2.Final.zip export DCM4CHEE_ARC=/home/user/Downloads/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/home/user/Downloads/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) ~/Downloads/ApacheDirectoryStudio/ApacheDirectoryStudio # Execute ApacheDirectoryStudio

匯入MySQL資料庫(需自行查閱ubuntu內的mysql預設帳號密碼)

sudo cat /etc/mysql/debian.cnf # use this command to see your MySQL ACC&PWD mysql -u debian-sys-maint -p # Enter MySQL PWD mysql> create database dcm4chee_pacs; mysql> grant all PRIVILEGES on dcm4chee_pacs.* to 'debian-sys-maint'@'localhost'; mysql> quit mysql -u debian-sys-maint -p dcm4chee_pacs < $DCM4CHEE_ARC/sql/mysql/create-mysql.sql

安裝OpenLDAP(slapd)與修改預設安裝設定檔

安裝過程中的密碼建議使用官網文件內slapd.conf內所記載的

# 安裝OpenLDAP sudo apt update sudo apt -y install slapd ldap-utils sudo slapcat # 重新設定OpenLDAP,參考:https://magiclen.org/ubuntu-server-ldap/ sudo dpkg-reconfigure slapd # 設定內容如下 # DNS domain name:dcm4che.org # Organization name:dcm4che # 密碼參考官網文件 # MDB -> Ok -> Yes -> Yes sudo slapcat # 查看OpenLDAP的設定資料是否正確 sudo service slapd restart service --status-all # 確定OpenLDAP(slapd)服務已正常啟動

匯入dcm4chee的OpenLDAP設定檔

採用官網文件的dynamic runtime configuration方法

sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dicom.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dcm4che.ldif tr -d \\r < $DCM4CHEE_ARC/ldap/slapd/dcm4chee-archive.ldif | sudo ldapadd -Y EXTERNAL -H ldapi:/// sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dcm4chee-archive-ui.ldif sudo service slapd restart # 完成上方官網文件的那四行後記得重啟OpenLDAP ~/Downloads/ApacheDirectoryStudio/ApacheDirectoryStudio # 執行Apache Directory Studio來匯入剩餘設定檔

Apache Directory Studio連線設定

Network Parameter:
    Hostname: localhost
    Port:     389
Authentication Parameter:
    Bind DN or user: cn=admin,dc=dcm4che,dc=org
    Bind password:   secret
Browser Options:
    Base DN: dc=dcm4che,dc=org

透過Apache Directory Studio匯入其餘設定檔的操作步驟

Install modules and Setup WildFly

export DCM4CHEE_ARC=/home/user/Downloads/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/home/user/Downloads/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) cp -r $DCM4CHEE_ARC/configuration $WILDFLY_HOME/standalone cd $WILDFLY_HOME/standalone/configuration cp standalone.xml dcm4chee-arc.xml cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/dcm4che-jboss-modules-5.29.1.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jai_imageio-jboss-modules-1.2-pre-dr-b04.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jclouds-jboss-modules-2.5.0-noguava.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/ecs-object-client-jboss-modules-3.0.0.zip cd ~/Downloads curl -o keycloak-wildfly-adapter-dist-15.0.0.zip -L https://github.com/keycloak/keycloak/releases/download/15.0.0/keycloak-oidc-wildfly-adapter-15.0.0.zip cd $WILDFLY_HOME unzip ~/Downloads/keycloak-wildfly-adapter-dist-15.0.0.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jdbc-jboss-modules-mysql-8.0.29.zip $WILDFLY_HOME/bin/standalone.sh -c dcm4chee-arc.xml # 驗證JBoss是否順利啟動

New Terminal for configuring JBoss(WildFly)

gedit $DCM4CHEE_ARC/cli/add-data-source-mysql.cli

add-data-source-mysql.cli設定參考

/subsystem=datasources/jdbc-driver=mysql:add(driver-module-name=com.mysql,driver-name=mysql) data-source add --name=pacsds --driver-name=mysql --jndi-name=java:/PacsDS \ --connection-url=jdbc:mysql://localhost:3306/dcm4chee_pacs?serverTimezone=Asia/Taipei \ --user-name=debian-sys-maint --password=<user-password>
MySQL Connection serverTimezone設定參考

把剛設定好的cli檔案匯入並繼續完成其餘WildFly的設定

export DCM4CHEE_ARC=/home/user/Downloads/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/home/user/Downloads/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/add-data-source-mysql.cli $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/adjust-managed-executor.cli $WILDFLY_HOME/bin/jboss-cli.sh -c [standalone@localhost:9990 /] :reload [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/https-listener=https:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] :reload

最後Deploy(部署)Dcm4chee前後端

$WILDFLY_HOME/bin/jboss-cli.sh -c [standalone@localhost:9990 /] deploy $DCM4CHEE_ARC/deploy/dcm4chee-arc-ear-5.29.1-mysql.ear [standalone@localhost:9990 /] deploy $DCM4CHEE_ARC/deploy/dcm4chee-arc-ui2-5.29.1.war

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
歡迎贊助筆者一杯或多杯咖啡(Donate)

如果您覺得本篇筆記對您有實質的幫助😊
歡迎考慮贊助在下(LuckyPig)一杯咖啡

If you found this note helpful, it would mean a lot to me (LuckyPig) if you considered buying me a cup of coffee as a way of showing your support and appreciation. Thank you so much! 😊

可參考官網文件驗證部署狀態的資訊:

Verify that the archive web UI is accessible at http://localhost:8080/dcm4chee-arc/ui2

Undeploy DCM4CHEE Archive Backend and UI at any time using JBoss CLI, e.g.:
$WILDFLY_HOME/bin/jboss-cli.sh -c [standalone@localhost:9990 /] undeploy dcm4chee-arc-ear-5.29.1-psql.ear [standalone@localhost:9990 /] undeploy dcm4chee-arc-ui2-5.29.1.war

更改Wildfly設定檔to bind any address才能正常從外部網址存取

開啟以下路徑的設定檔:
$WILDFLY_HOME\standalone\configuration\dcm4chee-arc.xml

找到設定檔中的這段

<interface name="public"> <inet-address value="${jboss.bind.address:127.0.0.1}"/> </interface>

並修改為如下的範例設定

<interface name="public"> <any-address/> </interface>

REF: https://stackoverflow.com/questions/31716540/configuring-wildfly-to-listen-any-address


在WSL2上架設(MySQL與OpenLDAP安裝在WSL2內部)

推薦使用WSL2(Windows Subsystem for Linux 2)

因為會使用到需要透過GUI應用程式設定的部分(Apache Directory Studio)
而且OpenLDAP只能在WSL2上執行
如果需要把OpenLDAP安裝在WSL內的話,記得要把WSL升級為WSL2

如果想要把MySQL與OpenLDAP安裝在Windows端 (Windows Host)

可以直接參閱本文在WSL(v1)上架設的操作紀錄
(個人實測後發現WSL2無法透過127.0.0.1存取到Windows Host的MySQL與OpenLDAP,需透過虛擬網卡分配的ip存取,我已經把詳細說明附註在WSL(v1)的安裝說明中)

安裝與設定JDK、MySQL、OpenLDAP到啟動Wildfly

sudo apt update sudo apt-get update sudo apt install openjdk-17-jdk -y java --version sudo apt-get install mysql-server mysql-client libmysqlclient-dev -y sudo apt-get install net-tools -y sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf # comment this line: bind-address = 127.0.0.1 sudo service mysql restart sudo netstat -tap | grep mysql sudo cat /etc/mysql/debian.cnf # use this command to see your MySQL ACC&PWD mysql -h 127.0.0.1 -u debian-sys-maint -p # test MySQL login in WSL: https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run mysql> exit cd /mnt/c sudo mkdir Services cd Services sudo mkdir dcm4chee-wsl cd dcm4chee-wsl sudo apt install curl -y curl -o wildfly-26.1.2.Final.zip -L https://github.com/wildfly/wildfly/releases/download/26.1.2.Final/wildfly-26.1.2.Final.zip curl -o ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz https://dlcdn.apache.org/directory/studio/2.0.0.v20210717-M17/ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz curl -o dcm4chee-arc-5.29.1-mysql.zip -L https://sourceforge.net/projects/dcm4che/files/dcm4chee-arc-light5/5.29.1/dcm4chee-arc-5.29.1-mysql.zip/download # 上方三行下載DCM4CHEE所需安裝包 tar -xvzf ApacheDirectoryStudio-2.0.0.v20210717-M17-linux.gtk.x86_64.tar.gz # 解壓縮ApacheDirectoryStudio sudo apt install unzip -y unzip dcm4chee-arc-5.29.1-mysql.zip unzip wildfly-26.1.2.Final.zip export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) /mnt/c/Services/dcm4chee-wsl/ApacheDirectoryStudio/ApacheDirectoryStudio # Execute ApacheDirectoryStudio sudo cat /etc/mysql/debian.cnf # use this command to see your MySQL ACC&PWD mysql -h 127.0.0.1 -u debian-sys-maint -p # Enter MySQL PWD mysql> create database dcm4chee_pacs; mysql> grant all PRIVILEGES on dcm4chee_pacs.* to 'debian-sys-maint'@'localhost'; mysql> quit sudo service mysql restart mysql -h 127.0.0.1 -u debian-sys-maint -p dcm4chee_pacs < $DCM4CHEE_ARC/sql/mysql/create-mysql.sql # 安裝OpenLDAP sudo apt update sudo apt -y install slapd ldap-utils sudo slapcat # 重新設定OpenLDAP,參考:https://magiclen.org/ubuntu-server-ldap/ sudo dpkg-reconfigure slapd # 設定內容如下 # DNS domain name:dcm4che.org # Organization name:dcm4che # 密碼參考官網文件 # MDB -> Ok -> Yes -> Yes sudo slapcat # 查看OpenLDAP的設定資料是否正確 sudo service slapd restart service --status-all # 確定OpenLDAP(slapd)服務已正常啟動 # WSL的service顯示好像有異常,可略過 sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dicom.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dcm4che.ldif tr -d \\r < $DCM4CHEE_ARC/ldap/slapd/dcm4chee-archive.ldif | sudo ldapadd -Y EXTERNAL -H ldapi:/// sudo ldapadd -Y EXTERNAL -H ldapi:/// -f $DCM4CHEE_ARC/ldap/slapd/dcm4chee-archive-ui.ldif sudo service slapd restart # 執行Apache Directory Studio來匯入剩餘設定檔 /mnt/c/Services/dcm4chee-wsl/ApacheDirectoryStudio/ApacheDirectoryStudio # ------------------ # Network Parameter: # Hostname: localhost # Port: 389 # Authentication Parameter: # Bind DN or user: cn=admin,dc=dcm4che,dc=org # Bind password: secret # Browser Options: # Base DN: dc=dcm4che,dc=org # 透過Apache Directory Studio匯入其餘設定檔的操作步驟: # https://hackmd.io/@LuckyPig/dcm4chee-install-note#導入dcm4chee預設LDAP設定檔紀錄 # ------------------ cp -r $DCM4CHEE_ARC/configuration $WILDFLY_HOME/standalone cd $WILDFLY_HOME/standalone/configuration cp standalone.xml dcm4chee-arc.xml cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/dcm4che-jboss-modules-5.29.1.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jai_imageio-jboss-modules-1.2-pre-dr-b04.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jclouds-jboss-modules-2.5.0-noguava.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/ecs-object-client-jboss-modules-3.0.0.zip cd /mnt/c/Services/dcm4chee-wsl curl -o keycloak-wildfly-adapter-dist-15.0.0.zip -L https://github.com/keycloak/keycloak/releases/download/15.0.0/keycloak-oidc-wildfly-adapter-15.0.0.zip cd $WILDFLY_HOME unzip /mnt/c/Services/dcm4chee-wsl/keycloak-wildfly-adapter-dist-15.0.0.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jdbc-jboss-modules-mysql-8.0.29.zip $WILDFLY_HOME/bin/standalone.sh -c dcm4chee-arc.xml # 驗證JBoss是否順利啟動

開啟新的WSL Terminal修改要匯入dcm4chee Wildfly的設定檔

export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) gedit $DCM4CHEE_ARC/cli/add-data-source-mysql.cli

add-data-source-mysql.cli設定參考(連線到WSL內安裝的mysql)

/subsystem=datasources/jdbc-driver=mysql:add(driver-module-name=com.mysql,driver-name=mysql)
data-source add --name=pacsds --driver-name=mysql --jndi-name=java:/PacsDS \
--connection-url=jdbc:mysql://127.0.0.1:3306/dcm4chee_pacs?serverTimezone=Asia/Taipei \
--user-name=debian-sys-maint --password=<user-password>

接續新開啟的WSL設定JBoss(WildFly)與Deploy(部署)Dcm4chee前後端

export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/add-data-source-mysql.cli $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/adjust-managed-executor.cli $WILDFLY_HOME/bin/jboss-cli.sh -c [standalone@localhost:9990 /] :reload [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/https-listener=https:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] :reload # 最後Deploy(部署)Dcm4chee前後端 [standalone@localhost:9990 /] deploy /mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql/deploy/dcm4chee-arc-ear-5.29.1-mysql.ear [standalone@localhost:9990 /] deploy /mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql/deploy/dcm4chee-arc-ui2-5.29.1.war

最後於Windows瀏覽器上驗證Dcm4chee安裝結果

Verify that the archive web UI is accessible at
http://localhost:8080/dcm4chee-arc/ui2

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
歡迎贊助筆者一杯或多杯咖啡(Donate)

如果您覺得本篇筆記對您有實質的幫助😊
歡迎考慮贊助在下(LuckyPig)一杯咖啡

If you found this note helpful, it would mean a lot to me (LuckyPig) if you considered buying me a cup of coffee as a way of showing your support and appreciation. Thank you so much! 😊

可參考官網文件驗證部署狀態的資訊:

Undeploy DCM4CHEE Archive Backend and UI at any time using JBoss CLI, e.g.:
$WILDFLY_HOME/bin/jboss-cli.sh -c
[standalone@localhost:9990 /] undeploy dcm4chee-arc-ear-5.29.1-psql.ear
[standalone@localhost:9990 /] undeploy dcm4chee-arc-ui2-5.29.1.war

可以撰寫shell script方便啟動dcm4chee(執行WildFly)

cd /mnt/c/Services/dcm4chee-wsl touch startDcm4chee.sh touch startDcm4chee.bat

startDcm4chee.sh

echo Starting DCM4CHEE via WILDFLY...... /mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final/bin/standalone.sh -c dcm4chee-arc.xml # 根據實際安裝路徑更改啟動指令

startDcm4chee.bat

wsl.exe sudo service mysql start wsl.exe sudo service slapd start REM WSL的內部服務無法在開機時自行啟動 REM https://superuser.com/questions/1343558/how-to-make-wsl-run-services-at-startup wsl.exe ./startDcm4chee.sh REM https://learn.microsoft.com/en-us/windows/wsl/filesystems#run-linux-tools-from-a-windows-command-line

在Terminal中Ctrl+C即可正常關閉dcm4chee

需等待Wildfly關閉的指令順利執行完畢,跳回正常的console才可關閉視窗

WSL2透過外部ip存取wsl內部架設的DCM4CHEE(Port Forwarding)

請使用Windows Powershell來完成以下設定

# REF: https://youtu.be/ACjlvzw4bVE netsh interface portproxy show v4tov4 netsh interface portproxy add v4tov4 listenport=8080 listenaddress=192.168.1.165 connectport=8080 connectaddress=$($(wsl hostname -I).Trim()); # 經實測後發現WSL2要forward是127.0.0.1而不是WSL網卡的ip netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=127.0.0.1 # 大神奇啦! 這樣設定就通了! netsh interface portproxy add v4tov4 listenport=11112 listenaddress=0.0.0.0 connectport=11112 connectaddress=127.0.0.1 netsh interface portproxy show v4tov4

REF: https://youtu.be/ACjlvzw4bVE

刪除WSL Port Forwarding設定

REF: https://stackoverflow.com/questions/11525703/port-forwarding-in-windows


在WSL(v1)上架設(使用Windows Host的XAMPP MySQL與OpenLDAP)

實測後也可以透過WSL(v1)安裝

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

安裝在WSL(v1),僅有Wildfly會安裝在WSL內部
(MySQL也可以安裝在WSL1內,但我在Windows上有安裝XAMPP因此直接用即可)

安裝JDK及MySQL連線工具、下載Dcm4chee安裝包與執行Wildfly

sudo apt update sudo apt-get update sudo apt install openjdk-17-jdk -y java --version # 已經在wsl內安裝mysql-server可以參考下文完整移除mysql # https://noob.tw/remove-mysql-completely/ # 移除wsl內的mysql-server再安裝mysql-client連線windows的mysql sudo apt-get install mysql-client -y # 使用Windows XAMPP的 mysql,因此只安裝mysql-client sudo apt-get install net-tools -y mysql -h 127.0.0.1 -u root -p mysql> exit cd /mnt/c sudo mkdir Services cd Services sudo mkdir dcm4chee-wsl cd dcm4chee-wsl sudo apt install curl -y curl -o wildfly-26.1.2.Final.zip -L https://github.com/wildfly/wildfly/releases/download/26.1.2.Final/wildfly-26.1.2.Final.zip curl -o dcm4chee-arc-5.29.1-mysql.zip -L https://sourceforge.net/projects/dcm4che/files/dcm4chee-arc-light5/5.29.1/dcm4chee-arc-5.29.1-mysql.zip/download # 上方兩行下載DCM4CHEE所需安裝包 sudo apt install unzip -y unzip dcm4chee-arc-5.29.1-mysql.zip unzip wildfly-26.1.2.Final.zip export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) # 需自行下載Windows版的ApacheDirectoryStudio # https://directory.apache.org/studio/download/download-windows.html # 自行透過Windows XAMPP查看預設mysql帳密(通常是root) mysql -h 127.0.0.1 -u root mysql> create database dcm4chee_pacs; mysql> grant all PRIVILEGES on dcm4chee_pacs.* to 'root'@'localhost'; mysql> quit # 建議到Windows上的XAMPP重啟mysql mysql -h 127.0.0.1 -u root dcm4chee_pacs < $DCM4CHEE_ARC/sql/mysql/create-mysql.sql # 在Windows上安裝OpenLDAP # https://hackmd.io/@LuckyPig/dcm4chee-install-note#OpenLDAP-Server架設紀錄 # 在Windows上執行Apache Directory Studio來匯入剩餘設定檔 # https://hackmd.io/@LuckyPig/dcm4chee-install-note#導入dcm4chee預設LDAP設定檔紀錄 # ------------------ # Network Parameter: # Hostname: localhost # Port: 389 # Authentication Parameter: # Bind DN or user: cn=admin,dc=dcm4che,dc=org # Bind password: secret # Browser Options: # Base DN: dc=dcm4che,dc=org # ------------------ export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) cp -r $DCM4CHEE_ARC/configuration $WILDFLY_HOME/standalone cd $WILDFLY_HOME/standalone/configuration cp standalone.xml dcm4chee-arc.xml cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/dcm4che-jboss-modules-5.29.1.zip unzip $DCM4CHEE_ARC/jboss-modules/jai_imageio-jboss-modules-1.2-pre-dr-b04.zip unzip $DCM4CHEE_ARC/jboss-modules/jclouds-jboss-modules-2.5.0-noguava.zip unzip $DCM4CHEE_ARC/jboss-modules/ecs-object-client-jboss-modules-3.0.0.zip cd /mnt/c/Services/dcm4chee-wsl curl -o keycloak-wildfly-adapter-dist-15.0.0.zip -L https://github.com/keycloak/keycloak/releases/download/15.0.0/keycloak-oidc-wildfly-adapter-15.0.0.zip cd $WILDFLY_HOME unzip /mnt/c/Services/dcm4chee-wsl/keycloak-wildfly-adapter-dist-15.0.0.zip cd $WILDFLY_HOME unzip $DCM4CHEE_ARC/jboss-modules/jdbc-jboss-modules-mysql-8.0.29.zip $WILDFLY_HOME/bin/standalone.sh -c dcm4chee-arc.xml # 驗證JBoss是否順利啟動

WSL2如果要使用Windows Host的MySQL或OpenLDAP記得查閱WSL虛擬網卡所配發的ip

WSL2要用Windows Host的OpenLDAP記得修改以下設定檔

$DCM4CHEE_ARC/configuration/dcm4chee-arc/ldap.properties

修改完後記得重新執行以下複製設定檔的指令

cp -r $DCM4CHEE_ARC/configuration $WILDFLY_HOME/standalone

然後要記得重啟WILDFLY 再接續後面的安裝步驟

到Windows檔案總管修改要匯入dcm4chee Wildfly的設定檔

C:\Services\dcm4chee-wsl\dcm4chee-arc-5.29.1-mysql\cli\

add-data-source-mysql.cli設定參考(連線到Windows XAMPP mysql)

/subsystem=datasources/jdbc-driver=mysql:add(driver-module-name=com.mysql,driver-name=mysql)
data-source add --name=pacsds --driver-name=mysql --jndi-name=java:/PacsDS \
--connection-url=jdbc:mysql://127.0.0.1:3306/dcm4chee_pacs?serverTimezone=Asia/Taipei \
--user-name=root --password=<user-password>

WSL2記得將MySQL連線改為虛擬網卡的ip

開啟新的WSL terminal設定WildFly與部署Dcm4chee前後端

export DCM4CHEE_ARC=/mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql # 設定環境變數$DCM4CHEE_ARC(根據安裝包解壓後的實際路徑設定) export WILDFLY_HOME=/mnt/c/Services/dcm4chee-wsl/wildfly-26.1.2.Final # 設定環境變數$WILDFLY_HOME(根據安裝包解壓後的實際路徑設定) $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/add-data-source-mysql.cli $WILDFLY_HOME/bin/jboss-cli.sh -c --file=$DCM4CHEE_ARC/cli/adjust-managed-executor.cli $WILDFLY_HOME/bin/jboss-cli.sh -c [standalone@localhost:9990 /] :reload [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/https-listener=https:write-attribute(name=max-post-size,value=10000000000) [standalone@localhost:9990 /] :reload # 最後Deploy(部署)Dcm4chee前後端 [standalone@localhost:9990 /] deploy /mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql/deploy/dcm4chee-arc-ear-5.29.1-mysql.ear [standalone@localhost:9990 /] deploy /mnt/c/Services/dcm4chee-wsl/dcm4chee-arc-5.29.1-mysql/deploy/dcm4chee-arc-ui2-5.29.1.war

驗證安裝結果與建立啟動捷徑

請參閱WSL2安裝筆記的後續說明


Dicom影像傳輸測試工具-DCMTK

DCMTK官方安裝手冊

Cmake could not find any instance of visual studio解決方法

也可以下載別人build好的可執行檔(zip)

或是透過Chocolatey安裝 dicom.offis.de 建置好的DCMTK

確定Chocolatey安裝好後即可透過以下指令安裝DCMTK

choco install dcmtk

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
歡迎贊助筆者一杯或多杯咖啡(Donate)

如果您覺得本篇筆記對您有實質的幫助😊
歡迎考慮贊助在下(LuckyPig)一杯咖啡

If you found this note helpful, it would mean a lot to me (LuckyPig) if you considered buying me a cup of coffee as a way of showing your support and appreciation. Thank you so much! 😊

DCMTK官方dicom影像傳輸指引

連中岳老師解說:
要手動上傳DICOM影像,可於cmd執行
dcmsend -v +sd +r -aet XXSCU -aec DCM4CHEE 127.0.0.1 11112 {DICOM檔目錄}

dcmsend -v +sd +r -aet XXSCU -aec ORTHANC 127.0.0.1 4242 {DICOM檔目錄}
(https://book.orthanc-server.com/users/cookbook.html)

自行實測結果:(從Windows10傳送到WSL2)
dcmsend -v +sd +r -aec DCM4CHEE 127.0.0.1 11112 {DICOM檔目錄}
省略-aet參數亦可正常傳輸dicom影像


Bluelight連接DCM4CHEE設定

DCM4CHEE Restful API

Bluelight Dicom Viewer Github

Bluelight config files

我的%bluelight%/search/data/config.json

{ "DICOMWebServersConfig": [ { "AETitle": "DCM4CHEE", "enableHTTPS": false, "hostname": "10.40.8.124", "PORT": 8080, "contentType": "application/json", "timeout": 80000, "charset": "UTF=8", "QIDO": "dcm4chee-arc/aets/DCM4CHEE/rs", "WADO": "dcm4chee-arc/aets/DCM4CHEE/rs", "STOW": "dcm4chee-arc/aets/DCM4CHEE/rs", "enableRetrieveURI": false, "includefield": false, "target": "../../bluelight/html/start.html", "target-SM": "../../bluelight/html/start.html", "token": { "apikey": "", "bearer": "" } } ], "//_thumnail_witdth": "縮圖寬度", "thumnail_witdth": 70, "//_study_comparison": "進片模式", "study_comparison": false }

我的%bluelight%/bluelight/data/config.json

Special Thanks
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 嘉笙學長
  • 沁霖學長
{ "DICOMWebServersConfig": [ { "AETitle": "DCM4CHEE", "QIDO-enableHTTPS": false, "WADO-enableHTTPS": false, "QIDO-hostname": "10.40.8.124", "WADO-hostname": "10.40.8.124", "QIDO-PORT": 8080, "WADO-PORT": 8080, "contentType": "application/json", "timeout": 80000, "charset": "UTF=8", "QIDO": "dcm4chee-arc/aets/DCM4CHEE/rs", "WADO-URI": "api/wado", "WADO-RS": "dcm4chee-arc/aets/DCM4CHEE/rs", "WADO-RS/URI": "RS", "DICOM/JPEG": "JPEG", "STOW": "stow", "enableRetrieveURI": false, "includefield": false, "enableXml2Dcm": false, "Xml2DcmUrl": "/upload", "target": "http://10.40.8.124:8080/", "target_wsi": "bluelight/bluelight/html/start.html", "token": { "apikey": "", "bearer": "" } } ], "//_thumnail_witdth": "縮圖寬度", "thumnail_witdth": 70, "//_study_comparison": "進片模式", "study_comparison": false }