This commit is contained in:
Thomas Bishop 2025-12-14 15:32:35 +00:00
parent 0766a6cfec
commit f85eae5fc1
2 changed files with 77 additions and 0 deletions

View file

@ -6,6 +6,8 @@ tags:
# Debian package management
> Can now actually do away with `apt-get` and just use `apt`
## Update and install package
```sh
@ -23,4 +25,12 @@ sudo apt-get update
```sh
sudo apt autoremove <package_name>
`
```
## List installed packages
```
apt list --installed
```

View file

@ -0,0 +1,67 @@
---
tags:
- Linux
- Debian
- mqtt
---
## Config
At `/etc/mosquitto/mosquitto.conf`.
Most important lines:
```
listener 1883
allow_anonymous true
```
This means `mosquitto` will run on port:1883 and that I am not using
authentication with requests to the broker.
### Websockets
In order to enable [websockets](./Web_sockets.md), must create a config file at
`/etc/mosquitto/mosquitto.conf/websockets.conf`:
```
# /etc/mosquitto/mosquitto.conf/websockets.conf`
listener 8083
protocol websockets
```
This is only relevant if you require access from outside of the local network.
## Basic usage
## Create a topic
```sh
mosquitto_sub -d -t test_topic
```
This then enters listening mode and takes control of terminal:
```
$ mosquitto_sub -d -t test_topic
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending SUBSCRIBE (Mid: 1, Topic: test_topic, QoS: 0, Options: 0x00)
Client (null) received SUBACK
Subscribed (mid: 1): 0
```
## Publish to a topic
From my other machine I install `mosquitto` and:
```sh
mosquitto_pub --host 192.168.68.53 --port 1883 --topic test_topic --message 'hello world'
```
This registers on the broker device:
```
Client (null) received PUBLISH (d0, q0, r0, m0, 'test_topic', ... (11 bytes))
hello world
```