Saturday, April 5, 2014

Ubuntu apt-get Install Error


When running apt-get install, got following error.
/var/lib/dpkg/info/ebtables.postinst: 6: /var/lib/dpkg/info/ebtables.postinst: update-rc.d: not found
dpkg: error processing ebtables (--configure):
 subprocess installed post-installation script returned error exit status 127
After lots of search, finally find a solution that works for my problem:
First remove the relative files in /var/lib/dpkg/info, then reinstall 
$ sudo rm ebtables*
$ sudo apt-get -f install ebtables

Run OpenStack on Ubuntu

You can install DevStack on your ubuntu VM or PC to learn its features.
Here I have an old laptop installed with Ubuntu server 12.04.

If you haven't installed git yet, you need to install it.
$ sudo apt-get install git
Download and install devstack:
$ git clone https://github.com/openstack-dev/devstack.git
Configure local.conf There is a sample local.conf under devstack/samples directory. Go to samples directory and copy it to devstack/ directory.
$ cp local.conf ../
Go to devstack/ directory and edit local.conf. A simple configuration can be found here
[[local|localrc]]
FLOATING_RANGE=192.168.1.224/27
FIXED_RANGE=10.11.12.0/24
FIXED_NETWORK_SIZE=256
FLAT_INTERFACE=eth0
ADMIN_PASSWORD=supersecret
MYSQL_PASSWORD=iheartdatabases
RABBIT_PASSWORD=flopsymopsy
SERVICE_PASSWORD=iheartksl
Run devstack
$ ./stack.sh
Now you can access and explore your openstack dashboard via the IP of your host machine. User name is "admin" and the password is what configured in the about local.conf file.

Notes: 
"Error: unable to connect to node 'rabbit@xxx': nodedown" try to start server:
$ sudo rabbitmq-server start

Thursday, April 3, 2014

Codes Fusion: Setup newest Hadoop 2.x (2.2.0) on Ubuntu

Codes Fusion: Setup newest Hadoop 2.x (2.2.0) on Ubuntu: In this tutorial I am going to guide you through setting up hadoop 2.2.0 environment on Ubuntu. Prerequistive $ sudo apt-get install op...



Some notes:

1. If multiple java version are installed and default version isn't 1.7, use following command to manually switch to 1.7.
$ sudo update-alternatives --config java

2. When running start-dfs.sh, lots of exception like: Could not resolve hostname *: Name or service not known.

After add following to /usr/local/hadoop/etc/hadoop/hadoop-env.sh, problem solved. Solution is found from here.
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"

3. DataNode is not started.
I encountered this because I formatted namenode twice before I started the service. After I delete the current folder under the namenode and datanode, and again format the namenode, all services are started successfully.

Wednesday, April 2, 2014

Setup Wifi for Ubuntu Server without Cable Connection

For the first time, try to install Ubuntu Server 12.04 on an idle notebook, but found it is a lot of trouble to setup the wifi network without cable connection.

Step 1: First thing to check,
$ iwconfig
you should expect to see "wlan0" in the list. If not, it means there is something missing. In my case, the Ubuntu Server doesn't come with the wifi card driver for my PC.

Step 2: Use lspci command to find your network controller.
$ lspci 
......
04:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)
......
In my cast, it is BCM4312.

Step 3: Go to find the corresponding driver package(.deb file) and download on a computer that has network connection.
Step 4: Without cable connection, you can use the USB stick to transfer the driver installation package. Using mount command to help you out. More details here
//Create the Mount Point(a directory, e.g. usb)
$ sudo mkdir /media/usb
//Find your usb device, something like /dev/sdb1
$ sudo fdisk -l
//Assume your device is /dev/sdb1, the filesystem is FAT16 or FAT32
$ sudo mount -t vfat /dev/sdb1 /media/usb -o uid=1000,gid=1000,utf8,dmask=027,fmask=137
Now go to the mount directory and copy package to local disk.
//copy file from usb directory to local
$ sudo cp /media/usb/package_name.deb /local_path 
Then unmount the usb device.
//unmount your device
$ sudo umount /media/usb

Step 5: Install driver.
//go to the package file directory and install
$ sudo dpkg -i package_name.deb
After reboot you should see the wlan0 in your iwconfig list.

Step 6: Edit your network interfaces file under /etc/network and set up the static IP address (so you can reach it by ssh or ftp). A detailed explanation for each field can be found here
$ vi interfaces
Basically, you need to set up following info:
auto wlan0
iface wlan0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
wpa-ssid <your_network>
wpa-psk <your_hex_key>
You need to get your paraphrased key for wpa-psk field via command: 
wpa_passphrase your_essid your_ascii_key
For example,
$ wpa_passphrase "mywifi" "123123123"
network={
 ssid="mywifi"
 #psk="123123123"
 psk=6300c5dc74f4634edb78d8abd42903d87e2da04d1d4ac4d7843f542fa4d61d91
}
The hex key generated here is what you need to provide for wpa-psk field. 

Step 7: Now restart network and test your network connectivity using ping.
$ sudo /etc/init.d/networking restart