Category Archives: IT

Ubuntu: updates

Regular updates

sudo apt update
sudo apt upgrades

Distribution updates

Check the version you are running:

lsb_release -a

If updater is not installed:

sudo apt install update-manager-core

To upgrade the release:

sudo do-release-upgrade -d

openHAB: important commands

Live show openHAB logfile

tail -f /var/log/openhab/openhab.log

Backup openHAB. The backup file will be created at /var/lib/openhab/backups.

openhab-cli backup

Restore openHAB backup file

sudo systemctl stop openhab
openhab-cli restore /var/lib/openhab/backups/openhab-backup-23_03_26-19_38_25.zip
sudo systemctl start openhab

Install bindings manually to the following directory. They will be automatically enabled.

cd /usr/share/openhab/addons

NGINX: redirect all HTTP traffic to HTTPS

To redirect all traffic from non secure to secure sockets layer (SSL), add the following lines to the virtual host config file in /etc/nginx/sites-available/my_vhost_config_file.

server {
    listen 80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
}

Explanations:

Listen 80: This instructs the system to catch all HTTP traffic on Port 80
Server_name _; : This will match any hostname
Return 301: This tells the browser (and search engines) that this is a permanent redirect
https://$host$request_uri: This is a short code to specify the HTTPS version of whatever the user has typed