Skip to main content

Snap

This guide walks you through installing and configuring the ShellHub Agent as a Snap Package. Using Snap provides a straightforward way to install and manage the ShellHub Agent on devices, connecting them for remote management via ShellHub.

Prerequisites

  • Snap Package Manager Installed: Ensure Snap is installed and available on your device.
  • ShellHub Access: A valid tenant ID for your ShellHub Cloud or self-hosted instance.

Step 1: Installing the ShellHub Agent

The ShellHub Agent is available on the Snap Store. To install, run:

sudo snap install --classic shellhub
info

By default, the ShellHub Agent is configured to use ShellHub Cloud (https://cloud.shellhub.io), allowing for quick setup without needing a self-hosted instance. You only need to set the tenant-id to connect the device to your ShellHub Cloud namespace.

Step 2: Viewing ShellHub Agent Configuration

To view the current configuration of the ShellHub Agent, use:

snap get shellhub

This command displays the current settings, showing key configuration details such as the private key path, server address, and tenant ID.

By default, should display these keys and values:

KeyValue
private-key/etc/shellhub.key
server-addresshttps://cloud.shellhub.io
tenant-id
preferred-hostname

Step 3: Setting Configuration Options

You can configure the ShellHub Agent using the snap set command. Update settings by replacing <key> and <value> with your desired configurations:

sudo snap set shellhub <key>=<value>

Key Configuration Options:

  • private-key: Path to the private key for ShellHub Agent.
  • server-address: Address of the ShellHub server (default: https://cloud.shellhub.io).
  • tenant-id: Tenant ID associated with your ShellHub namespace.

Example Configuration

To set the tenant ID and a custom server address, use:

sudo snap set shellhub tenant-id=<your-tenant-id>
sudo snap set shellhub server-address=<your-server-address>
note

If you don't know how to get your Tenant ID, see Retrieving Your Tenant ID

Starting ShellHub Agent and Testing

The ShellHub Agent will automatically connect to the server in background.

Troubleshooting Tips

  • Network Connectivity: Ensure the device can reach the ShellHub server.
  • Tenant ID & Server Address: Double-check the variable content values using snap get shellhub. Also verify if all variables are correctly spelled.
  • Logs and Debugging: Check the ShellHub Agent logs for detailed error messages by running sudo snap logs shellhub.
  • Restarting the ShellHub Agent: After updating configuration settings, restart the ShellHub Agent to apply changes: sudo snap restart shellhub.
  • Updating the ShellHub Snap Package: Ensure the ShellHub Snap is up-to-date by running:sudo snap refresh shellhub.

ShellHub Environment Variables for Snap

  • server-address: Sets the address for the ShellHub server (default is ShellHub Cloud: https://cloud.shellhub.io).
  • private-key: Path to the device’s private key.
  • tenant-id: Links the device to a specific tenant or namespace.
  • preferred-hostname: Suggested hostname for the device, if available.

Conclusion

With ShellHub installed as a Snap Package, you can quickly configure and connect your device for remote management. For further details about Snap, see the Snapcraft Documentation.