〇構築方法
以下のVagrantfileを使用して、mosquittoをインストールした仮想マシン(CentOS 8.1)を構築する事ができます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-8.1"
config.vm.hostname = "co81mosquitto"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co81mosquitto"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 4096
end
config.vm.network "private_network", ip: "192.168.55.101", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
dnf -y install langpacks-ja
localectl set-locale LANG=ja_JP.UTF-8
dnf install -y epel-release
dnf check-update
dnf -y update
timedatectl set-timezone Asia/Tokyo
# install mosquitto
dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi
dnf -y install mosquitto
systemctl enable mosquitto
systemctl start mosquitto
# execute commands for test.
mosquitto_sub -t mytopic/test -h co81mosquitto >> /tmp/sample.txt 2>&1 &
sleep 10
mosquitto_pub -t mytopic/test -h co81mosquitto -m "test message."
sleep 10
cat /tmp/sample.txt
SHELL
end
0 件のコメント:
コメントを投稿