2020-10-20 21:11:17 +00:00
# balena CLI Installation Instructions for Linux
2020-09-16 13:53:46 +00:00
2021-04-07 17:40:25 +00:00
These instructions are suitable for most Linux distributions on Intel x86, except notably for **Linux Alpine** or **Busybox** . For these distros or for the ARM architecture, follow the [NPM Installation ](./INSTALL-ADVANCED.md#npm-installation ) method.
2020-09-16 13:53:46 +00:00
Selected operating system: **Linux**
1. Download the latest zip file from the [latest release
page](https://github.com/balena-io/balena-cli/releases/latest). Look for a file name that ends
with "-standalone.zip", for example:
`balena-cli-vX.Y.Z-linux-x64-standalone.zip`
2021-03-06 21:48:19 +00:00
2. Extract the zip file contents to any folder you choose, for example `/home/james` .
The extracted contents will include a `balena-cli` folder.
2020-09-16 13:53:46 +00:00
2021-03-06 21:48:19 +00:00
3. Add that folder (e.g. `/home/james/balena-cli` ) to the `PATH` environment variable.
Check this [StackOverflow
post](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix)
for instructions. Close and reopen the terminal window so that the changes to `PATH`
can take effect.
2020-09-18 14:35:36 +00:00
4. Check that the installation was successful by running the following commands on a
2021-03-06 21:48:19 +00:00
terminal window:
2020-10-20 21:11:17 +00:00
* `balena version` - should print the CLI's version
2020-09-18 14:35:36 +00:00
* `balena help` - should print a list of available commands
2020-09-16 13:53:46 +00:00
2020-10-20 21:11:17 +00:00
To update the balena CLI to a new version, download a new release zip file and replace the previous
2020-09-16 13:53:46 +00:00
installation folder. To uninstall, simply delete the folder and edit the PATH environment variable
as described above.
2021-03-06 21:48:19 +00:00
## sudo configuration
A few CLI commands require execution through sudo, e.g. `sudo balena scan` .
If your Linux distribution has an `/etc/sudoers` file that defines a `secure_path`
setting, run `sudo visudo` to edit it and add the balena CLI's installation folder to
the ** *pre-existing*** `secure_path` setting, for example:
```text
Defaults secure_path="/home/james/balena-cli:< pre-existing entries go here > "
```
If an `/etc/sudoers` file does not exist, or if it does not contain a pre-existing
`secure_path` setting, do not change it.
If you also have Docker installed, ensure that it can be executed ** *without*** `sudo` , so that
CLI commands like `balena build` and `balena preload` can also be executed without `sudo` .
Check Docker's [post-installation
steps](https://docs.docker.com/engine/install/linux-postinstall/) on how to achieve this.
2020-09-16 13:53:46 +00:00
## Additional Dependencies
### build, deploy
These commands require [Docker ](https://docs.docker.com/install/overview/ ) or
2021-04-04 21:47:27 +00:00
[balenaEngine ](https://www.balena.io/engine/ ) to be available on a local or remote
machine. Most users will follow [Docker's installation
2021-03-06 21:48:19 +00:00
instructions](https://docs.docker.com/install/overview/) to install Docker on the same
2021-04-04 21:47:27 +00:00
workstation as the balena CLI. The [advanced installation
options](./INSTALL-ADVANCED.md#additional-dependencies) document describes other possibilities.
2020-09-16 13:53:46 +00:00
### balena ssh
The `balena ssh` command requires the `ssh` command-line tool to be available. Most Linux
distributions will already have it installed. Otherwise, `sudo apt-get install openssh-client`
should do the trick on Debian or Ubuntu.
The `balena ssh` command also requires an SSH key to be added to your balena account: see [SSH
Access documentation](https://www.balena.io/docs/learn/manage/ssh-access/). The `balena key*`
command set can also be used to list and manage SSH keys: see `balena help -v` .
### balena scan
The `balena scan` command requires a multicast DNS (mDNS) service like
[Avahi ](https://en.wikipedia.org/wiki/Avahi_(software )), which is installed by default on most
desktop Linux distributions. Otherwise, on Debian or Ubuntu, the installation command would be
`sudo apt-get install avahi-daemon` .
### balena preload
Like the `build` and `deploy` commands, the `preload` command requires Docker, with the additional
restriction that Docker must be installed on the local machine (because Docker's bind mounting
feature is used).