Linux centos 7下搭建mosquitto

2 篇文章 3 订阅

Centos7安装

1.网卡名改为enth0

 A:  vim /etc/sysconfig/grub

 B:  第三行添加“net.ifnames=0 biosdevname=0”

 C: 执行指令:grub2-mkconfig -o /boot/grub2/grub.cfg

2.修改自动获取IP

  A:更改 etc/sysconfig/network-scripts/ifcfg-eth0 ,将ONBOOT="no" 改为 ONBOOT="yes"

   B:保存后:service network restart

   C:查看IP:ifconfig

mosquitto搭建

1.安装g++

  通常情况下在centos下安装软件就用yum.

    关键是,使用yum你的知道安装包的名字是什么。如果直接键入yum install g++,

  会告诉你没有这个包。所以你应该使用gcc-c++,这才是这个包的名字。

 

2.修改config.mk文件

 WITH_TLS:=no

 WITH_TLS_PSK:=no

 WITH_SRV:=no

 

3.编译mosquitto

  make

 

4 安装mosquitto

  make install

 

5 添加用户

  adduser mosquitto

 

6 修改共享库libmosquitto.so.1

  root权限下

  #cat /etc/ld.so.conf
      include ld.so.conf.d/*.conf
  # echo "/usr/local/lib" >> /etc/ld.so.conf
  # ldconfig

 

7 启动mosquitto

  mosquitto -c /etc/mosquitto/mosquitto.conf -d”或 mosquitto -v

 

 

 

辅助指令

1.结束mosquitto进程

  pkill  mosquitto

 

2.centos7默认使用的是firewall作为防火墙,不是iptables

 Systemctl start firewalld.service   启动firewall

 Systemctl stop firewalld.service   停止firewall

 Systemctl disable firewalld.service 禁止firewall开机启动

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农code之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值