1. Home
  2. SureMDM
  3. Linux Management
  4. How to update SureMDM agent on Linux devices.

How to update SureMDM agent on Linux devices.

KB ID: 42G2012868
Views: 1010
Updated: September 2022

Updated versions of products have new features and improvised performance and it is always preferred to have the latest version of the product installed on the device. Better if this could be done remotely. SureMDM provides this feature on Linux devices. 
Please follow the below-mentioned steps to update the SureMDM agent on Linux devices. 


1. Log into SureMDM Console.

2. Click on Jobs and Navigate to New Job.

3. Select the OS as Linux.

4. Click on Run Script jobs

5. Enter the Job name and below script in the script section.



if [ "$EUID" -ne 0 ]
  then echo "Permission denied. Please run as root."
  exit 126

if [ ! -f "/usr/share/java/nix/nix.jar" ]; then
    echo "Cannot find existing nix @ /usr/share/java/nix/nix.jar"
    echo "Nothing to upgrade. Exiting..."
    exit 1

rm nix.tar.gz*
rm -rf ./nix

if [ -z "$1" ]; then
    wget $1

if [ ! -f "nix.tar.gz" ]; then
    echo "Cannot Download Nix package. Please check your Internet connection or download URL."
    echo "Exiting"
    exit 1

tar -xvzf nix.tar.gz*

# Backup Existing Nix Installation in-case something goes wrong - 
BACKUP_FILE=$HOME"/nix_backup_date_"$(date '+%d%b%Y_%H%M%S')".tar.gz"
echo "Backing up to $BACKUP_FILE"
tar -zcvf $BACKUP_FILE /usr/share/java/nix/

if [ -f "$BACKUP_FILE" ]; then
	echo "Nix backup location: $BACKUP_FILE"
    echo "Could not create backup file $BACKUP_FILE. Exiting..."
    exit 1



echo "Upgrade Complete"

Note: Ensure the script has the proper downloadable link to the latest version of SureMDM Agent for Linux.

6. Save the job and apply it to the device in the device grid.

This will upgrade the SureMDM Agent for Linux to the latest version on the device. 

Note:  If an admin is using advanced settings in the Run-script screen, below are the values to be entered for the requested parameters. 

  • File Name: tar -xvzf nix.tar.gz
  • Default path: Admin can enter the path where the older version of the SureMDM agent is copied on the device. This is optional. 
  • Permission: Admin can enter 777 to grant permissions to the SureMDM agent for all the necessary permissions. This is optional.

For more details on SureMDM Linux, click here.
For more details on our products, click here
If you need further assistance, please submit a ticket here   

Related Articles