Home of Me on the world wild web

Category: Blog (Page 1 of 3)

MySQL or MariaDB root pass reset!

A customer needed help with their database for their website today, the developer had forgotten the root pass of the database holding all of their information, so of course we had to help out!

Start by stopping the service

systemctl stop mariadb

Now we set a flag for it to start with, on next start up

sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

Start it

systemctl start mariadb

Now check that the flag we set actually took

sudo systemctl status mariadb
Look for the flag we set

Now you should be able to login to the database without a password

mysql -u root

Now to set the new root password, just follow along and set your new password in the ‘YourNerPasswordHere’ box 😀

USE mysql;
UPDATE user SET password=PASSWORD('YourNewPasswordHere') WHERE User='root' AND Host = 'localhost';

Thats it you have set a new password for ‘root’

Now lets stop the service again, unset the environment variable and kickstart the database with a brand new root password.

systemctl stop mariadb
sudo systemctl unset-environment MYSQLD_OPTS
systemctl start mariadb

Now the service is running and your root account have a brand spanking new password.

Happy trails my fellow IT nerds

Free replication of a VMware virtual server, does it exist?

How to configure ghettoVCB to replicate your virtual server on EXSi 6.x, 7.0

The answer is “YES!” it does and its really easy to setup too.

ghettoVCB does the trick and I covered the installation process in this post.

So after you completed the installation, check where the files ended up, during the installation:

find / -name ghettoVCB*

As you see, files ended up in /etc and /opt and the example configuration file is located in /ect

Make a copy of the the configuration file “ghettoVCB.conf” and start customize

 cp /etc/ghettovcb/ghettoVCB.conf /etc/ghettovcb/ghettoVCB.conf_old

You can always obtain the default configuration file from GitHub

Now edit ghettoVCB configuration file, with vi

vi /ect/ghettoVCB/ghettoVCB.conf

A full explanation of all options can be found in the documentation

I apply the KISS principle and only change the path to the shared locally mounted NFS storage space. Exit and save your changes, “ESC”, “:” and then “wq!”

You have the possibility to make a dryrun, I recommend doing that.

/opt/ghettovcb/bin/./ghettoVCB.sh -m test.ubuntu -g /etc/ghettovcb/ghettoVCB.conf

So what is going on here

  1. We call the executable and then we tell ghettoVCB to only backup a single vm with the “-m” flag, if you want to backup all, just set the “-a” flag instead and no vm name.
  2. We then tell ghettoVCB to use our customized configuration file.
a successful end report

And you are done!

I would recommend reading the documentation about setting up the cronjob to automate the process.

Have a wonderful day!

Installing ghettoVCB

Exsi 7.0

Turn on SSH on your wmware box, through the webclient.

Now is a good time to download the .vib and upload it to the server


and upload it to the server sftp

SSH direct into your box and then we have to set the acceptance level.

esxcli software acceptance set --level=CommunitySupported

Then we need to move the .vib a folder in local storage I choose the tmp folder, if you dont you might experience the “unknown url type” error when installing.

mv /path to .vib file /tmp

Lets install the .vib file

esxcli software vib install -v /tmp/vghetto-ghettoVCB.vib -f

You will get a verification on successful installation

There fast and easy, enjoy!

Install Oracle Java 16

On Ubuntu Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10

Firstly add the repository

sudo add-apt-repository ppa:linuxuprising/java

Now update the cache and install java

sudo apt update

sudo apt install oracle-java16-installer

You have the possibility to not set java 16 as default, just type this instead

sudo apt install oracle-java16-installer --no-install-recommends

You will be asked to agree to the license agreement, tab and choose “ok

and if you want to remove the ppa

sudo add-apt-repository --remove ppa:linuxuprising/java

and you can also completely remove java 16 again with this command

sudo apt-get remove oracle-java16-installer

But that would kinda ruin the whole exercise of installing it in the first place.


Open-source monitoring software

After trying and testing out different monitoring software over the last couple of days and my choice fell on Zabbix.

It was the most intuitive and customizable, and came with A LOT of templates right out of the box. The community, around this product is strong and there are templates for your every desire ready to download from the forum.

So a here is a fast installation guide :

Zabbix version: 5.4
Linux Ubuntu server version: 20.04

Lets first of obtain root access, then we don’t have to elevate the command all the time. You can do it without this, but then you need to add ‘sudo’ to every command that requires elevation.

sudo su -

Type your password and we are good to go!

Adding .deb

Lets get the .deb, add it to the repository and then update.

wget https://repo.zabbix.com/zab# wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb

dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb

apt update

Now lets install the agent, server and frontend.

apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Creation of database and configuration.

Installation of MariaDB

We need SQL to handle the database for zabbix, I chose MariaDB

apt -y install mariadb-common mariadb-server-10.3 mariadb-client-10.3

Ones installed lets kickstart Maria..DB

systemctl start mariadb && systemctl enable mariadb

Onwards to secure our installation of MariaDB
I will use these database passwords:

root: DBpassRoot
zabbix: DBpassZabbix
You should definitely get creative and conjure up some of your passwords of your own choice for obvious security reasons!


Enter current password for root (enter for none): Press the Enter
Set root password? [Y/n]: Y
New password: <Enter root DB password>
Re-enter new password: <Repeat root DB password>
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

Creation of database and user

Ask Maria nicely to create a database zabbix with password DBpassRoot

mysql -uroot -p'DBpassRoot' -e "create database zabbix character set utf8 collate utf8_bin;"

Then the user zabbix@localhost password DBpassZabbix and set privileges.

mysql -uroot -p'DBpassRoot' -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'DBpassZabbix';"

Lets aviod the import ERROR 1118 🙂

mysql -uroot -p'DBpassRoot' zabbix -e "set global innodb_strict_mode='OFF';"

Our next task is to import initial schema and data.
Beware your installation didn’t break, it just takes some time
Pop open a soda, make a cup of coffee or read about configuration of Zabbix

zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -p'DBpassZabbix' zabbix

We need to be a little strict and enter strict mode

mysql -uroot -p'DBpassRoot' zabbix -e "set global innodb_strict_mode='ON';"

Lets enter the database password in the config files

nano  /etc/zabbix/zabbix_server.conf

Look for the DBPassword key in the config file and write your password after the equals sign.

Search (ctrl+w and enter to search) for the value DBPass
Remove the # sign and enter our password DBpassRoot


Save the file and exit (ctrl+x, followed by y and enter

Configuration of the firewall

ufw allow 80/tcp
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw reload

Lets fire up the Zabbix server and agent processes

systemctl restart zabbix-server zabbix-agent apache2

systemctl enable zabbix-server zabbix-agent apache2

Timezone PHP configuration needs a tweek

nano /etc/zabbix/apache.conf

Search (ctrl+w and enter to search) for the value data.timezone

remove the # sign and change the timezone information to your location.

php_value date.timezone Europe/Stockholm

Save the file and exit (ctrl+x, followed by y and enter

Restart Apache and lets make it start with the system.

systemctl restart apache2
systemctl enable apache2

Ladies and gentlemen, we have lift-off!

Now lets start configuring the Zabbix frontend.

Open your favorite browser and connect to you sparkeling new server:


In the wizard you only need to enter the password for the Zabbix database user we created DBpassZabbix for everything else just hit the next button.

You did it!

Use Zabbix default admin username “Admin” and password “zabbix” (without quotes) to login to Zabbix frontend at URL “http://server_ip_or_dns_name/zabbix” via your browser.

Have fun configuring the server!

« Older posts

© 2021 Thomas Christiansen

Theme by Anders NorenUp ↑