Rotating Backups of Mysql database with AutoMySQLBackup version 3.0

I am now using AutoMySQLBackup version 3.0 to backup my MySQL databases.
http://sourceforge.net/projects/automysqlbackup/

I highly recommend this software. It is easy to use and configure. It will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers.

Other Features include:
– Email notification of backups
– Backup Compression and Encryption
– Configurable backup rotation
– Incremental database backups

How to Modify the Dependency of Debian Package in Ubuntu 14.04

I had added a ppa to run a newer version of mythtv and mysql-server than the current supported software. This led to software update failures due to failed dependencies. I am running mythubuntu 14.04 and this post will show how to change the dependency requirement of a software package so that it will install. This method will use a bash script to save some time. The script uses the nano text editor to change the file. Terminal commands will look like this sentence.

  • Download the script “nano.debcontrol.sh”
  • Change to the directory you want to download the package to
    • cd ~/Downloads/mythtv-27
  • Download the mythtv package to modify
    • sudo apt-get download mythtv
  • List contents of directory to see file name of the downloaded file
    • ls -l
      • mythtv_2%3a0.27.4+fixes.20150423.8f14d3d-0ubuntu0mythbuntu3_all.deb
        -rw-r–r– 1 root root  77K Apr 25 08:09
  • Modify mythtv package
    • nano.debcontrol.sh mythtv_2%3a0.27.4+fixes.20150423.8f14d3d-0ubuntu0mythbuntu3_all.deb
      • Change the following line
        • Depends: mysql-server
        • Change to this
          • Depends: mysql-server | mysql-server-5.6
        • This allows the package to use mysql-server or mysql-server-5.6
      • Save file
        • ctrl + o in nano
  • View new modified mythtv file
    • ls -l
      • mythtv_2%3a0.27.4+fixes.20150423.8f14d3d-0ubuntu0mythbuntu3_all.modfied.deb
  • View package contents and order of files (important)
    • less mythtv_2%3a0.27.4+fixes.20150423.8f14d3d-0ubuntu0mythbuntu3_all.modfied.deb
  • Install modified mythtv file
    • sudo dpkg -i mythtv_2%3a0.27.4+fixes.20150423.8f14d3d-0ubuntu0mythbuntu3_all.modfied.deb
  • Done

How to Add Favicon to Worpress Administration Page

This article contains information on how I added a favicon to my WordPress Adminstration Page. This was for WordPress 4.1.1 hosted on my Ubuntu 14.04 server. I wanted a favicon because I currently have 18 pinned tabs in firefox and I rely on the favicon image to identify the wordpress tab. The general solution is to add a custom function to identify when you are in the administration menu. This function is added to your current theme in the file functions.php. Commands from the terminal will look like this sentence.

  • Change to the theme directory
    • cd /var/www/cc.com/wordpress/wp-content/themes/twentyfifteen-child
  • Edit functions.php
    • nano functions.php

