如何在Ubuntu上更新Mosquitto到最新版本

5

我使用以下命令在 ubuntu 中安装了 mosquitto

sudo apt-get install mosquitto

蚊子(Mosquitto)的安装版本为1.6.9。
mosquitto version 1.6.9

mosquitto is an MQTT v3.1.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

 -c : specify the broker config file.
 -d : put the broker into the background after starting.
 -h : display this help.
 -p : start the broker listening on the specified port.
      Not recommended in conjunction with the -c option.
 -v : verbose mode - enable all logging types. This overrides
      any logging options given in the config file.

See http://mosquitto.org/ for more information

为了将mosquitto更新到最新版本,我首先卸载了它,然后运行了命令sudo apt-get update,然后重新安装了mosquitto,但版本仍然是相同的。
如何将mosquitto更新到最新版本?

我怀疑这不是一个明显的编程问题。 - DavidW
你使用的是哪个版本的Ubuntu?它是像18.04这样的LTS版本吗? - WaLid LamRaoui
1个回答

3
如果您想要安装更新版本的 mosquitto,但使用的是旧版Ubuntu,则可以通过阅读官方下载页面here找到安装最新mosquitto版本的多种方法:
  1. 直接从源代码编译和构建,我不建议这样做(特别是针对初学者)。
  2. 使用 mosquitto-dev PPA
  3. 使用snap包而不是apt,只需运行 sudo snap install mosquitto

然而,我认为最佳选择是使用 mosquitto-dev PPA,因为从源代码构建mosquitto需要更多的时间和精力,并且使用snap涉及更多步骤来使其正常运行。

所以..首先卸载旧版本的mosquitto:

sudo apt autoremove mosquitto

然后您需要将 mosquitto-dev PPA 添加到您的源列表中:

sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa 
sudo apt-get update

最后,安装mosquitto:

sudo apt install mosquitto 

运行 mosquitto --help 命令来验证你的安装,输出结果应该类似于:

mosquitto version 2.0.10

mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

 -c : specify the broker config file.
 -d : put the broker into the background after starting.
 -h : display this help.
 -p : start the broker listening on the specified port.
      Not recommended in conjunction with the -c option.
 -v : verbose mode - enable all logging types. This overrides
      any logging options given in the config file.

See https://mosquitto.org/ for more information.

恭喜!现在您已经安装了最新的版本。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接