To begin, establish an SSH connection to your Alibaba Cloud Linux server. You will be prompted for a password. Authentication failures typically result from incorrect username or password entries.
2. Upload MATLAB Installation Files
- Upload the MATLAB installation package to your server. This process can be time-consuming, potentially taking several hours depending on your network speed. Using an SFTP client, select the downloaded file and initiate the upload. My observed transfer rate was approximately 7 MB/s.
3. Mount the MATLAB ISO Files
3.1 Single Mount (For Single ISO)
Since the downloaded MATLAB package might be split into multiple ISO files, a single mount operation may not be sufficient. Here's how to handle a single ISO:
Create a directory to mount the ISO:
mkdir ~/matlab
Mount the ISO file:
sudo mount -o loop Matlab911R2021b_Lin64.iso ~/matlab
Navigate to the mounted directory and start the installer:
cd ~/matlab
sudo ./install
Install MATLAB support packages:
sudo apt install matlab-support
Note: apt is for Debian/Ubuntu systems. Use yum for Red Hat/CentOS.
3.2 Multiple Mounts (For Two ISOs)
First, ensure the first MATLAB DVD is mounted to /mnt/iso:
sudo mount -t auto -o loop R2018a_glnxa64_dvd1.iso /mnt/iso
Extract the crack files, which contain the license key. The key is usually found in a readme.txt file within the extracted archive. For this example, we'll extract to the current directory (e.g., root):
cd ~
sudo mkdir Crack
cd ~
tar -xvf Matlab20XXaLinux64Crack.tar.gz -C Crack
Initiate the silent installation using the license key. If you encounter an X11 display error, you can try setting the DISPLAY environment variable as a workaround:
cd /mnt
./iso/install -mode silent -agreeToLicense yes -fileInstallationKey 1111-1111-1111-1111
Note: A static installation is required, and you must input the license key.
Keep the first SSH session open. Open a new SSH session to handle the second DVD.
Mount the second DVD:
cd ~
sudo mount -t auto -o loop R2018a_glnxa64_dvd2.iso /mnt/iso
Wait for the first installation to complete.
3. Applying the Crack
3.1 Copy Crack Files
Copy the license_standalone.lic file and the R2018a directory from the crack folder to the MATLAB installation directory:
cd ~/Crack
sudo cp license_standalone.lic /usr/local/MATLAB/R2018a/licenses
cd ~/Crack
sudo cp -r R2018a /usr/local/MATLAB
3.2 Create a Symbolic Link
Create a symbolic link in /usr/local/bin to launch MATLAB:
cd /usr/local/bin
ln -s /usr/local/MATLAB/R2018a/bin/matlab matlab
3.3 Unmount and Clean Up
Unmount the ISO and remove the mount directory:
umount /mnt/iso
cd /mnt
rmdir iso
3.4 Set Environment Variables
Add MATLAB to your system's PATH:
export PATH=/usr/local/MATLAB/R2018a/bin:$PATH
If you encounter graphical interface errors due to the absence of a display, you can try setting the DISPLAY variable. However, for headless operation, this might not be necessary:
export DISPLAY=:0.0
- Running Your First MATLAB Program
4.1 Output a Value
MATLAB supports live scripts, similar to Python's interactive environments. You can directly output values:
disp('Hello, MATLAB on Alibaba Cloud!');
4.2 Run a .m File (No Parameters)
Create a simple script, for example, my_script.m:
% my_script.m
result = 2 + 2;
disp(['The result is: ', num2str(result)]);
Run the script from the command line:
matlab -nodisplay -nosplash -nodesktop -r "run('my_script.m'); exit;"