Set Static IP Address in Centos

Using your favourite text editor (vi) open the default network configuration for the network adapter you wish to configure. I wish to assign a static IP to the default ethernet adapter (eth0). You will need superuser privileges so remember to use sudo

sudo vi /etc/systemconfig/network-scripts/ifcfg-eth0

For the purpose of this post I will be using the following typical network configuration.

  • Host IP Address:
  • Netmask:
  • Gateway:

Update the following highlighted fields with your relevant network settings.


Reset Linux Root Password In Xen Paravirtualised Virtual Machine

This can be used to reset forgotten root passwords in paravirtualised VM’s running on the Xen hypervisor.

1. Identify target VM name.

virsh list --all

2. Shutdown the target VM.

virsh shutdown vm-name-goes-here

3. Start the VM back up again in console mode.

xm create -c vm-name-goes-here

4. Quickly stop the boot process on the grub menu and hit the a key on the default kernel. Once the kernel parameters appear, append the number 1 to the end of the line. Then hit enter to continue with the VM boot.

5. You should then be dropped into a single user mode console, allowing you to reset the password as you would on a physical host.

6. Enter this command to change the root password, you have to enter the new password twice when prompted onscreen.


7. Reboot


Install Twisted (Python) on CentOS 6

Make sure the current system is up-to date

yum update

Install the necessary packages required to satisfy Twisted’s dependancies.

yum install wget python-devel python-zope-interface

Also install the Development Tools

yum group install “Development Tools”

Download the Twisted Framework (example location: ~/src)


Extract files and install

tar jxvf Twisted-12.1.0.tar.bz2
cd Twisted-12.1.0.tar.bz2
python install

Test the installation was successful by creating a Python test file.


Insert the following lines:

import twisted
import twisted.web

Save the file

Ctrl-X (Enter filename when prompted)

Execute the file with hopefully no errors



Common Linux Commands

This will be an on-going post that I will use to keep track of my most commonly used commands.
Tested on Centos 6.3.

Linux Misc

List users

cat /etc/passwd

List groups

cat /etc/group

View free memory

free -m

View disk space usage

df -h


Init new remote repo

git init –bare

Clone existing repo using HTTP

git clone

Clone existing repo using SSH on non-standard port

git clone ssh://

Xen using LibVirt

List running Virtual Machines on Node

virsh list

List all Virtual Machines on Node

virsh list –all


Convert Subversion Repo to Git

Create a local empty SVN repo.

svnadmin create /path/to/repo

In the newly created repo cd into hooks/ and create new file named pre-revprop-change and enter the following.


Remember to make the newly created file executable.

chmod +x hooks/pre-revprop-change

Initialise the local repo to point to the SVN.

svnsync init file:///path/to/local/repo https://path/to/online/repo/svn

Sync the two together.

svnsync sync file:///path/to/local/repo

Import the local SVN repo to a newly created Git repo.

git svn clone file:///path/to/local/repo projectname

Create a new Git –bare remote repo and add a remote link to the local repo.

git remote add origin

Push the local repo to the remote.

git push origin master

Bish bosh job done! Your now free of the tiresome Subversion 😀