EMQX is a scalable and fast MQTT broker, which is designed for the Internet of Things (IoT) industry. In this tutorial, we will go through the steps to install EMQX on Ubuntu Server Latest.
Before we can proceed with the installation of EMQX, we need to ensure the following prerequisites are satisfied:
Before we start, let's update the package information of our system by running the following command:
sudo apt-get update
To install EMQX, we will follow the steps outlined in the official documentation of EMQX. First, let's download the EMQX repository package by running the following commands:
wget https://repos.emqx.io/emqx-ubuntu-18.04/emqx-ubuntu20.04-4.3.2_amd64.deb
Next, let's install the downloaded package using the following command:
sudo dpkg -i emqx-ubuntu20.04-4.3.2_amd64.deb
After the installation is complete, start the EMQX service using the following command:
sudo systemctl start emqx
To ensure that the EMQX service is running, check its status using the following command:
sudo systemctl status emqx
If the service is running correctly, you should see an output similar to the following:
● emqx.service - EMQ X Broker
Loaded: loaded (/lib/systemd/system/emqx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-01-05 15:51:13 UTC; 8s ago
Docs: https://docs.emqx.io/
Main PID: 2675 (emqx)
Tasks: 30 (limit: 4915)
Memory: 54.1M
CGroup: /system.slice/emqx.service
├─2675 /usr/sbin/emqx start
├─2744 sh -c ulimit -n 65535; exec /usr/sbin/emqx console
└─2745 /usr/lib/erlang/erts-12.1.5/bin/beam.smp -- -root /usr/lib/erlang -progname erl -- -home /var/lib/emqx -- -noshell -n >>>
To ensure that EMQX starts automatically after a system reboot or crash, enable the EMQX service using the following command:
sudo systemctl enable emqx
To test the EMQX installation, we can use the MQTT client Mosquitto by running the following command:
sudo apt-get install mosquitto-clients
Once installed, we can use Mosquitto to connect to the EMQX server by running the following command:
mosquitto_sub -h <SERVER_IP> -t test
where <SERVER_IP>
should be replaced with the IP address of your EMQX server.
Next, let's publish a message to the test topic by running the following command:
mosquitto_pub -h <SERVER_IP> -t test -m "hello world"
If everything is working correctly, you should see the message "hello world" appear in the output of the Mosquitto client.
By following the steps outlined in this tutorial, you should have successfully installed and tested EMQX on Ubuntu Server Latest. EMQX is now ready to be used as an MQTT broker for your IoT projects.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!