sudo: unable to resolve host ubuntu

Sometimes after changing elastic-IP settings or stopping/starting instances on EC2, I get an irritating error like this when I execute a command with sudo:

sudo: unable to resolve host domU-12-34-ab-cd-56-78

The fix is to lookup the instance’s private dns name (via ec2-describe-instances or the AWS console ui) and update the hostname on the instance with the first segment of that DNS name (which is something that looks like ip-12-34-56-78 or domU-12-34-ab-cd-56-78). On ubuntu, this is what you need to do (assuming ip-12-34-56-78 is the new hostname):

The first line will set the hostname until you reboot; and the second line will configure the hostname to use once you do reboot.

Install s3cmd/s3tools Debian/Ubuntu

1. Register for Amazon AWS (yes, it asks for credit card)

2. Install s3cmd (following commands are for debian/ubuntu, but you can find how-to for other Linux distributions on s3tools.org/repositories)

3. Get your key and secret key at this link

4. Configure s3cmd to work with your account

5. Make a bucket (must be an original name, s3cmd will tell you if it’s already used)

Ubuntu Linux: Creating ethernet alias for eth0 network device

Assuming that your eth0 IP is 192.168.1.10 and you would like to create an alias eth0:0 with IP 192.168.1.11. Type the following command:

OR

Verify that alias is up and running using following two command(s):

Permanent configuration

Your ethernet configuration is located in a file called /etc/network/interfaces. If you reboot system you will lost your alias. To make it permanent you need to add it network configuration file:

OR

Append the following configuration:

Save the file and restart system or restart the network:

Please note that you can also use graphical tools located at System > Administration > Networking menu. Or use the following GUI tool to setup aliases, hostname, dns settings etc:

If you want more network aliases, use eth0:1, eth0:2, eth0:N (max upto 254).

Installing MySQL 5.5.12 on Ubuntu 10.04 (Lucid)

Here we have a step by step tutorial for installing MySQL 5.5.12 on a machine with a fresh install of Ubuntu 10.04 (lucid).

I could not find a tutorial and we needed MySQL 5.5 over MySQL 5.1 for one of our development farms.

Let’s start:

Get MySQL 5.5.12

Change directory into mysql-5.5.12 and make && make install

Chown/Chgrp and copy files

Start the services and create MySQL users

Task: MySQL list databases MySQL is a simple command-line tool. MySQL is command line and it is very easy to use. Invoke it from the prompt of your command interpreter as follows:


Output:

You may need to provide mysql username, password and hostname, use:


To list database type the following command

information_schema and mysql are name of databases. To use these database and to list available tables type the following two commands:
mysql> use mysql;Output:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Now list tables:

Deploy Hadoop cluster with Ubuntu Juju

Here I’m using new features of Ubuntu Server (namely Ubuntu Juju) to easily deploy a small Hadoop cluster.

Add juju apt-repository:

Add charms NON-local:

Add charms local:

Generate your environment settings with

Then edit ~/.juju/environments.yaml to use your EC2 keys. It’ll look something like:

Bootstrap and then deploy charms NON-local

Bootstrap and then deploy charms local

Check Juju status:

Everything is finished and happy when

Optionally scale horizontally with datanode:

When all said and done: (SSH into namenode/datanode)