Skip to content


Steve Jobs, Apple’s Visionary, Dies at 56

It is sad to say but Steve Jobs died today at age of 56. RIP Steve. He leaves the message “Keep loving what you like till the end of your journey!” Hope to see a cure for cancer soon!

 

Posted in Knowledge Base.

Tagged with .


How to install Openstack Nova (2011.3-nova-milestone) in all-in-one setup

ARTICLE: Openstack Cloud Software – Ubuntu Openstack – Ubuntu Cloud

In this article I will talk about how to install Openstack (2011.3-nova-milestone) on All-in-One setup. This kind of installation is useful for proof of concept (POC), development environments or if you want to have a basic cloud environment on your local computer.

Overview
=======
OpenStack [1] is an IaaS cloud computing project by Rackspace Cloud and NASA. Currently more than 110 companies have joined the project among which are Citrix Systems, Dell, AMD, Intel, Canonical, HP, and Cisco. It is free open source software released under the terms of the Apache License [2].

OpenStack Compute (Nova) is a cloud computing fabric controller (the main part of an IaaS system). It is written in Python, using the Eventlet and Twisted frameworks, and relies on the standard AMQP messaging protocol, and SQLAlchemy for data store access.

Configure Prerequisites
==============

Make sure the host in question supports VT ( Virtualisation Technology ) since we will be using KVM as the virtualization technology. This article was tested on Ubuntu 11.04 with the latest updates.

1. Configure bridging mode
sudo apt-get install bridge-utils

2. Install NTP Server
sudo apt-get install ntp

3. Install MySQL Server
Configure mysql’s root password
sudo apt-get install mysql-server

4. Create a database and mysql user for Openstack
sudo mysql -uroot -p<password> -e “CREATE DATABASE nova;”
sudo mysql -uroot -p<password> -e ‘GRANT ALL ON nova.* TO novauser@localhost IDENTIFIED BY “novapassword” ‘;

5. Install RabbitMQ – Advanced Message Queuing Protocol (AMQP)
sudo apt-get install rabbitmq-server

Install Openstack
==========

6. Configure Official PPA repositories
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nova-core/milestone
sudo apt-get update

PS: Note that trunk is changing rapidly so installing ppa:/nova-core/trunk may or may not work any given day. An alternative package installation is ppa:nova-core/milestone .

7. Install Openstack components
sudo apt-get install nova-api nova-network nova-volume nova-objectstore nova-scheduler nova-compute euca2ools unzip
sudo apt-get install glance

8. Restart libvirt-bin just to make sure libvirtd is aware of ebtables.
sudo service libvirt-bin restart

9. Edit /etc/nova/nova.conf and add the following
–sql_connection=mysql://novauser:novapassword@localhost/nova
–flat_injected=true
–network_manager=nova.network.manager.FlatDHCPManager
–fixed_range=10.0.0.0/24

10. restart Openstack services
for i in nova-api nova-network nova-objectstore nova-scheduler nova-volume nova-compute; do sudo stop $i; sleep 2; done
for i in nova-api nova-network nova-objectstore nova-scheduler nova-volume nova-compute; do sudo start $i; sleep 2; done

11. Migrate nova database from sqlite db to MySQL db.
sudo nova-manage db sync
PS: It may take a while.

12. Define a specific private network where all your Instances will run. This will be used in the network of fixed Ips set inside nova.conf.
sudo nova-manage network create –fixed_range_v4 10.0.0.0/24 –label private –bridge_interface br100

12.1 Define a specific public network and allocate 32 Floating Public IP addresses for use with the instances starting from 192.168.2.32.
sudo nova-manage floating create –ip_range=192.168.2.32/27

13. Create a user, a project, download credentials and source them:
cd
mkdir nova
cd nova
sudo nova-manage user admin lborda
sudo nova-manage project create project1 lborda
sudo nova-manage project zipfile project1 lborda
unzip nova.zip
source novarc

Register an Ubuntu cloud image
===================

14. Publish an image

distro=”lucid”
wget http://uec-images.ubuntu.com/$distro/current/$distro-server-cloudimg-amd64.tar.gz

uec-publish-tarball lucid-server-cloudimg-amd64.tar.gz lucid_amd64

Running an instance
============

15. Create a key par
euca-add-keypair lborda > lborda.priv
chmod 0600 lborda.priv

16. Allow icmp (ping) and ssh access to instances
euca-authorize default -P tcp -p 22 -s 0.0.0.0/0
euca-authorize -P icmp -t -1:-1 default

