Other ways to run Zigbee2mqtt are [Docker](../information/docker.md), the [Hass.io Zigbee2mqtt add-on](https://github.com/danielwelch/hassio-zigbee2mqtt) and [Virtual Enviroment](../information/virtual_environment.md).
For the sake of simplicity this guide assumes running on a Raspberry Pi 3 with Raspbian Stretch Lite, but will work on any Linux machine.
## 1. Determine location of CC2531 USB sniffer and checking user permissions
We first need to determine the location of the CC2531 USB sniffer. Connect the CC2531 USB to your Raspberry Pi. Most of the times the location of the CC2531 is `/dev/ttyACM0`. This can be verified by:
As an alternative, the device can also be mapped by an ID. This can be handy if you have multiple serial devices connected to your Raspberry Pi. In the example below the device location is: `/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00`
If everything went correctly the output of `npm install` is similar to (the number of packages and seconds is probably different on your device):
```bash
node-pre-gyp info ok
added 383 packages in 111.613s
```
Note that the `npm install` produces some `warning` which can be ignored.
## 3. Configuring
Before we can start Zigbee2mqtt we need to edit the `configuration.yaml` file. This file contains the configuration which will be used by Zigbee2mqtt.
Open the configuration file:
```bash
nano /opt/zigbee2mqtt/data/configuration.yaml
```
For a basic configuration, the default settings are probably good. The only thing we need to change is the MQTT server url and authentication (if applicable). This can be done by changing the section below in your `configuration.yaml`.
```yaml
# MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: zigbee2mqtt
# MQTT server URL
server: 'mqtt://localhost'
# MQTT server authentication, uncomment if required:
# user: my_user
# password: my_password
```
Save the file and exit.
## 4. Starting zigbee2mqtt
Now that we have setup everything correctly we can start zigbee2mqtt.
```bash
cd /opt/zigbee2mqtt
npm start
```
When started successfully, you will see:
```bash
2018-5-18 20:35:07 INFO Starting zigbee-shepherd
2018-5-18 20:35:09 INFO zigbee-shepherd started
2018-5-18 20:35:09 INFO Currently 0 devices are joined:
2018-5-18 20:35:09 INFO Connecting to MQTT server at mqtt://localhost
2018-5-18 20:35:09 INFO zigbee-shepherd ready
2018-5-18 20:35:09 INFO Connected to MQTT server
```
Zigbee2mqtt can be stopped by pressing `CTRL + C`.
## 5. (Optional) Running as a daemon with systemctl
To run zigbee2mqtt as daemon (in background) and start it automatically on boot we will run Zigbee2mqtt with systemctl.
```bash
# Create a systemctl configuration file for zigbee2mqtt
sudo nano /etc/systemd/system/zigbee2mqtt.service
```
Add the following to this file:
```
[Unit]
Description=zigbee2mqtt
After=network.target
[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
```
Save the file and exit.
Verify that the configuration works:
```bash
# Start zigbee2mqtt
sudo systemctl start zigbee2mqtt
# Show status
systemctl status zigbee2mqtt.service
```
Output should look like:
```bash
pi@raspberry:/opt/zigbee2mqtt $ systemctl status zigbee2mqtt.service