Who is Who on the UBUNTU SERVER?
sudo nano /etc/os-release : Ubuntu 16.04.7 LTSwhoami : openhab
SSH Connection
ssh openhab@192.168.1.149 -p 8822ssh 192.168.1.149 -l openhab -p 8822
BACKUP - COPY BACKUP
// Server terminalcd /var/lib/openhab2/backups/
tree
// rm -rv openhab2-backup*
sudo openhab-cli backup
// Success! Backup made in /var/lib/openhab2/backups/openhab2-backup-21_02_08-08_38_51.zip
// Server terminal
cp /var/lib/openhab2/backups/openhab2-backup-* ~/backups/
// Desktop terminal
scp -r -P8822 openhab@192.168.1.149:/var/lib/openhab2/backups/openhab2-backup-* ~/Desktop/IoT/OpenHAb/Backup/'Backup Store'
UPDATE SERVER SOFTWARE
// Updatesudo aptitude update
// Stop openHAB 2
sudo /bin/systemctl stop openhab2.service
// Stop Mosquitto 2
// sudo /etc/init.d/mosquitto stop
sudo /bin/systemctl stop mosquitto
// Stop zigbee2mqtt
sudo /bin/systemctl stop zigbee2mqtt
// Upgrade Ubuntu Server
apt list --upgradable
sudo aptitude safe-upgrade
KERNELS and CLEANING UP
The update installs a new kernel. The old one got orphaned.// Aviable
uname -r
// Count
sudo dpkg --list | egrep -i --color 'linux-image|linux-headers' | wc -l
// All installed kernels
sudo dpkg --list | egrep -i --color 'linux-image|linux-headers'
// All installed kernels
dpkg -l | grep linux-image | awk '{print$2}'
Cleaning with the familiar script ~/scripts/ubuntucleaner.sh
#!/bin/bash OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}') CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g') LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)" METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)" OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL) YELLOW="\033[1;33m" RED="\033[0;31m" ENDCOLOR="\033[0m" if [ $USER != root ]; then echo -e $RED"Error: must be root" echo -e $YELLOW"Exiting..."$ENDCOLOR exit 0 fi echo -e $YELLOW"Cleaning apt cache..."$ENDCOLOR aptitude clean echo -e $YELLOW"Removing old config files..."$ENDCOLOR sudo aptitude purge $OLDCONF echo -e $YELLOW"Removing old kernels..."$ENDCOLOR sudo aptitude purge $OLDKERNELS echo -e $YELLOW"Script Finished!"$ENDCOLOR
sudo sh ~/scripts/ubuntucleaner.sh
OPENHAB 2 START
// Start openHAB 2sudo /bin/systemctl start openhab2.service
sudo /bin/systemctl start mosquitto
sudo /bin/systemctl start zigbee2mqtt
sudo reboot
exit
systemctl status openhab2.service
systemctl status mosquitto.service
systemctl status zigbee2mqtt.service
до нови срещи ^.^
0 Response to "Ubuntu Server 16.04 - Updates "
Публикуване на коментар