mattizz'z weblog

Een rustpunt in barre tijden

If from some reason reset fails follow the step below to use –skip-grant-tables to reset MySQL root password.
Let’s start by stopping the currently running MySQL database:

$ sudo service mysql stop

Next, create a /var/run/mysqld directory to be used by MySQL process to store and access socket file:

$ sudo mkdir -p /var/run/mysqld
$ sudo chown mysql:mysql /var/run/mysqld

Once ready manually start MySQL with the following linux command and options:

$ sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking &
$ [1] 2708

Confirm that the process is running as expected:

$ jobs
[1]+ Running sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking &

At this stage we are able to access MySQL database without password:

$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

Using the MySQL session first flush privileges:

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Next, reset root password. The following commands will reset MySQL root password to linuxconfig.org:

mysql> USE mysql;
Database changed
mysql> UPDATE user SET authentication_string=PASSWORD(“linuxconfig.org”) WHERE User=’root’;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 1

mysql> UPDATE user SET plugin=”mysql_native_password” WHERE User=’root’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

Quit MySQL session:

mysql> quit
Bye

Gracefully terminate current mysqld process:

$ sudo pkill mysqld
linuxconfig@ubuntu:~$ jobs
[1]+ Done sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking

Lastly, start MYSQL database:

$ sudo service mysql start

Bron: https://linuxconfig.org/how-to-reset-root-mysql-password-on-ubuntu-18-04-bionic-beaver-linux

Handig om een grafische schil om Docker te gebruiken.
Eerst Docker installeren:
Zie de website https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

First, update your existing list of packages:
$ sudo apt update
Next, install a few prerequisite packages which let apt use packages over HTTPS:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Then add the GPG key for the official Docker repository to your system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
Add the Docker repository to APT sources:
$ sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”
Next, update the package database with the Docker packages from the newly added repo:
$ sudo apt update
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
$ apt-cache policy docker-ce
You’ll see output like this, although the version number for Docker may be different:
Output of apt-cache policy docker-ce
docker-ce:
Installed: (none)
Candidate: 18.03.1~ce~3-0~ubuntu
Version table:
18.03.1~ce~3-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).
Finally, install Docker:
$ sudo apt install docker-ce
Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
$ sudo systemctl status docker
The output should be similar to the following, showing that the service is active and running:
Output
● docker.service – Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago
Docs: https://docs.docker.com
Main PID: 10096 (dockerd)
Tasks: 16
CGroup: /system.slice/docker.service
├─10096 /usr/bin/dockerd -H fd://
└─10113 docker-containerd –config /var/run/docker/containerd/containerd.toml

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client.

Daarna Portainer installeren:
Zie de website https://portainer.readthedocs.io/en/latest/deployment.html
$ docker volume create portainer_data
$ docker run -d -p 9000:9000 -p 8000:8000 –name portainer –restart always -v /var/run/docker.sock:/var/run/docker.sock -v
portainer_data:/data portainer/portainer
Hierna is Portainer te starten op http://[hostnaam of IP-adres]:9000.
Resultaat hieronder:

schermafbeelding_portainer.png

Om een grafische interface te kunnen gebruiken en zo een Ubuntu server makkelijker te kunnen beheren volg de onderstaande instructies:

Add Webmin Ubuntu repository

Open the /etc/apt/sources.list file to manually add the repository link to the list. In order to open the sources.list file, run the following command as root in your Terminal:

$ sudo vi /etc/apt/sources.list

This will open the file in the Nano editor. Move to the end of the file and paste the following line in order to add the Webmin repository to the list:

deb http://download.webmin.com/download/repository sarge contrib

The next step is to get the Webmin PGP key for the newly added repository. This way the system will trust this repository. Run the following command to do so:

$ wget http://www.webmin.com/jcameron-key.asc

Then add the key through the following command:

$ sudo apt-key add jcameron-key.asc

Installing Webmin on Ubuntu

Once the repository has been added and recognized, let us update the list of packages on our system through the following command:

$ sudo apt update

Finally, install the Webmin application through the following command:

$ sudo apt install webmin

Hierna kan er ingelogd worden op de interface door te gaan naar https://[server ip-adres of hostnaam]:10000

Voorbeeld van het resultaat is hieronder getoond:

schermafbeelding.png

Met dank aan:
https://vitux.com/install-and-configure-webmin-on-ubuntu

https://linuxconfig.org/vnc-server-on-ubuntu-18-04-bionic-beaver-linux

