RHEL requires you to be logged in with a Red Hat account in order to use their default package repositories. Register an account at redhat.com , then follow the steps here to link the system to your account.
Installation
Note: All listed commands should be run by the root user unless otherwise specified.
yum install -y mysql-server
cat <<EOT >> /etc/my.cnf
innodb-file-per-table = on
event-scheduler = on
explicit_defaults_for_timestamp = off
sql-mode = "NO_ENGINE_SUBSTITUTION"
[mysqld]
log_bin_trust_function_creators = 1
EOT
systemctl restart mysqld.service
Configure User Access
systemctl enable mysqld.service
# Optional: update mysql root password
mysql_secure_installation
# Login to MySQL
mysql -uroot -p
# Change the root password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewP4ssword$';
# Create an EMX user
CREATE USER 'emx'@'localhost' IDENTIFIED BY 'S3cretP4ssword$';
GRANT ALL PRIVILEGES ON `emx`.* TO 'emx'@'localhost';
# Create an EMX database
CREATE DATABASE `emx`;
exit
Firewall Configuration
Only one firewall, if any, should be running. Which is running depends on the specifics of your installation, but below are example configurations for the three most common: dftables, iptables, or firewalld.
nft insert rule ip filter INPUT ct state new tcp dport 80 counter accept
nft insert rule ip filter INPUT ct state new tcp dport 443 counter accept
nft insert rule ip filter INPUT ct state new tcp dport 8080 counter accept
nft list ruleset >> /etc/sysconfig/nftables.conf
# Note that the systemd service should be enabled to automatically reload these settings on reboot.
# systemctl enable nftables
Option 3: Using iptables
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
# Drop the OPX .rpm on the server first using scp, wget, or some other means; then:
rpm -ivh packetpower-opx2-*.rpm --ignoreos
# Edit MySQL credentials using `nano`, `vim`, or `cat` as below:
cat <<EOT > /var/pacpow-opx/config/mysql.json
{
"host": "localhost",
"user": "emx",
"password": "S3cretP4ssword$",
"database": "emx"
}
EOT
cat <<EOT > /var/pacpow-opx/config/mqtt.json
{
"url": "mqtt://localhost:1883",
"user": null,
"password": null
}
EOT
cat <<EOT > /var/pacpow-opx/config/e4-api-mqtt.config.json
{
"mqtt": {
"url": "mqtt://localhost:1883",
"options" : {
"user": null,
"password": null
}
},
"emx": {
"host":"localhost",
"port":80
},
"jdrTopic":"@p2/JDR",
"panelTopic":"@p2/PANEL"
}
EOT
Install EMX Package
# Drop the EMX .rpm on the server first using scp, wget, or some other means; then:
rpm -ivh packetpower-emx-*.x86_64.rpm --nodeps
# Create the support_files directory for storing firmware, etc.
mkdir -p /var/www/public/support_files/
chown apache.apache /var/www/public/support_files/
# Run OPX processes with PM2 task manager
(cd /var/pacpow-opx && pm2 start config/ecosystem.config.js)
pm2 save
(Optional) Update Support Files
Note: the support files directory is hard-coded to /public/support_files, though it should be possible to symlink it to another location if necessary. It contains node firmware files that can be sent remotely to gateways in order to broadcast updates over the mesh network. This is an optional step that's included just for the sake of completeness.
# (Optional) Copy over desired firmware files
sudo cp ~/uploaded_files/node.*.bin /var/www/public/support_files/
# Tell SELinux to recursively restore the security context
# !! NOTE: This must be done after *every* update to the support_files folder!
restorecon -R -v /var/www
EMX Web Installer
Finally, complete the setup by navigating a browser to the IP address of the EMX server. You will be greeted with a setup screen, which will prompt you for the following information:
MySQL credentials
Mosquitto configuration (used by OPX3)
The following is the default mosquitto configuration:
Hostname: 127.0.0.1 (or the IPv4 address of the appropriate server)
Username: blank
Password: blank
Port: 1883
(Optional) The SMTP server credentials to be used for alerting capabilities