2014 April

How to create a snapshot in Hyper-V

Introduction

The ability to create snapshots is one of the best reasons for dividing your workloads into different virtual servers.  If a specific service crashes, you can quickly restore it to a previously known setup with very little effort.

I especially appreciate this feature when running a training class.  I can create a snapshot of a VM prior to class, then teach students how to perform certain functions hands on.  In the event something goes catastrophically wrong (and it will!), simply restore the machine to the exact condition it was in when the snapshot was originally created!

Multiple snapshots can be created per virtual machine, so it is possible to restore a VM to any state you had created a snapshot for.

 

How to create a snapshot

Open the Hyper-V Manager

How to open the Hyper-V Manager

Open the Hyper-V Manager

Start > Administrative Tools > Hyper-V Manager

cvm-1

 
 

Select the Virtual Machine

Once inside Hyper-V Manager, click the server name in the left column under “Hyper-V Manager”, then click on the desired virtual machine. For our example, we will create a snapshot for the Virtual Machine named “Jump”.

Notice that in the center column under “Snapshots” there are no current snapshots available. Once you have created a snapshot, it will be listed here.

 
snap-1

 

Create the snapshot

In the far-right column under the name of the VM you have selected, click “Snapshot”

snap-2

 

Snapshot created

After the snapshot is created, you will see it listed in the center column under “Snapshots” (Underlined in Yellow)

The amount of time it takes to create the snapshot will vary depending on the workload of the VM and the amount of disk space it uses. Our sample VM is a simple Windows machine with just the basic operating system installed. Even so, this took several seconds to complete.

snap-3

 

Rename the snapshot (Optional)

By default, the snapshot will be named with the VM name, the date and the time the snapshot was taken, however you are more than welcome to change this.

To change the name of the snapshot, simply right click on the snapshot, then select “Rename…”

snap-4

 
Enter the new name, which often will have more meaning than just the date and time, and press Enter

For our example, I have chosen “Fresh Windows Installation” for the snapshot’s name. If anything happens, I know I can return to this snapshot and have a fresh installation ready to go at a moments notice!

snap-5

 

Creating additional snapshots

You can create as many snapshots as you disk space to allow for. Simply repeat the steps outlined above. Each subsequent snapshot will appear under the current snapshot where you see -> Now displayed.

By admin on April 29, 2014 | Hyper-V | A comment?

How to open the Hyper-V Manager

Open the Hyper-V Manager

Start > Administrative Tools > Hyper-V Manager

cvm-1

By admin on | Uncategorized | A comment?

How to use a2ensite and a2dissite with rpm based apache systems

One thing this author prefers, it is the Debian (apt-get) style use of a2ensite and a2dissite to enable and disable hosted domains. This guide will show you how to set up a similar system in rpm based (Redhat, Fedora, CentOS, etc) systems.

Set up instructions

To setup a similar system on your rpm based server, simply follow the steps outlined below.

Create the folder structure

As root, run the following commands:

mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled

Edit httpd.conf

The first step is to include the sites-enabled folder in your httpd.conf file.

nano /etc/httpd/conf/httpd.conf

Now add the following line at the bottom of the file and save the file.

