Importing a MySQL database with a new name where the original still exists

So you want to export your MySQL database then import it on the same server with a new name.   I tried this several times and using the SOURCE command inside MySQL or just mysql -p < db.sql both resulted in the database re-importing over the original name.   To fix that run:
sed -i 's/OLDDATABASENAME/NEWDBNAME/g' mysqldumpFile.sql
Then run:  
mysql -p

create NEWDBNAME;

use NEWDBNAME;

SOURCE /path/to/sql/file
  No need for a semicolon on the last line.   Then check the success by:  
show tables;
   

How to caption an image – HTML5

How do you caption an image in HTML? One way is using figure tags. Without them, you might use the following:  
<img src=”image.jpg” align=”center” />
  …to create this: logo-open-zfs So, you have an image using the above. How do you make it into an image with a caption?
<figure> <img src=”image.jpg” align=”center”/> <figcaption><center>Caption goes here</center></figcaption> </figure>
 
logo-open-zfs
Caption goes here
Like that!

Installing Aegir 3 on Debian 8 Jessie/Ubuntu with Nginx

So, after a few failed attempts at installing the Aegir 3 Drupal control system we hit upon this “recipe” as what works for us currently on a fresh install of Debian 8 Jessie or Ubuntu 14.04.

This assumes you are logged in as root. First, update and upgrade your system.
apt-get update && apt-get upgrade -y
For the version of OS that currently gets installed with a fresh Binary Lane VPS we also need to update the base system. We like to use aptitude for that; while we’re installing aptitude, we might as well install the other thing that Aegir needs to install properly:
apt-get install curl sendmail aptitude -y
Upgrade:
aptitude safe-upgrade -y
Now, we need to install the database server. We use MariaDB.
apt-get install mariadb-server -y
One that’s done – you will be prompted to enter a root password for the database – we run the following command:
mysql_secure_installation
Don’t worry about changing the root password now that you have already set one, but delete the test database when prompted, disable anonymous access and flush privileges. Now we can install Aegir, nginx, php5-fpm etc.:
echo “deb http://debian.aegirproject.org stable main” | sudo tee -a /etc/apt/sources.list.d/aegir-stable.list
curl http://debian.aegirproject.org/key.asc | sudo apt-key add –
apt-get update
apt-get install aegir3 aegir3-provision aegir3-hostmaster nginx php5-fpm
Enter the hostmaster URL – usually the fully qualified domain name. Enter the database root password once for provision and once for hostmaster. Assuming all of the above has gone well, you should be given a one-time-login link in your terminal at the end of the install process, e.g.:
http://aegir.example.com.au/user/reset/1/1446598196/Nw4T4yd25IWEngCP2d2A_Ck3XslBiobnhbuNzXU4/login
Now, before using that run the following:
visudo
Add this to the end of the file:
Defaults:aegir !requiretty
aegir ALL=NOPASSWD: /etc/init.d/nginx
This gives Aegir – the aegir user – permission to restart nginx without requiring a sudo password. Test this works by doing the following: su – aegir
sudo /etc/init.d/nginx restart
What you want to see then is this:
* Restarting nginx nginx
[ OK ]
Then:
vim /etc/nginx/nginx.conf
Comment out by putting a # in front of:
# tcp_nopush on;
# types_hash_max_size 2048;
# error_log /var/log/nginx/error.log;
Reboot, and use the one-time-link. You should be logged in fine and now can use Aegir!

Proxmox KVM virtual machine: Cannot delete due to missing storage

Today we encountered a situation where a Proxmox system’s KVM virtual machine refused to delete after the storage volume that it’s virtual HDD resided on was lost; trying to delete the KVM from the web GUI resulted in the following error:  
TASK ERROR: storage ‘proxmoxHDD’ does not exists
  Attempting to delete it from the command line using:  
qm destroy [VM ID]
  …resulted in:  
storage ‘proxmoxHDD’ does not exists
  Fortunately, there’s a way around this. The KVM config files live in:  
/etc/pve/qemu-server
  Move or erase the [VM ID].conf file and when you refresh your web GUI the VM should be gone.

ZFS on Linux: How to find the arc stats (was arcstat.py)

This has now changed; run the following to find the adaptive read cache stats (ARC):  
cat /proc/spl/kstat/zfs/arcstats
  You can gleam some really useful information out of how your RAM is being utilised and what your required ARC size might be from the results – this may be a topic for a future post, however!

How to protect your CentOS server from the Shellshock exploit

Shellshock is quite a serious security hole found a couple of days ago in Bash; to check whether your CentOS server is vulnerable run the following in a terminal:
env VAR='() { :;}; echo Shellshock vulnerable!' bash -c "echo Bash Testing"
If your system is vulnerable, you will see:
Shellshock vulnerable! Bash testing
If it is not vulnerable, you will see:
bash: warning: VAR: ignoring function definition attempt bash: error importing function definition for `VAR’ Bash testing
If you are vulnerable, you can update bash by running the following:
sudo yum update bash
Once the update has finished, run the code to check your vulnerability again and it should be sorted.



How to protect Debian from the Shellshock exploit

Shellshock is quite a serious security hole found a couple of days ago in Bash; to check whether your Debian server is vulnerable run the following in a terminal:
env VAR='() { :;}; echo Shellshock vulnerable!‘ bash -c “echo Bash Testing”
If your system is vulnerable, you will see:
Shellshock vulnerable! Bash testing
If it is not vulnerable, you will see:
bash: warning: VAR: ignoring function definition attempt bash: error importing function definition for `VAR’ Bash testing
If you are vulnerable, you can update bash by running the following:
sudo apt-get update && sudo apt-get install --only-upgrade bash
Once the update has finished, run the code to check your vulnerability again and it should be sorted.



How to protect Ubuntu against the Shellshock exploit

Shellshock is quite a serious security hole found a couple of days ago in Bash; to check whether your Ubuntu server is vulnerable run the following in a terminal:  
env VAR='() { :;}; echo Shellshock vulnerable!‘ bash -c “echo Bash Testing”
  If your system is vulnerable, you will see:  
Shellshock vulnerable! Bash testing
  If it is not vulnerable, you will see:  
bash: warning: VAR: ignoring function definition attempt bash: error importing function definition for `VAR’ Bash testing
  If you are vulnerable, you can update bash by running the following:
sudo apt-get update && sudo apt-get install --only-upgrade bash
  Once the update has finished, run the code to check your vulnerability again and it should be sorted. NOTE! Only the currently-supported versions of Ubuntu will get the bash update – if you are running anything older (e.g. 13.04, 13.10 or anything older that isn’t a still-supported LTS release) you will need to update your Ubuntu install to have the above work.