Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 20, 2011

Installing Ubuntu 10.04 Enterprise Cloud (on Dell PowerEdge R510 using iDRAC6)

This is done as a two step process - first, we need to configure the machine, then we can actually install Ubuntu.

1. The network setup here is that each cluster node has two network cards, a local and a public one, but all of the public traffic is, initially, routed through the cluster's head node. So, in order to access Dell's iDRAC6 on the worker nodes, it is necessary to first setup port forwarding through the head node for HTTPS and VNC:
(local): sudo ssh -L 443:[node IP]:443 -L 5900:[node IP]:5900 -l [head node user name]  -N [head node IP]


2. Open https://localhost:443 and enable Virtual Media -> Status -> Auto Attach under Console/Media -> Configuration. This will allow us to actually mount a CD-ROM as a virtual device to the node. 

3. Launch the node's virtual console from the Properties tab and reboot the system; load BIOS and disable internal interfaces, disable memory checking, and enable hardware virtualization

4. On the head node, download and mount bootable FreeDOS ISO as a virtual CD for the node so we can boot off of it:
(head node): sudo vmcli -r [node IP]  -u root -p -c [path to FreeDOS ISO on head node]

5. Boot FreeDOS, through the Virtual Console, select 'Install to hard drive', then run from CD (this will enable networking):
(node): UX_Diag, uediag.exe, -mba 1

Now, the machine is ready to have an OS of choice installed.
6. Mount Ubuntu Enterprise Cloud ISO as a virtual CD from the head node again so we can boot off of it and install:
(head node): sudo vmcli -r [node IP] -u root -p -c [path to Ubuntu ISO on hed node]

7. Reboot from virtual console, enter BIOS and choose CD as the first boot device; boot into Ubuntu configuration screen and install Ubuntu. Subsequent instructions on how to install Ubuntu Enterprise Cloud are available here.



Monday, November 29, 2010

Don't require password for sudo

Simple but forgettable because it's done only once...
$ sudo visudo #add desired username to the file in the following format:
[user_name] ALL=NOPASSWD: ALL

Wednesday, September 01, 2010

Profile SGE queues

As root, run the command "qconf -tsm" on your head node. That will cause a one-time scheduler profiling run to be dumped to a text file called "schedd_runlog" in your $SGE_ROOT/ $SGE_CELL/common/ directory. This file can then be examined for any anomalies if things are otherwise not running smoothly.

Wednesday, January 27, 2010

Prepend every line in a file with some text

Say you have a file 'files.txt' looking like this:
p1-c-b-1.fastq.gz
p1-c-b-2.fastq.gz
p1-c-c-1.fastq.gz


Now, you would like to add a full URL path to each of those lines, prepending existing text.
Use awk as follows:
$ cat files.txt | awk '{ print "http://www.complete.url.com/", $0; }' > links.txt

You get a file names 'links.txt' looking like this:
http://www.complete.url.com/ p1-c-b-1.fastq.gz
http://www.complete.url.com/ p1-c-b-2.fastq.gz
http://www.complete.url.com/ p1-c-c-1.fastq.gz


To get rid of introduced extra white space, use sed:
$ cat links.txt | sed 's/ //g'

Tuesday, January 26, 2010

Monitor network traffic on OpenSolaris from command line

To check a summary of network activity for a NIC, use:
# netstat -i 1
    input   xnf0      output       input  (Total)    output
packets errs  packets errs  colls  packets errs  packets errs  colls
1111615 0     745655  0     0      1111684 0     745724  0     0    
399     0     306     0     0      399     0     306     0     0    
416     0     343     0     0      416     0     343     0     0 


To expolore actual packets crossing the network, use snoop command. It captures both TCP and UDP traffic. It is a tool that is shipped with Solaris.

Here is sample output:
# snoop
Using device xnf0 (promiscuous mode)
cbcb-vs.umiacs.umd.edu -> domU-12-31-39-04-EC-47.compute-1.internal TCP D=60088 S=8021 Ack=4204280156 Seq=2401233531 Len=1460 Win=92
domU-12-31-39-04-EC-47.compute-1.internal -> cbcb-vs.umiacs.umd.edu TCP D=8021 S=60088 Ack=2401246671 Seq=4204280156 Len=0 Win=49640 Options=

domU-12-31-39-04-EC-47.compute-1.internal -> dhcp243113.rollins.emory.edu TCP D=49769 S=22 Push Ack=4234202219 Seq=2467318705 Len=192 Win=49232




It shows source and destination servers, type of traffic, source and destination ports, as well as some packet info.

Wednesday, September 09, 2009

Installing Xen dom0 on Ubuntu 9.04

The overall structure of a 'Xen-enabled' system can be visualized by the following figure:

As shown in the figure, and contrary to my prior belief, Xen hypervisor is represented by another GRUB entry at system boot time (as opposed to simply replacing the OS that it was installed from). As a result, you can choose to boot into original OS without Xen availability or into the Xen system even after you have installed Xen on given system. This was just used to show a high-level picture of system layout...

Following are a set of commands that will install Xen hypervisor. These commands are to be executed within the original OS currently existing on the machine:

$ wget http://http.us.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-xen-686_2.6.26-19_i386.deb
$ wget http://http.us.debian.org/debian/pool/main/l/linux-2.6/linux-modules-2.6.26-2-xen-686_2.6.26-19_i386.deb
$ sudo dpkg -i linux-modules-2.6.26-2-xen-686_2.6.26-19_i386.deb
$ sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-19_i386.deb
$ sudo apt-get install ubuntu-xen-server

Then, restart the machine and in the grub loader, Xen should appear as a bootable OS.
After booting up, the following command should tell you that you are in dom0:
$ sudo xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 702 1 r----- 312.9



When it comes to installing guest OS's (i.e., domU's), the following websites were helpful:
  • A brief and technical process can be found here
  • The same process but where each step is explained in more detail can be found here
  • Another example process that shows contents of many files that need to be edited can be found he

Friday, August 29, 2008

Setting up SSH keys for authentication without passwords

1. Log into machine ONE
2. Issue command: ssh-keygen –t rsa
3. Change into ~/.ssh directory
4. Copy contents of file id_rsa.pub from machine ONE to file ~/.ssh/authorized_keys on machine TWO. Note, if this file already exists, simply add a new line to the bottom of it. Furthermore, make sure that the key being copied is all on one line.
5. Change permissions of ~/.ssh/authorized_keys on machine TWO to 700
6. Now, you are able to log in from machine TWO to machine ONE without a password

Tuesday, February 05, 2008

Add multiple linux timing results (output in seconds)

If there are multiple files with timing results resulting from Linux 'time' command:
$ cat outputFile* | grep real
real 4m5.047s
real 2m51.264s
real 2m52.414s
real 2m52.293s

And these timings need to be converted into seconds and added into a single number (e.g., 761.018), use the following command:
cat outputFile* | grep real | cut -f 2 | sed 's/m/*60+/' | sed 's/s//g' | bc | awk '{ printf "%s", $0 "+" }' | sed '$s/.$/\n/' | bc

Convert output of linux 'time' command to show seconds only

After executing Linux 'time' command, the following output is obtained:
real 2m52.293s
user 1m39.670s
sys 0m4.370s

Use the following command to extract value for 'real' time only and convert the output to seconds only (i.e., convert 2m52.293s into 172.293):
cat outputFile* | grep real | cut -f 2 | sed 's/m/*60+/' | sed 's/s//g' | bc