Include sites-enabled/*.*

Restart apache to use the new setting

service httpd restart

Create the a2ensite and a2dissite commands

Create the following files and add the content displayed.

a2ensite

nano /usr/local/bin/a2ensite
#! /bin/bash

# bash script to use debian style vhosts
# vhost file must be in /etc/httpd/sites-available
# script will make a softlink to /etc/httpd/site-enabled
# and restart httpd
# use a2dissite to remove the link

AVAILABLE="/etc/httpd/sites-available"
ENABLED="/etc/httpd/sites-enabled"
FILE="$1"

if [ -f $AVAILABLE/$FILE ]
then
    	if [ -s $AVAILABLE/$FILE ]
        then
            	ln -s $AVAILABLE/$FILE $ENABLED/$FILE
                service httpd restart
        else
            	echo "File $FILE is empty. No action taken"
        fi
else
    	echo "File $FILE does not exist. No action taken"
fi

a2dissite

nano /usr/local/bin/a2dissite
#! /bin/bash

# bash script to use debian style vhosts
# vhost file must be in /etc/httpd/sites-available
# script will delete a softlink from /etc/httpd/site-enabled
# and restart httpd
# use a2ensite to restore the link

AVAILABLE="/etc/httpd/sites-available"
ENABLED="/etc/httpd/sites-enabled"
FILE="$1"

if [ -f $ENABLED/$FILE ]
then
    	rm -f $ENABLED/$FILE
        service httpd restart
else
    	echo "File $FILE does not exist. No action taken"
fi

Set the files as executable

chmod 744 /usr/local/bin/a2ensite
chmod 744 /usr/local/bin/a2dissite

How to use

The examples below assume you named the domain virtual configuration files after the domain name.

These versions of a2ensite and a2dissite differ from the Debian (apt-get) system by automatically restarting apache upon success. With apt-get based systems, you need to manually restart apache.

Create the virtual host configuration file

This can be used as a very basic, yet functioning virtual host configuration file:

nano /etc/httpd/sites-available/domain.com
<VirtualHost *:80>
        ServerAdmin     admin@domain.com
        ServerName	domain.com
        ServerAlias     www.domain.com
        DocumentRoot    /var/www/vhosts/domain.com/httpdocs/
        ErrorLog        /var/www/vhosts/log/error_log
        TransferLog     /var/www/vhosts/log/access_log
        LogLevel warn
</VirtualHost>

Enable a site

a2ensite domain.com

Disable a site

a2dissite domain.com
By admin on April 28, 2014 | Apache | A comment?

ESXi – How to create a new virtual machine

This article assumes you have already downloaded and install the vSphere client from your ESXi server and have logged in.

Add new Virtual Machine

In the vSphere client, click File > New > Virtual Machine…

By admin on April 18, 2014 | ESXi | A comment?

How to configure the Codero ISO Datastore in ESXi

The Codero Datastore contains several distributions of various Operating Systems, including Arch Linux, CentOS, Debian, DSL, Fedora, FreeBSD, OpenSUSE, SpamTitan and Ubuntu. By using these ISOs, you can drastically reduce the amount of time it take to create new VMs.

 
If you have not done so, download the VMware vSphere Client from your ESXi server.

 

Log into your server

Log into your ESXi Server using the VMware Client.  You will need to enter the IP address of the server, root for the User name and your root password for the server.

esxi-login

 

Certificate Warning?

If you get a certificate warning, check the “Install this certificate and do not display any security warnings for “IP.ADD.RE.SS”

esxi-certwarn

 

Select the server

Inside the vSphere Client, click the server IP in the left column, then click the “Configuration” tab.

esxi-ds1

 

Select Storage

In the Hardware window, click Storage

esxi-ds2

 

Add the datastore

In the View section click Datastores then click the Add Storage… link

esxi-ds3

 

Configure the datastore: Step 1

In the Add Storage window, select (*) Network File System, then click Next >

esxi-ds4

 

Configure the datastore: Step 2

In the Properties area, use the following values::

Server: 64.150.179.80
Folder: /home/repo/data/isos
[X] Mount NFS read only <- make sure this is checked! Datastore Name: Codero ISOs (or something else of your choosing) Click Next >

esxi-ds5

 

Finish

On the final screen, click Finish

esxi-ds6

 
The Codero ISO Datastore is now available for you to use when creating new VMs.

By admin on April 16, 2014 | ESXi | A comment?

How to install Hyper-V in Windows 2008

This guide will show you the steps required to install the Hyper-V Role on a Windows Server. While this guide was created using Windows 2008 DC Edition, the steps should work for any Windows 2008 Server.

More…

By admin on April 12, 2014 | Hyper-V, Windows | A comment?

How to allow access to WHM after being blocked by cphulk

To add your IP by clicking “cPHulk Brute Force Protection” from the WHM main menu, then click the “White/Black List Management” tab. Enter your IP in the text box under “White List (Trusted IP List)” then click the [Quick Add] button.

Once your IP is registered on the white list, you will no longer receive the dreaded “password failed” error from WHM when trying to log in as root.

By admin on April 10, 2014 | Uncategorized | A comment?

How to test and patch your server for the Heartbleed vulnerability

Important Update!
It was discovered that any SSL certificates that were installed on vulnerable servers may also be compromised and should be re-issued using a new private key. You will need to contact your SSL provider for instructions on how to do this.You can use the following links on how to install your new certificates in Plesk and WHM/cPanel.
Plesk: http://www.codero.com/knowledge-base/questions/99/I+have+a+dedicated+server.+How+can+I+install+my+commercial+SSL+certificate+on+my+server+using+plesk%3F
WHM/cPanel: http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/SslTlsManager

 

What is Heartbleed?

Heartbleed is a vulnerability found in certain versions of OpenSSL, the encryption software found on many Linux and Unix based servers. This vulnerability bug allows a hacker with the correct skills to read random areas of your server’s memory. By taking many, many samples, a hacker may be able to piece together the “snippets” and recreate encryption keys used to protect the server and even gain root access to the server.

How to test if your server is vulnerable to this exploit

Visit this website and enter either your domain name, or your server’s IP address.

http://filippo.io/Heartbleed

If your server is vulnerable to this type of attack, you should repair it immediately!

How to patch and repair the Heartbleed bug

Fortunately, the fix for this is pretty simple. Log into your server as root and run the following commands based on which version of Linux you are using.

Redhat, Fedora, CentOS and other RPM distributions

yum update openssl
service httpd restart

Debian, Ubuntu, Mint and other APT-GET distributions

apt-get update openssl
/etc/init.d/apache2 restart
After performing the upgrade, you should test your server again using the site listed above. If you still find you are vulnerable, you may need to reboot your server to ensure all SSL related services have been restarted.

 

For additional information visit the Codero blog: http://www.codero.com/blog/?p=6192
By admin on April 9, 2014 | Malware | A comment?