Om de sunsonic muziek service te koppelen aan de Sonos om via de Sonos app de Subsonis muziek af te spelen, doe het volgende:
Open http://SONOS_IP:1400/customsd.htm in a browser.
Enter the following values in the web form:
SID – Any legal value except 242
Service Name – Any name, for instance “Subsonic Remote”
Endpoint URL – http://SUBSONIC_IP:4040/ws/Sonos?ip=SUBSONIC_IP
Secure Endpoint URL – http://SUBSONIC_IP:4040/ws/Sonos?ip=SUBSONIC_IP
Polling Interval – 1200
Authentication – Session ID
Strings Table – Version: 6, URI: http://SUBSONIC_IP:4040/sonos/strings.xml
Presentation Map – Version: 3, URI: http://SUBSONIC_IP:4040/sonos/presentationMap.xml
Container Type – Music Service
Capabilities – Search, Favorites, User Content Playlists, Extended Metadata

Resultaat ziet er in de Sonos app uit zoals hieronder is weergegeven, muziek kan rechtstreeks over de Sonos worden afgespeeld:

Sonos.jpg

= Getest en werkend op een Android Tablet =
Start Reddit
Ga naar reddit.com/r/soccerstreams
ga bij een wedstrijd onder de acestreamlinks staan. kies voor share
paste de inhoud naar een teksteditor en prepareer de link tot het onderstaande:
acestream://6244b438f15775dd6843d017c6dfa326729e6474

Start de ace stream player op en plak de url van hierboven bij “enter content id”
speel af met VLC
stream via VLC naar de Chromecast

Gladys Knight & The Pips: “The Way We Were – Try To Remember”

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Hey, you know, everybody’s talkin’ about the good old days, right
Everybody, the good old days, the good old days
Well, let’s talk about the good old days
Come to think of it as, as bad as we think they are
These will become the good old days for our children, hum
Why don’t we, ah
Try to remember that kind of september, when
When life was slow and oh, so mellow, hum
Try to remember, and if you remember then follow
Oh, why does it seem the past is always better
We look back and think
The winters were warmer
The grass was greener
The skies were bluer
And smiles were bright
Can it be that it was all so simple then
Or has time rewritten every line
And if we had the chance to do it all again
Tell me
Would we
Could we
Memories, like the corners of my mind
Misty watercolor memories
Of the way we were
Scattered pictures of the smiles we left behind
Smiles we gave to one another
For the way we were
Hahaa
Oh, can it be that it was all so simple then
Or has time rewritten every line
And if we had the chance to do it all again
Tell me, haha
Would we
Could we
Memories, may be beautiful and yet
What’s too painful to remember
We simply choose to forget
So it’s the laughter we will remember
Whenever we remember
The way we were
Remember, the way we were

Songwriters: Alan Bergman / Marilyn Bergman / Marvin Hamlisch
Songteksten voor The Way We Were – Try To Remember © Sony/ATV Music Publishing LLC

Op deze website https://www.ztatz.nl/slimme-meter/p1-monitor/ wordt uitgelegd hoe je vrij simpel mbv een zogenaamde P1 kabel en een Raspberry Pi 3 Model B+ je slimme meter live kunt uitlezen en over langere periode kunt zien hoeveel stroom en gas je wanneer verbruikt. Er is ook een weer-API aan gekoppeld zodat bv gasverbruik aan de buitentemperatuur gerelateerd is.
Het IP-adres en port 80 van de Raspberry geport-forward zodat ik er buiten het netwerk ook toegang toe heb. Daar weer zoals in het vorige artikel uitgelegd een “Password Protect Web Directories in Nginx” voorgezet zodat niet iedereen erbij kan.

Aangezien ik nog een ongebruikte oude Samsung Galaxy Tab 4 (7.0) had liggen, deze in de meterkast gemonteerd zodat de actuele meterstanden altijd beschikbaar zijn.
Hieronder een foto hoe de Samsung Tab in de meterkast is aangebracht:

monitor.jpg

Het is makkelijk als de RPI een vast ip-adres in het netwerk heeft. Dat is simpel als volgt uit te voeren waarbij alleen de wlan0 instellingen hoeven worden ingegeven als de RPI alleen draadloos wordt gebruikt. Om het interne ip-adres vast te stellen om via ssh in te loggen kan gebruik gemaakt worden van de app “fing”:

Edit the file /etc/dhcpcd.conf as follows:

Type sudo nano /etc/dhcpcd.conf at the command prompt.

Scroll to the bottom of the script, and add the following lines:

interface eth0 (als voorbeeld, verschilt per interne netwerk)

static ip_address=192.168.178.2/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.1

interface wlan0 (als voorbeeld, verschilt per interne netwerk)

static ip_address=192.168.178.2/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.1

Vergeet niet het p1mon ssh (root) wachtwoord te veranderen met het commando sudo passwd p1mon