Installing MySQL on Debian

Step 1 – Prerequisites

Login to your Debian 9 system using shell access. For remote systems connect with SSH. Windows users can use Putty or other alternatives applications for SSH connection.

ssh root@debian9

Run below commands to upgrade the current packages to the latest version.

sudo apt update 
sudo apt upgrade

Step 2 – Configure MySQL PPA

MySQL team provides official MySQL PPA for Debian Linux. You can download and install the package on your Debian system, which will add PPA file to your system. Run below command to enable PPA.

wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

During the installation of MySQL apt config package, It will prompt to select MySQL version to install. Select the MySQL 5.7 or 5.6 option to install on your system. Continue reading “Installing MySQL on Debian” »

Share

Remove Node from Proxmox Cluster

Step 1 : Migrate all VMs to another active node

Migrate all VMs to another active node. You can use the live migration feature if you have a shared storage or offline migration if you only have local storage.

Step 2 : Display all active nodes

Display all active nodes in order identify the name of the node you want to remove Continue reading “Remove Node from Proxmox Cluster” »

Share

Permanently add Static Route in Linux

Static routing is the process of manually entering the routes to the routing table to reach a particular destination. Basically two commands are used in Linux to add routes. The first command is the old traditional route add and second is the IP route command.

Earlier we learned how to route add in Linux, in this tutorial, here I will show you how to add permanent static routes in Linux distributions such as Centos and Ubuntu.

Adding temporary static routes

In order to add a static route temporarily on your Linux machine, you can use either route or ip command.

You can list the current routing table as follows.

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.206.1 0.0.0.0 UG 100 0 0 eno1
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eno1
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.206.0 0.0.0.0 255.255.255.0 U 100 0 0 eno1

route -n command Continue reading “Permanently add Static Route in Linux” »

Share

WordPress Backup Script

#!/bin/bash

# This script creates a compressed backup archive of the given directory and the given MySQL table. More details on implementation here: https://theme.fm
# Feel free to use this script wherever you want, however you want. We produce open source, GPLv2 licensed stuff.
# Author: Konstantin Kovshenin exclusively for Theme.fm in June, 2011
# Modification by Hasan T. Emdad tweenpath.net on August, 2020

# Set the date format, filename and the directories where your backup files will be placed and which directory will be archived.

NOW=$(date +"%Y-%m-%d-%H%M")
FILE="example.org.$NOW.tar"
BACKUP_DIR="/backups"
WWW_DIR="/var/www/example.org/"

# MySQL database credentials
DB_USER="mysqluser"
DB_PASS="mysqlpass"
DB_NAME="example_org"
DB_FILE="example.org.$NOW.sql"

# Tar transforms for better archive structure.
WWW_TRANSFORM='s,^var/www/example.org,www,'
DB_TRANSFORM='s,^var/www/example.org/backups,database,'

# Create the archive and the MySQL dump
tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR
mysqldump --user=${DB_USER} --password=${DB_PASS} $DB_NAME > $BACKUP_DIR/$DB_FILE

# Append the dump to the archive, remove the dump and compress the whole archive.
tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE
rm $BACKUP_DIR/$DB_FILE
gzip -9 $BACKUP_DIR/$FILE
Share

Add Geolocation to Graylog 2

The Graylog Map Widget is the plugin providing geolocation capabilities to Graylog. The plugin is compatible with Graylog 2.0.0 and higher, and it is installed by default, although some configuration is still required on your side. This section explains how to configure the plugin in detail.

In case you need to reinstall the plugin for some reason, you can find it inside the Graylog tarball in our downloads page. Follow the instructions in Installing and loading plugins to install it.

Configure the database

In first place, you need to download a geolocation database. We currently support MaxMind City databases in the MaxMind DB format, as the GeoIP2 City Database or GeoLite2 City Database that MaxMind provides.

The next step is to store the geolocation database in all servers running Graylog. As an example, if you were using the Graylog OVA, you could save the database in the /var/opt/graylog/data folder, along with other data used by Graylog. Make sure you grant the right permissions so the user running Graylog can read the file. Continue reading “Add Geolocation to Graylog 2” »

Share

Installation Bashtop an upgraded CLI system reporting interface from Top or Htop

Install Bashtop Resource Monitor on Ubuntu

You can use PPA repository for Ubuntu Linux installations:

sudo add-apt-repository ppa:bashtop-monitor/bashtop
sudo apt update
sudo apt install bashtop

Install Bashtop Resource Monitor on Debian

For Debian and its based distributions, used the commands below: Continue reading “Installation Bashtop an upgraded CLI system reporting interface from Top or Htop” »

Share

Revoking Lets Encrypt Certificate properly

When you want to learn how to revoke Let’s Encrypt SSL/TLS certificates, follow the steps below:

Step 1: Validate Certificate file

Before you revoke a certificate, you’ll want to validate that the correct certificates and key file you’re revoking.. since there is no reversal.. Once a certificate is revoked, it will never be used again…

When you revoke a certificate, the certificate authority publishes that revocation information through the Online Certificate Status Protocol (OCSP), and some browsers will check OCSP to see whether they should trust a certificate… Continue reading “Revoking Lets Encrypt Certificate properly” »

Share

Fix Proxmox (PVE) “can’t lock file ‘/var/lock/qemu-server/lock-xxx.conf’ – got timeout” (Proxmox can’t shutdown/stop virtual machine) (Proxmox kill/force stop virtual machine)

The Issue

When trying to “Stop” or “Shutdown” virtual machine from Proxmox (PVE) web gui, the “Cluster log” shows

end task UPID:pve:xxxxxxxx:xxxxxxxx:xxxxxxx:qmstop:xxx:root@pam: can’t lock file ‘/var/lock/qemu-server/lock-xxx.conf’ -got timeout
end task UPID:pve:xxxxxxxx:xxxxxxxx:xxxxxxx:qmreboot:xxx:root@pam: VM quit/powerdown failed

The Fix

We can manually delete the lock from following path

/run/lock/qemu-server
# The file will be
/run/lock/qemu-server/lock-100.conf
/run/lock/qemu-server/lock-102.conf
...

Make sure only delete the correct one!

You can also do it using script from this site-

https://dannyda.com/2020/05/11/how-to-fix-proxmox-pve-cant-lock-file-var-lock-qemu-server-lock-xxx-conf-got-timeout-proxmox-cant-shutdown-virtual-machine/

Share

Easyengine installaiton on Debian 10

Install Easyengine WordPress on a Debian 10 VM (mine was a KVM).

The following procedure will install EE with following components;

  • Docker
  • WordPress Core
  • MariaDB
  • Nginx Server PHP-FPM
  • Redis Cache
  • Let’s encrypt SSL

Install EasyEngine on Linux

wget -qO ee rt.cx/ee4 && sudo bash ee
ee site create your_domain --type=wp --ssl=le --cache

For detailed installation or customizing your requirement, you may visit- https://easyengine.io/commands/site/create/ Continue reading “Easyengine installaiton on Debian 10” »

Share