Main Content

Set Up Linux Target Computer

R2026b

Use Embedded Coder® Support Package for Service-Oriented Applications on Linux® to deploy, manage, and instrument service-oriented applications on one or more target computers.

Supported Target Types

Choose one of these target environments. If your host machine runs Linux, you can also use the same machine as both host and target. For more information, see Use Host Machine as Target (Linux-to-Linux Localhost).

Linux x86_64 MachineWindows Subsystem for Linux (WSL2)Linux ARM64 Machine

Any Linux machine with x86_64 architecture that supports MATLAB® installation.

For more information about MATLAB system requirements, see https://in.mathworks.com/support/requirements/matlab-linux.html.

Windows Subsystem for Linux installed on a Windows machine.
  • WSL version 2 is required.

  • WSL Linux distros with minimum versions: Ubuntu 18.04/Debian 11/Oracle Linux_7_9 are required.

  • WSL target should be on the same Windows host machine.

For more information about WSL installation, see https://learn.microsoft.com/en-us/windows/wsl/install.

ARM64 processor based Linux machine.
  • Minimum 2GB RAM and 2GB non-volatile free disk storage is required.

  • ARMv8-A or ARMv9-A architecture is required.

  • Linux Kernel version 3.10 or higher is required.

Use Host Machine as Target (Linux-to-Linux Localhost)

If you are running MATLAB on a Linux machine and do not have a separate target computer, you can use the same machine as both the host and the target. In this configuration, the support package deploys applications to a Docker container running on the same machine.

To set up the host machine as a target:

  1. Ensure the machine meets all the requirements listed in Target Computer Requirements.

  2. Ensure the SSH server is running and accepts local connections. Use 127.0.0.1 as the target IP when verifying SSH connectivity. For steps to verify and start the SSH server, see Target Computer Requirements.

  3. When configuring the target in the Linux Runtime Manager or by using addTarget, specify the following:

    • Target IP address — 127.0.0.1

    • Username and password — Your Linux user credentials for the same machine.

  4. Set a deployment location that is not a temporary folder, because the system may clear temporary folders during a restart.

    setDeploymentLocation(tg,"/home/username/deploy");

Note

In this configuration, Docker runs on the same machine as MATLAB. Ensure the machine has sufficient resources (CPU, memory, and disk space) to run both MATLAB and the deployed applications simultaneously.

Target Computer Requirements

On the target computer, complete the following prerequisites to deploy service-oriented applications by using the support package.

  • Install Docker 20.10 or later.

  • Install zip and unzip.

  • Run an SSH server. Verify that the SSH server is running on the target computer:

    sudo systemctl status ssh

    If the SSH server is not running, start it:

    sudo systemctl start ssh

    Verify that you can connect to the target over SSH:

    ssh username@target-ip

  • Ensure the target computer user has permission to run Docker commands. For more information, see https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user.

Configure Network Ports

  • The support package uses ports 5555 and 5556 on the target computer for host communication by default.

  • To use different ports, edit <Support-Package-root>/toolbox/coder/linux/host/ContainerConfig.json file.

    Get the support package root by using the command

    matlabshared.supportpkg.getSupportPackageRoot

  • The support package reserves port 22255 on the target, so do not configure that port.

Change Default SSH Port

  • The support package uses port 22 for host communication by default. To use a different port, follow these steps on the target computer.

    1. Open /etc/ssh/sshd_config with a text editor.

    2. Keep the existing Port 22 line. Add a new line such as Port portnumber.

    3. Save the file and restart the SSH daemon.

      systemctl restart sshd

  • After successful restart, the SSH daemon listens on port 22 and on the new port (for example, 22345).

  • On the host computer, use setSSHPort function to set the new port.

Configure a Target Computer

You can use the Linux Runtime Manager application or the linux.Targets object functions to connect, disconnect, add, remove, and update a target computer.

  1. Open the Linux Runtime Manager.

    linuxRuntimeManager

  2. In the Targets Tree pane, select Target Computers and click plus button to add a target computer.

  3. In Target Configuration section, enter details for the target computer.

  4. Enter the full deployment‑location path for the newly added target computer using this command.

    setDeploymentLocation(tg,DeploymentLocation);

    Avoid using temporary folders as the deployment location because the system may clear them during a restart. For WSL targets, specify a deployment location inside the WSL Linux file system.

  5. Select a target computer, then use Linux Target > Connect To Target section to connect, disconnect, or update it.

  6. Use uninstallTarget function to remove a target computer's files and its storage.

  7. Use the removeTarget function or select the target computer and click delete icon to remove it from the Targets Tree. This removes the target computer from the Targets Tree. The applications deployed to the target computer and its Docker image remain in storage.

To deploy DDS applications configured with RTI Connext vendor, set the value of environment variable NDDSHOME_LINUX on host to the RTI Connext software folder path on the target machine.

setenv('NDDSHOME_LINUX', 'RTISoftwarePath')
% For example if the software path is "/home/user/RTIDDS/glnxa64/rti_connext_dds-6.0.1_gcc7.3.0"
setenv('NDDSHOME_LINUX', '/home/user/RTIDDS/glnxa64/rti_connext_dds-6.0.1_gcc7.3.0')

For more information about using RTI Connext with DDS Blockset, see RTI Connext® DDS connectivity framework for DDS Blockset - File Exchange.

See Also

| | | | |

Topics