17. Then start the instance

emi=`euca-describe-images | awk ‘{print $2}’ |grep -m1 ami`
euca-run-instances $emi -k lborda -t m1.tiny
euca-describe-instances

17.1 Assign public address to the instance
euca-allocate-address
euca-assocate-address  -i <instance_id> <public_ip_address>

18. SSH to the instance
ssh -i lborda.priv ubuntu@<ipaddress>

19. Terminate instances
euca-terminate-instances <instance_id>

20. That is it! Just start using the instance!

Nice commands to know [3]
====================

nova-manage instance_type list
nova-manage flavor list
nova-manage instance_type create m1.xxlarge 32768 16 320 0 0 0
nova-manage instance_type delete m1.xxlarge

References
=======

[1] – http://www.openstack.org
[2] – http://en.wikipedia.org/wiki/OpenStack
[3] – http://ken.pepple.info/openstack/2011/03/03/Configurable-Instance-Types-For-OpenStack-Nova/

Other links
=========
[4] – http://fnords.wordpress.com/2010/12/02/bleeding-edge-openstack-nova-on-maverick/
[5] – http://wiki.openstack.org/NovaInstall/DevPkgInstall

Posted in Knowledge Base.

Tagged with , , .


How to find all the regions in Amazon EC2

After you have sourced your credentials file you must run:

bordalnx:~/.ec2$ ec2-describe-regions
REGION    eu-west-1    ec2.eu-west-1.amazonaws.com
REGION    us-east-1    ec2.us-east-1.amazonaws.com
REGION    ap-northeast-1    ec2.ap-northeast-1.amazonaws.com
REGION    us-west-1    ec2.us-west-1.amazonaws.com
REGION    ap-southeast-1    ec2.ap-southeast-1.amazonaws.com

Leonardo

Posted in Knowledge Base.

Tagged with , , , .


How to create LVM on Ubuntu

Create LVM on Ubuntu

1. Using the whole secondary hard disk for LVM partition:
sudo fdisk /dev/sdb

Once in the fdisk menu:
1. press n to create a new disk partition,
2. press p to create a primary disk partition,
3. press 1 to define it as the first disk partition,
4. press ENTER twice. This converts the whole secondary disk into a single disk partition,
5. press t to select the partition type,
6. press L to list all the supported partition types,
7. press 8e to select Linux LVM partition type,
8. press p to display the secondary hard disk partition setup. it shows you as /dev/sdb1.
9. press w to write the partition table
10. exit fdisk upon completion.

1.1 Assign disk partitions to physical volumes
sudo pvcreate /dev/sdb1

1.2 Create Volume Group VG for the /data and /backup volumes
sudo vgcreate myvg_data /dev/sdb1
pvdisplay
vgdisplay

pvdisplay and vgdisplay gives you information about LVM.

1.3 Create Logical Volumes ( LV )
sudo lvcreate -L 500G --name data myvg_data

1.4 Format file system
sudo mke2fs -t ext4 -L /data /dev/myvg_data/data

1.5 Mount file system
sudo mkdir /data
sudo mount /dev/myvg_data/data /data
df -hT

Make sure you see the partition mounted and its correct size.

1.7. Add it to the system startup
Check disks UUID by installing blkid and takes not of the UUID from /dev/sdb1 – /dev/myvg_data/data
sudo apt-get install id-utils
sudo blkid

1.8 Add the following entry in /etc/fstab to have the partition mounted
sudo vi /etc/fstab
Add at the end of the file the following lines:
UUID=<enter the uuid number found with blkid> /data ext4 errors=remount-ro 0 1

sudo mount -v
sudo umount --force /data
sudo mount -a
sudo mount -v

1.9 Make sure you can write something in to the new partition
touch /data/file1.asc
ls -la /data

2 Reboot the server and make sure that the /data partition is mounted.

Posted in Knowledge Base.

Tagged with , , , .


Path not the same in Ubuntu when using sudo

Hello,

In case you run in to the same problem when running an application with sudo. Sudo does not keep the same $path environment as the current user.
This behaviour is the expected behaviour since sudo has been compiled with –with-secure-path=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin for security purposes. This change was intentionally done in order to make it harder to run Trojan scripts as root user.

If you want to change that behaviour you can follow the steps below:

Edit /etc/sudoers
$ sudo visudo
Add the following entry to the file
Defaults secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/other_paths/

Save the file.
It should work as expected.

Leonardo

useful words: sudo, ubuntu, $path in ubuntu, environment path