// The followin code adds a favicon to the wp-admin site
// from http://clarknikdelpowell.com/blog/how-to-use-favicons-on-the-wordpress-admin-login-pages
// First, create a function that includes the path to your favicon
function add_favicon() {
$favicon_url = get_stylesheet_directory_uri() . ‘/admin-favicon.ico’;
echo ‘<link rel=”shortcut icon” href=”‘ . $favicon_url . ‘” />’;

References:

http://clarknikdelpowell.com/blog/how-to-use-favicons-on-the-wordpress-admin-login-pages

My article on creating a favicon and a list of references are located at https://blog.chadchenault.com/2015/01/10/create-a-multiple-resolution-favicon-ico-file-with-a-linux-bash-script/.

 

Test Router and Wifi Speed using iperf command

This posts shows how to test your local network bandwidth speed which is useful for testing router settings or letting you know if it is time to upgrade your wifi card on your laptop. This test requires a minimum of two computers, with one acting as a server for the other to connect to. I am using Ubuntu linux on these computers. All commands are in italics and run in a terminal window.

Server Computer

  • This computer should be connected by an ethernet cable to your wifi router
  • You need to know the ip address of your server computer
    • ifconfig
      • output follows
      • eth0      Link encap:Ethernet  HWaddr d0:50:99:5b:70:b2
        inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
        inet6 addr: xxx::xxxx:99ff:fe5b:70b2/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:64155953 errors:0 dropped:487 overruns:0 frame:0
        TX packets:97383655 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:7182981438 (7.1 GB)  TX bytes:126082997710 (126.0 GB)
        Interrupt:16
    • This is the ip address from above: 192.168.1.3
  • iperf installation
    • sudo apt-get install iperf
  • run the iperf command in server mode
    • iperf -s -u -i 1 -f M
      • -s = server
      • -u = udp packets
      • -i 1 = report every 1 second
      • -f M = report in Megabytes

Client Computer, this is the computer you are testing

  • This computer can have a wifi or ethernet connection
  • installation is the same as the server
  • run the iperf command in testing mode
    • iperf -c 192.168.1.3 -u -i 1 -l 1300 -b 999999m -t 10 -f M
      • -c 192.168.1.3 = connect at the servers ip address
      • -u
      • -i 1
      • -l 1300
      • -b 999999m
      • -t 10 = amount of time to run test in seconds
      • -f M

With ethernet, I am getting 85 Mb/sec and on wifi 2 Mb/sec. Wifi is very slow on my netbook.

How to convert MythTV MySQL tables from MyISAM into InnoDB

I wanted to upgrade my MythTV MySQL tables from MyISAM into InnoDB format. When I installed Mythbuntu 12.04, MyISAM was the default database engine. Now the default database engine moving forward in InnoDB. Here are the steps I took to upgrade using phpMyAdmin. I am not sure if I documented all the steps here, so use at your own risk.

SET @DATABASE_NAME = 'mythconverg';
SELECT CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND `ENGINE` = 'MyISAM' AND `TABLE_TYPE` = 'BASE TABLE' ORDER BY table_name DESC;

  • Copy the output from this query and paste these results back in the “Run SQL query/queries on database mythconverg” SQL query input box.

I switched from 14.04 Ubuntu-Unity to Ubuntu-Gnome

I been running Ubuntu-Gnome 14.04 for about two weeks now and I really enjoy it and find it easy to use. I switched from the unity desktop because of crashes and errors I was getting. I had been getting crash alerts since running 13.04 unity when I first logged in after a reboot. I had been sending crash reports to Ubuntu/launchpad but finally got fed up enough that I put a fresh (erase partition and use fresh install from live cd). I have always liked the unity interface and the use of the meta/windows key to launch applications. This feels faster because my hands stay on the keyboard and I am not reaching for the mouse to access menus or a dock.

I also tried Debian Jessie and Wheezy with gnome desktop. Debian felt really fast and snappy. Debian was definately harder to setup because I had to enable the non-free (propriety) software for my hardware to work (AMD R-9 270 graphics card). I did not stick with Debian because it would not boot after a software update. I definately want to try Debian-testing again after I get hardware that is more compatible and all my hardware purchases in the future will focus on stability and compatibility with linux in the future. I have Debian Jessie installation on a spare hard drive that I use for recovery purpose and as an emergency working system that does not look as pretty but it gets the job done.

Eventually I installed Ubuntu Gnome 14.04 and installed /root and /home on LUKS encrypted partitions. I will probably run this until version 15.04 comes out. I have heard Ubuntu is shifting its graphics from wayland to mir display server. If they go mir, then I will probably wait a year to for them to get the bugs worked out before I try it.

HowTo update Ubuntu 14.04 / php5-apcu to a owncloud 8.02 supported version

After updating to owncloud 8.0.2 on Ubuntu 14.04, I was getting the following error in owncloud on the administration page “APCu below version 4.0.6 is installed, for stability and performance reasons we recommend to update to a newer APCu version.” I found this post on how to upgrade the php5-apcu package. Here is the link https://github.com/owncloud/core/issues/14386

Backup mysql databases with mysqldump

Addendum 2015-0318: I am now using automysqlbackup for mysql backups. It is simple to use and offers rotating daily/weekly/monthly backups. See my post at https://blog.chadchenault.com/2015/04/25/rotating-backups-of-mysql-database-with-automysqlbackup-version-3-0/.

I have multiple (five) databases in mysql and need to perform regular backups and off-site backups. I am using a python script that uses the mysqldump program to backup my databases.  I am doing daily backups to my home folder at ~/Documents/backup.mysql/. My home directory is backed up daily to another hard drive with a daily cron job and using rsync to create differential backups. I plan on backing up all databases to individual files because I read that it makes restoring a single database easier than if all databases are backed up into one big file. The files will also be compressed with gzip. I did a gzip compression test using the default compression and the “-9” option (best compression) and the difference was minimal for my needs. I decided to use the default compression for speed and simplicity.

mysqldump from command line for testing

sudo mysqldump -u user --all-databases --events | gzip -c > /home/chad0320/Documents/backup.mysql/testbackup.all-databases.sql.gz

 

References

1. python help using mysqldump: http://whatthehost.net/python-s3-backup-script-for-ubuntudebian-web-and-mysql-database-servers/

2. mysqldump manpage: http://manpages.ubuntu.com/manpages/saucy/man1/mysqldump.1.html

 

 

 

gedit 3.10.4 Plugins in Ubuntu 14.04

I like the gedit text editor in Ubuntu 14.04. It is simple and trivial to add new features through plugins. Below I will list the plugins I like and where to find them. I will also give some general installation instructions. Commands from the terminal look like this sentence.

  • System Information
  • Plugins I have installed
    • From https://wiki.gnome.org/Apps/Gedit/ThirdPartyPlugins-v3.8
      • Advanced Find & Replace
        • Advanced find & replace functions. Find & replace in documents.
        • Installation from install script
          • bash install.sh
      • Control Your Tabs
        • Switch between document tabs using Ctrl+Tab / Ctrl+Shift+Tab (most recently used order) and Ctrl+PageUp / Ctrl+PageDown (tabbar order).
        • Installation
          • cp -av controlyourtabs.py controlyourtabs.plugin ~/.local/share/gedit/plugins
      • Toggle Text Wrapping
        • Quickly toggle text wrapping from the View menu or Toolbar.
        • Installation
          • cp -avR toggletextwrapping toggletextwrapping.plugin ~/.local/share/gedit/plugins
    • From https://wiki.gnome.org/Apps/Gedit/ThirdPartyPlugins-v3.0
      • Favorites
        • Organize your favorite documents for quick access.
        • Installation
          • cp -avR favorites favorites.plugin ~/.local/share/gedit/plugins
      • gedit-markdown
        • Syntax highlighting, snippets, external tool, color scheme and embedded HTML preview (can also be used as a Web browser) for Markdown
        • I did not install this, but wanted it here to find it later
      • Pylint 2
        • Analyze Python source code with Pylint
        • Installation
          • I added Gedit BC Developer Plugins which contains Pylint
          • sudo apt-add-repository ppa:gedit-bc-dev-plugins/releases
          • sudo apt-get update
          • sudo apt-get install gedit-developer-plugins
  • Example Installation For Favorites Plugin
    • Most plugins are installed like the “favorites” plugin. All plugins provided good documentation for installation. A few plugins provide a bash installation script making installation even easier.
    • Download and extract the archive.
    • From the terminal, change directory to the extracted archive location with the “cd” command
    • Copy the file favorites.plugin and the folder favorites to ~/.local/share/gedit/plugins/.
      • cp -avR favorites favorites.plugin ~/.local/share/gedit/plugins
    • Restart Gedit.
    • Activate the plugin in gedit.
      • From the menu choose ‘Edit > Preferences’, select the ‘Plugins’ tab, and check the box next to ‘Favorites’

That is it. gedit comes for free from the Gnome Foundation. I appreciate everything they do and for promoting open source software. More information about gnome is here https://www.gnome.org/foundation/.