How To Install MySQL 5.6 On Debian

Valic —  December 31, 2012 — 2 Comments

MySQL 5.6 will add more performance improvements over MySQL 5.5. MySQL 5.6 is not stable yet but I will show you how to install MySQL 5.6.8rc on Debian if you want to test it.

Step1. Add a group and an user for MySQL called mysql:

root@testing:~# groupadd mysql
root@testing:~# useradd -r -g mysql mysql

Step2. Install the libaio1 library package. This is used by MySQL:

root@testing:~# apt-get install libaio1

Step3. Download MySQL 5.6.8rc version in /usr/local location:

root@testing:~# cd /usr/local
root@testing:/usr/local# wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz
2012-12-30 16:11:31 (5.10 MB/s) - `mysql-5.6.8-rc-linux2.6-x86_64.tar.gz' saved [293210851/293210851]

Step4. Unpack the MySQL archive and rename it to mysql: Continue Reading…

Dump a PostgreSQL database:

postgres@server:~$ pg_dump db_name -v --format=c --file=./db_name.dump

Import the dump to a new PostgreSQL database:

postgres@server:~$ createdb -E UTF8 -T template0 db_new
postgres@server:~$ pg_restore -U user -d db_new ./db_name.dump
postgres@server:~$ psql --command "ALTER DATABASE db_new OWNER TO user;"

How to Get UUID of Hard Disks

Valic —  December 27, 2012 — Leave a comment

The Universally Unique Identifier(UUID) is used to identify a hard disk independent form its device name or mount point. Is mostly used to access a device not by name, for example in /etc/fstab file.

There are many ways to get the UUID. I will show you two ways to do that.

Use the following command to show you all hard disk partitions by UUID:

ls -l /dev/disk/by-uuid

lrwxrwxrwx 1 root root 10 Dec 27 20:02 25c8851a-494b-49f8-a1ac-3df97ca16a5e -> ../../sda5
lrwxrwxrwx 1 root root 10 Dec 27 20:02 2a554679-b975-4f5d-bb41-97374d640f6a -> ../../sda3
lrwxrwxrwx 1 root root 10 Dec 27 20:02 ed57f181-75e7-4fc6-aebe-2865b358da84 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Dec 27 20:02 f6385c06-925a-426f-b689-21a210908ae0 -> ../../sda1

The second way is to use blkid tool:

blkid /dev/sda1
/dev/sda1: UUID="f6385c06-925a-426f-b689-21a210908ae0" TYPE="ext3"

blkid /dev/sdb1
/dev/sdb1: UUID="ed57f181-75e7-4fc6-aebe-2865b358da84" TYPE="ext4"


I will show you how to degug Fail2ban when you can’t start it and you get the following error:

Starting Fail2ban: [FAILED]

You can’t find any errors in syslog or Fail2ban log because the Fail2ban init script is writing the output of the fail2ban-client to /dev/null The best way to debug Fail2ban is to call directly the fail2ban-client and that will show any syntax error found in the config files. The command and the output looks like this:

fail2ban-client -xd start
WARNING 'findtime' not defined in 'apache-noscript'. Using default value
WARNING 'findtime' not defined in 'pam-generic'. Using default value
WARNING 'findtime' not defined in 'vsftpd'. Using default value Continue Reading...

Fail2ban scans log files and bans IPs that show malicious signs, something like too many password failures and looking for the most common exploits.

Step1. Install Fail2ban on Debian

apt-get install fail2ban

Step2.  Configure Fail2ban.

You can configure Fail2Ban using the configuration files located in /etc/fail2ban/

The main config file and the most important is jail.local

In the following steps I will show you some configuration examples. You can study the Fail2ban man files later.

Step2.1 Add or modify the following line to set email destination for Fail2ban notifications:

destemail = contact@your-domain.tld Continue Reading...