Ubuntu

Backup Your MySQL Database Daily!

21/05/2014 // 0 Comments

Here is quick guide to backup your MySQL database daily: This guide is prepared on Ubuntu 12.04LTS, MySQL 5.5. Save this script anywhere in your database server:

* Edit the red texts for your environment. This script will use /home/username/mysqlbackup folder to save the backup files. It will delete the backup files which are 7 days old. It will hold 8 backup files. Make the the script file executable:

Test the script by running manually before adding to your crontab.

Add the script to crontab to run it daily:

This job will run at 03:00 everyday.

Generate User Password in Ubuntu Cloud Image

12/05/2014 // 0 Comments

When you boot standard Ubuntu Cloud image in the Openstack, no password or user generated in the image by default. You can configure your Ubuntu Cloud image to set a static password or generate a password in the first boot of the image. You need to configure metadata service in the Openstack in order to use this. I suggest you to do this jobs in your Glance server, your images will be saved to this server anyway.   Firstly, download your Ubuntu cloud image from this link: https://cloud-images.ubuntu.com/ Install guestfish in your server. This server probably will be your Glance image server. :

In order to edit the image file open it with guestfish:

Then, start your image file:

Find the image local disk:

Mount the image disk to guestfish root:

Now, you can edit /etc/cloud/cloud.cfg file by using vi editor. I wanted to set random password for ubuntu user, so I added these lines to the cloud.cfg file: for 12.04 LTS images, you can set your static password or randomize:

for 14.04 LTS images I have not tried to randomize the password yet, but static password can be set with this commands:

Be careful to comment out the “lock_passwd: True” raw in the cloud.cfg file. It will not allow you to login if you do not remove it. Save cloud.cfg file and exit from guestfish. That’s it! Import this modified image to Openstack and Ubuntu password will be randomly created or static password will be set . If you randomized the password it will be printed to Console-log of the instance:

guestfish operation referance: http://docs.openstack.org/image-guide/content/ch_modifying_images.html Here are some examples in cloud.cfg file: http://cloudinit.readthedocs.org/en/latest/topics/examples.html

Openstack: Icehouse with Ubuntu 14.04LTS

08/05/2014 // 0 Comments

Openstack’s new version Icehouse was released with the new Ubuntu 14.04 LTS on 17th of April. Trove (Database as a service) package was added to Openstack with this version. Check Trove here: https://wiki.openstack.org/wiki/Trove As far as I read in the release notes, there is no major change on other services. I will  install the new version and write about it in the future. Check the release notes: https://wiki.openstack.org/wiki/ReleaseNotes/Icehouse 

VLAN tagging on Bonding interfaces for Ubuntu Servers

06/05/2014 // 0 Comments

Firstly, install vlan and bonding packages on the Ubuntu server:

Enter these lines on /etc/modules because we want to enable the modules at startup.

If there is no network connection, you need to install these packages from CDROM or install these packages while OS setup. This configuration can be used for bonding and VLAN tagging on server. You can define additional VLAN interfaces. This configuration if for Active-Passive interfaces. We need to define primary interface as seen in eth0. If you do not want to configure your physical switch or do not want to struggle with your network administrator, this is the best way. When eth0 is lost, your secondary interface (eth1 in this example) will be used. If you want to use active-active setup, the best way is to setup LACP bonding, but you need to configure your physical switch ports for LACP.

bond0 is your bonding interface. bond0.430 is your VLAN tagged bonding interface. 430 is your VLAN. If you want to check bonding status, you can check here: