Set Up Linux Target Computer
R2026bUse 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 Machine | Windows 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.
For more information about WSL installation, see https://learn.microsoft.com/en-us/windows/wsl/install. | ARM64 processor based Linux machine.
|
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:
Ensure the machine meets all the requirements listed in Target Computer Requirements.
Ensure the SSH server is running and accepts local connections. Use
127.0.0.1as the target IP when verifying SSH connectivity. For steps to verify and start the SSH server, see Target Computer Requirements.When configuring the target in the Linux Runtime Manager or by using
addTarget, specify the following:Target IP address —
127.0.0.1Username and password — Your Linux user credentials for the same machine.
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
zipandunzip.Run an SSH server. Verify that the SSH server is running on the target computer:
sudo systemctl status sshIf the SSH server is not running, start it:
sudo systemctl start sshVerify that you can connect to the target over SSH:
ssh username@target-ipEnsure 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.jsonfile.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.
Open
/etc/ssh/sshd_configwith a text editor.Keep the existing
Port 22line. Add a new line such asPort.portnumberSave 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
setSSHPortfunction 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.
Open the Linux Runtime Manager.
linuxRuntimeManager
In the Targets Tree pane, select Target Computers and click plus button to add a target computer.
In Target Configuration section, enter details for the target computer.
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.
Select a target computer, then use Linux Target > Connect To Target section to connect, disconnect, or update it.
Use
uninstallTargetfunction to remove a target computer's files and its storage.Use the
removeTargetfunction 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
linux.Targets | addTarget | connect | disconnect | updateTarget | setDeploymentLocation