Posted in Knowledge Base.

Tagged with , , , .


Make GNOME terminal behaves like Putty

If you are wondering how to have the same behaviour when copying and pasting text on Gnome terminal here is a different way of doing the same thing.

PuTTY: Highlight = Copy, Right-click = Paste

Gnome: Highlight = Copy, Middle-click (wheel) = Paste

[]s

useful words: gnome terminal, gnome copy/paste, putty gnome

Posted in Knowledge Base.

Tagged with , .


How to build rpm packages

Today I am going to show you how to create an environment for building rpm packages. Once you have your rpm environment set up I will show you how to create a haproxy rpm for your CentOS 5.5 version.

Setting up your system environment takes 6 steps:

  1. Install Development Tools
  2. Install rpmdevtools ( found on epel repository ).  The installation of EPEL repository is not part of this presentation. Find out how to install it here.
  3. Install rpmlint ( used to catch errors earlier in the .spec file )
  4. Create a rpmbuilder account
  5. Create the rpm tree
  6. Create a rpm package from an existent spec file for your CentOS specific version.

Setting up the rpm environment

1. Install Development Tools

# yum groupinstall “Development Tools”

2. Install rpmdevtools

# yum –enablerepo=epel install rpmdevtools

3. Install rpmlint

# yum –enablerepo=epel install rpmlint

4. Create a rpmbuilder account

# useradd rpmbuilder

# passwd rpmbuilder <password>

You should never use root to create rpm packages. It is a security risk creating rpm packages as root user.

5. Create the rpm tree

# sudo -u rpmbuilder -i
# rpmdev-setuptree

6. Create a rpm package from an existent spec file for your CentOS specific version.

On this step I will show you how to create a RPM Package for Haproxy (HAProxy – High Performance TCP/HTTP Load Balancer).
Please read the article on how to create a haproxy RPM Package for CentOS 5.5. ( to be written )

Leonardo

Posted in Knowledge Base.

Tagged with , , .


Install epel repository on CentOS 5.5

In order to install EPEL take the following steps:

  1. rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  2. disable epel repository since by default it is enabled. It is not recommended to keep non standard repositories activated. Use it just in case you need.
  3. sed -i “s/enabled=1/enabled=0/” /etc/yum.repos.d/epel.repo
  4. install the packages you’re looking for by using yum
  5. yum –enablerepo=epel install rpmdevtools

That is it!

Leonardo

useful words: centos 5.5 epel, epel centos 5.5, centos epel 5.5, epel 5.5

Posted in Knowledge Base.

Tagged with .


127.0.1.1 ? Ubuntu / Debian

127.0.1.1 ? What is it used for?

If you’re curious about why Ubuntu and Debian have an entry in /etc/hosts mapping 127.0.1.1 to your server name. You’re not alone, in fact this is not a bug nor it has been put in there by mistake.
Looking at the example below we can see the entries of my testbox:

192.168.1.13    linuxlnx    # Added by NetworkManager
127.0.0.1    localhost.localdomain    localhost
::1    linuxlnx    localhost6.localdomain6    localhost6
127.0.1.1    linuxlnx.linuxlnx.int linuxlnx

The reason why you find the 127.0.1.1 in your /etc/hosts is that some applications like GNOME expects that the hostname to be resolved to an ip address with a canonical fully qualified domain name – FQDN. As you can see on Debian documentation:

Some software (e.g., GNOME) expects the system hostname to be resolvable to an IP address with a canonical fully qualified domain name. This is really improper because system hostnames and domain names are two very different things; but there you have it. In order to support that software, it is necessary to ensure that the system hostname can be resolved. Most often this is done by putting a line in /etc/hosts containing some IP address and the system hostname. If your system has a permanent IP address then use that; otherwise use the address 127.0.1.1.

        127.0.0.1 localhost
        127.0.1.1 linuxlnx

To see whether your system hostname can be resolved to an IP address with a fully qualified domain name, use the hostname –fqdn command.

Also it could be any ip address in the 127.0.0.1/8 address block since according to the RFC 1700 , 127.0.0.0/8 addresses are reserved for loopback purposes.

Leonardo (using Ubuntu 10.10 Maverick Meerkat )

useful words: why debian 127.0.1.1

Posted in Knowledge Base.

Tagged with , , , .


how to install development tools on CentOS 5.4 or CentOS 5.3

It is easy!

# yum groupinstall 'Development Tools'

Leonardo

Posted in Knowledge Base.

Tagged with , .