如何在Ubuntu中将mosquitto更新为最新版本

如何在Ubuntu中将mosquitto更新为最新版本,ubuntu,version,updates,mosquitto,Ubuntu,Version,Updates,Mosquitto,我已经在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 t

我已经在
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
为了将MOSQUITO更新到最新版本,我首先卸载了它,然后运行命令
sudo apt get update
,然后重新安装了MOSQUITO,但版本仍然相同


如何将mosquitto更新为最新版本?

如果您想要更新版本的
mosquitto
,但您使用的是较早版本的Ubuntu,那么通过阅读官方下载页面,您可以发现安装最新mosquitto版本的方法不止一种:

  • 直接从源代码编译和构建,我不推荐这样做
  • 使用
    mosquitto开发PPA
  • 只需运行
    sudo snap install mosquito
  • 然而我认为最好的方法是使用
    mosquitto开发PPA
    ,因为从源代码构建mosquitto需要更多的时间和精力,使用snap需要更多的调整来启动和运行

    所以。。首先卸载旧的MOSQUITO:

    sudo apt autoremove mosquitto
    
    然后,您需要将
    mosquitto dev PPA
    添加到源列表中:

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

    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.
    

    恭喜你现在你已经安装了最新版本。

    我怀疑你使用的是哪个版本的ubuntu,这是一个很明显的编程问题?它是像18.04一样的LTS版本吗?