Setting up WSL2 as a deployment target

<< 点击显示目录 >>

主页  exOS使用助手 > exOS Automation Help > Development > Windows Subsystem for Linux (WSL) >

Setting up WSL2 as a deployment target

资源库 https://github.com/br-automation-com/exOS-WSL 提供了现成的部署目标-WSL 映像,可以开箱即用。

如果需要手动设置新的 WSL 系统,以下信息提供了安装部署目标-WSL 的步骤。


如果系统中安装了 WSL2,则可以激活 systemd (运行 exos-server 时需要)并将 WSL2 用作 ARsim 的部署目标。

 

重要提示:在这种情况下(exOSOPCUA部署服务器在标准OPCUA端口的WSL2-localhost上运行),需要重新配置AROPCUA服务器的端口,以确保成功启动ARSim系统。

AROPCUAServer

可以使用systemd-genie启用systemd。所有说明都在这里 : https://github.com/arkane-systems/genie

 

Debian 10 Buster 的简短操作方法:

需要 dotnet-runtime-5.0

(更详细的说明请点击此处:

https://docs.microsoft.com/en-us/dotnet/core/install/linux)

 

将 Microsoft 软件包签名密钥添加到可信密钥列表,并添加软件包存储库。

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

 

安装 .NET runtime:

sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update & & (安装
sudo apt-get install -y aspnetcore-runtime-6.0

 

要安装 systemd-genie,请添加 wsl-translinux 软件源:

sudo wget -O /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg
sudo chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg

 

在 /etc/apt/sources.list.d/wsl-transdebian.list 中添加以下内容

deb https://arkane-systems.github.io/wsl-transdebian/apt/ buster main
deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ buster main

 

然后安装

sudo apt update
sudo apt install -y systemd-genie

 

测试是否正常运行

genie -i

 

注意:必须在每次重启时运行。

安装 exos-server,  更多信息请参阅 安装 exOS 服务器

使用 WSL 时,无需考虑管理程序和将软件包传输到目标的问题。这些命令就足够了:

cd /mnt/c/BrAutomation/AS410/AS/TechnologyPackages/exosTechnology/2.0.0/Modules/Server
sudo dpkg -i exos-server-2.0.0-1_amd64.deb

请注意,AS 路径和文件名包括当前的版本号,因此会随不同版本的 AS 和 exOS 而变化。

 

只要 WSL 与 ARSim 在同一台计算机上运行,AS 中的默认模拟 IP 地址/主机名设置就会生效。


The repository https://github.com/br-automation-com/exOS-WSL offers a ready-made deployment-target-WSL image that can be used out-of-the-box.

Should it however be necessary to set up a new WSL system manually, the following information provides steps to install a deployment-target-WSL.


If you have WSL2 installed in your system, it is possible to activate systemd (which is required to run the exos-server) and use your WSL2 as a deployment target for ARsim.

Important: In this case (having the exOS OPCUA deployment server running on WSL2-localhost on the standard OPCUA port), the port of the AR OPCUA server needs to be reconfigured, in order to ensure a successful boot of the ARSim system.

AROPCUAServer

systemd can be enabled using systemd-genie. All instructions are here: https://github.com/arkane-systems/genie

 

A short howto for Debian 10 buster:

dotnet-runtime-5.0 is required

(more thorough instructions can be found here:

  https://docs.microsoft.com/en-us/dotnet/core/install/linux)

Add the Microsoft package signing key to your list of trusted keys and add the package repository.

  wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
  sudo dpkg -i packages-microsoft-prod.deb
  rm packages-microsoft-prod.deb

Install .NET runtime:

  sudo apt-get update; \
      sudo apt-get install -y apt-transport-https && \
      sudo apt-get update && \
      sudo apt-get install -y aspnetcore-runtime-6.0

To install systemd-genie, add the wsl-translinux repository:

  sudo wget -O /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg
  sudo chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg

Add these lines to /etc/apt/sources.list.d/wsl-transdebian.list

  deb https://arkane-systems.github.io/wsl-transdebian/apt/ buster main
  deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ buster main

And install

  sudo apt update
  sudo apt install -y systemd-genie

Test if it works:

  genie -i

Note: this must be run at every reboot.

Install exos-server, see Installing the exOS Server for more information.

When using WSL it is not necessary to consider the points on hypervisor and transferring the package to the target. These commands are enough:

  cd /mnt/c/BrAutomation/AS410/AS/TechnologyPackages/exosTechnology/2.0.0/Modules/Server
  sudo dpkg -i exos-server-2.0.0-1_amd64.deb

Please note that the AS path and filename includes current version numbers and therefore varies with each version of AS and exOS.

As long as WSL is running on the same computer as ARSim, the default Simulation IP address/hostname setting in AS will work.