SSD / HDD for RasPi 4 PLUS MQTT / Syslog Server

MQTT / Syslog Server

In this video I install an old laptop Hard Drive in my Raspberry Pi 4 and remove the SD card completely. This can also be done with Solid State Drives or other storage mediums. I then use it to make an MQTT / Syslog Server

I (had) an old 386 server running to save my syslog messages and run an independent MQTT server. That server had a hard-drive failure, and I decides a giant dual processor 386 based Xenon server running just for that was a bit ridiculous. So I’m used an old Laptop Hard-drive, a tiny drive enclosure, and a Pi4 with a fan-less case to replace it.

Follow along and maybe we can both learn something.

Build SD card for initial boot

On a small SD card (to be used for install only) load RasPi Lite

Edit boot folder

Touch ssh

create wpa.supplicant.conf (if using WIFI)

Boot RasPi to update firmware

Insert SD

Boot it and log in

run: raspi-config

interface options

  • make SSH server perm

advanced options

  • bootloader version

    • update to latest
  • boot order

    • usb then sd card

Build HDD

Build USB drive with one of the RasPi official installations. You can try others but not all have the tweaks to allow USB drive as Bootable OS.

Touch SSH file like above.

Reboot with SD card installed and USB installed in one of the blue connectors (Should boot the SD card and switch over to the USB Drive as it boots.)

Allow the new SSH fingerprint by following instructions on screen.

run: raspi-config

interface options

  • make SSH server perm

Change the boot order:

sudo echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt

Wait until the USB drive appears to be done with expansion and disk check. (Might be 10 > minutes on a slower drive.) Drive activity will become less active.

Power down:

sudo shutdown -now

Remove SD card, leaving USB drive attached, power up to reboot without SD card.

Update the OS:

sudo apt update; sudo apt upgrade -y

Install Rsyslog

Pull down the files

sudo apt install rsyslog

Configure syslog as the server

sudo nano /etc/rsyslog.conf

Remove the hashtag from these lines and save the file:

#module(load="imudp")
#input(type="imudp" port="514")

#module(load="imtcp")
#input(type="imtcp" port="514")

OPTIONAL Create a new template for receiving remote messages. Add the template just before GLOBAL DIRECTIVES section:

$template remote-incoming-logs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" 
*.* ?remote-incoming-logs
& ~

Restart rsyslog:

sudo systemctl restart rsyslog

Install MQTT

Install Mosquitto:

sudo apt install mosquitto

Verify it is running:

sudo systemctl status mosquitto

Setup Password: Create a simple text file, for example /etc/mosquitto/password_file_sample

username:password1
otherusername:password2

etc…

This is the last you will see these usernames and passwords, so REMEMBER them.

Now encrypt it:

mosquitto_passwd -U password_file_sample

Add a local config file:

sudo nano /etc/mosquitto/conf.d/local.conf

SAMPLE local.conf file. Adjust as needed:

# Turn off anonymous access
allow_anonymous false

# Point to the password file
password_file  /etc/mosquitto/password_file_sample

# Connect Mosquitto to the syslog server
log_dest syslog

# Set what information is to be logged
log_type error
log_type warning
#log_type notice
#log_type information
#log_type all

# Turn logging off
#log_dest none

Episode: 050

YouTube topic links:

00:00 Welcome
01:00 Assembly
02:18 Executive Summary
03:10 Build Installer SD Card
07:15 Boot Installer SD
09:31 Build Boot USB Drive
11:44 Set to boot USB Drive Only
15:00 Boot From USB Only
16:10 Rsyslog Setup
18:30 MQTT Server Setup
23:31 Close

Video related links:

USB3 Drive enclosure:
https://www.amazon.com/gp/product/B08BFHCJZX/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1&tag=drzzs0e-20
Pi4 power supply 3.5A:
https://www.amazon.com/gp/product/B07TYQRXTK/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1&tag=drzzs0e-20
No fan case:
https://www.amazon.com/gp/product/B07Y9FTLQH/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1&tag=drzzs0e-20
Ras Pi 4gb
https://www.amazon.com/gp/product/B07TC2BK1X/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1&tag=drzzs0e-20

SSD Reference 1 SSD Conversion:

https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/

SSD Reference 2 SSD Conversion:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

Syslog Reference 1 Syslog Install Server:

https://pimylifeup.com/raspberry-pi-syslog-server/

Syslog Reference 2 Syslog Install Server:

https://computingforgeeks.com/configure-rsyslog-centralized-log-server-on-ubuntu/

MQTT Reference 1 MQTT install Broker:

https://pimylifeup.com/raspberry-pi-mosquitto-mqtt-server/

MQTT Reference 2 MQTT password:

http://www.steves-internet-guide.com/mqtt-username-password-example/

MQTT Reference 3 MQTT Logging:

http://www.steves-internet-guide.com/mosquitto-logging/

Fun, in case you cannot read the Qrcode at the end of the video…

https://youtu.be/ehpH-rbnolc

Contact Links:
What are we Fixing Today Homepage / Website:
https://www.WhatAreWeFixing.Today/
Channel Link URL: (WhatAreWeFixingToday)
https://bit.ly/WhatAreWeFixingTodaysYT
What are we Fixing Today Facebook page (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodaybFB
What are we Fixing Today Twitter Account (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodayTW
Discord Account: (Sir_Goodenough#9683)
https://discord.gg/Uhmhu3B

Patreon Membership: https://www.patreon.com/WhatAreWeFixingToday

Please help support the channel:

Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough
PayPal one-off donation link: https://www.paypal.me/SirGoodenough
Cash App $CASHTAG: https://cash.me/$SirGoodenough
Venmo cash link: https://venmo.com/SirGoodenough

If you would like to donate anything to this channel, please use this address:
C/O: Sirius GoodEnough
322 Buena Vista Ave.
Department: DYT
Waukesha, Wisconsin, 53188-3602

Link to this video on YouTube:
https://youtu.be/6tiiO7q-yXc

video add-ins provided by:
spinny,
Video by Tech VideoStack from Pixabay

chalkboard
Video by imotivation from Pixabay

rocky
Video by mohamed Hassan from Pixabay


SirGoodenough Guy Animations Courtesy 3ATIVE Studios https://www.3ative.com/

Music from YouTube Library:
Shawl_Paul by Norma Rockwell
Compressor_Works_Twang by Max McFerren
I retired from a large mid-western medical equipment manufacturer on December 31 (2019) and decided to try to let everyone in on my life and my transition into retirement. I have a varied set of interests. I live in a 90 year old cape cod in the middle of a small city of 70,000 people. I have a small lot across the street from the city seat of government, but despite that I have a 1952 Allis Chalmers farm tractor that I drive around the city from time to time. My wife has a business that has me fixing and creating cool home decor out of broken windows and drywall screws. I have been known to buy things on 'for sale' lists, fix it up, clean it up, generally add value and sell it off. Oh, yes, I'm getting chickens! But first I have to build the chicken coop and run. It will be like no other you have ever seen. Also will give me something to do. I am into home automation, have a Home Assistant enabled home and so will the chickens! I'll have to give them a password...
Social Media Auto Publish Powered By : XYZScripts.com