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

Sunday, August 28, 2011

Linux Server SSH

To continue with my Ubuntu Linux server odyssey, I got SSH working this afternoon for access from my LAN. As always, heed the warnings, these posts are without a warranty of any kind, not least because I am a total amateur. They exist because it's easy to have Google to "index my brain" or rather, what was in my brain at a certain time.

The objective is to enable remote login for my Ubuntu machine running with a local ip address of 10.0.1.2. We begin by setting a stronger password for my account on Ubuntu under: System > Preferences > About Me (weirdly, it's not under Passwords and Encryption Keys ..).

On the client (OS X Snow Leopard Server), I already have some key pairs from a previous test

> ls ~/.ssh
authorized_keys	id_dsa		id_dsa.pub	known_hosts


but they are DSA keys, which the notes I'm going to follow deprecate. We'll make a short 1024 byte bit RSA pair for now:

ssh-keygen -b 1024 -t rsa

> cat id_rsa.pub 
ssh-rsa AAAAB..5Eoec= telliott_@c-98-___-__-154.hsd1.wv.comcast.net

Not sure what the pseudo ip address or "comcast" thing is about.

I also take this opportunity to set a passphrase for the public key (and of course I make a note of it). This will be useful (it says) because we can set up the server to require both a password to gain access to the public key, as well as the corresponding private key before login is allowed.

[UPDATE: I'm still working my way through this, but I suspect that the previous statement isn't correct. The passphrase is used to protect the value of the private key. So, in this setup OS X will decrypt the private key using the passphrase, and the stored value of the private key in id_rsa is encrypted. I'll try to figure all this out soon. ]

The easiest way to get my new public key onto the server is to use SSH (with password, before we disable it). The next question is, do we need to install an SSH server? It appears yes.

sudo apt-get install openssh-server

There is a pre-existing config file /etc/ssh/ssh_config but after the previous command there are more including sshd_config. I make sure to save a copy of this file before I modify it. Now try:

ssh te@10.0.1.2

ssh: connect to host 10.0.1.2 port 22: Connection refused

OK, so we need to modify /etc/ssh/sshd_config. Port22 is already uncommented. Now uncomment:

PermitRootLogin no
ChallengeResponseAuthentication yes
PasswordAuthentication yes   # we'll set it to no eventually

On the server:

sudo /etc/init.d/ssh restart

On the client:

> ssh te@10.0.1.2
The authenticity of host '10.0.1.2 (10.0.1.2)' can't be established.
RSA key fingerprint is d1: .. :83.
Are you sure you want to continue connecting (yes/no)? 

Check the fingerprint on the the server:

ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub

2048 d1: .. :83 /etc/ssh/ssh_host_rsa_key.pub (RSA)

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.1.2' (RSA) to the list of known hosts.
Connection closed by 10.0.1.2

> ssh te@10.0.1.2
te@10.0.1.2's password: 
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-11-generic x86_64)

Now to change to not using our password. We need to copy our RSA public key to the server in some secure way. According to the sshd_config file, the "authorized keys file" is
%h/.ssh/authorized_keys. That's in my home directory. I do:

> scp ~/.ssh/id_rsa.pub te@10.0.1.2:~/.ssh/authorized_keys
te@10.0.1.2's password: 
id_rsa.pub                                    100%  260     0.3KB/s   00:00    

te@VB:~$ logout
Connection to 10.0.1.2 closed.

> ssh te@10.0.1.2
Identity added: /Users/telliott_admin/.ssh/id_rsa (/Users/telliott_admin/.ssh/id_rsa)
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-11-generic x86_64)

* Documentation:  https://help.ubuntu.com/

Last login: Sun Aug 28 14:35:49 2011 from osxserver.local
te@VB:~$ 

Now, finally, be sure to turn off password authentication for the ssh server: PasswordAuthentication no. At first, I'm not being prompted for a password to retrieve my public key on the server.. just getting automatically logged in by:

ssh te@10.0.1.2

I forgot to do:

ChallengeResponsePasswords yes

sudo /etc/init.d/ssh restart

Restart and I get the challenge.. Although it is apparently cached sometimes. Looks like it works.

Linux Server

A couple of weeks ago I described installation of Ubuntu Linux (11.04), running under Virtual Box on Mac OS X Lion. I got matplotlib (and scipy) installed and running without any difficulty using apt-get alone.

Next, I installed Apache Server 2.2 and configured everything to run Python scripts by using Firefox from Ubuntu on the VM like this:

localhost/cgi-bin/test.py

After struggling a bit, I figured out how to use Virtual Box in NAT mode to do "port forwarding"---by modifying

/etc/apache2/sites-available/default

so then I could launch the script from the host OS by doing

localhost:8080/cgi-bin/test.py

from Safari or by using curl in Terminal.

The next step was to try to access the server from a second machine on my home network. In order to do that, (as I understand it) I can either remain in NAT mode and try to connect via the host machine and port-forwarding, or use "bridging" mode to effectively put the Ubuntu server on the network.

In order to accomplish this, I need to know the ip address of the server as assigned by my Apple Time Capsule router. Now the problem is that this ip address may change with time (since we're getting it from the Time Capsule as a DHCP server). According to the folks I asked on serverfault, I need to switch the Ubuntu network IPv4 settings to manual and ask for a specific ip address and this is correct so far as it goes.

However, the address I ask for in Ubuntu



has to match the range of addresses that the router is set up to hand out. Furthermore, we probably want to have most ip addresses handled dynamically, and only use a static ip for the one machine. If we wanted them all static, we'd go here:


I found the answer here but the setting is actually visible in this screenshot:


Under Internet > DHCP there is a TableView called DHCP reservations. I just reserved the first available ip address. After re-booting Ubuntu and restarting the server, I can run the test script or do:


Now I have to figure out how to access the server from the outside world. I should probably remove the test script from cgi-bin (since it reveals information about paths on the server) and read up on firewall configuration, etc. before I do that. The first problem for this part (not yet solved) is that my ip address from my isp, obtained with

checkip.dyndns.org/

does not seem to be accessible. I get a "Safari can't connect to the server .." message.

Monday, August 15, 2011

Trying Ubuntu Linux (6)

Continuing with my Ubuntu Linux (11.0.4) server running in a VirtualBox VM under Mac OS X Lion, and making its capabilities available to other machines on my LAN. In two previous posts I described my search for a solution (here), and the actual solution (here), which used port forwarding with VirtualBox networking in NAT mode.

There is at least one other possible solution, which is to do the networking in bridged mode. To quote the docs:

With bridged networking, VirtualBox uses a device driver on your host system that filters data from your physical network adapter. This driver is therefore called a "net filter" driver. This allows VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software. When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable: the host can send data to the guest through that interface and receive data from it. This means that you can set up routing or bridging between the guest and the rest of your network.


To begin with I did something (that may not be necessary), I turned off the NAT rule from before (in OS X):

VBoxManage modifyvm Ubuntu --natpf1 delete "server"

Then I set networking to bridged in the VirtualBox Settings:



And restarted Apache (in Ubuntu):

sudo /etc/init.d/apache2 restart

ifconfig gives me the IP address that we have obtained from the DHCP server in Airport Extreme:



If I use the AirPort Utility I can see the corresponding MAC and IP addresses.



Now if I go to another machine on the network and point Safari at that IP, it works:



[ UPDATE: In the screenshot we specified port 8080, and that works because of what we did last time. But you can also do the ipadress only and it works too. ]

Sunday, August 14, 2011

Trying Ubuntu Linux (5)

The project I had yesterday (here) was to set up my server (Apache) in Linux under VirtualBox so that it is visible from the host (OS X Lion). I solved that eventually by sticking with NAT mode and issuing this command in Terminal (with Ubuntu powered down):

VBoxManage modifyvm Ubuntu --natpf1 "server,tcp,,8080,,8080"

This is exactly what the docs say to do. The extra twist was to modify /etc/apache2/ports.conf to add:

NameVirtualHost *:8080
Listen 8080


and to modify /etc/apache2/sites-available/default. I basically duplicated the whole <VirtualHost entry and changed the second part to read:

<VirtualHost *:8080>
..

And now it works. From the host in Safari or using curl in Terminal:

http://127.0.0.1:8080/cgi-bin/test.py

SERVER_SOFTWARE Apache/2.2.17 (Ubuntu)
SCRIPT_NAME /cgi-bin/test.py
SERVER_SIGNATURE
Apache/2.2.17 (Ubuntu) Server at localhost Port 8080
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.1
QUERY_STRING
..
HTTP_USER_AGENT Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3
HTTP_CONNECTION keep-alive
SERVER_NAME localhost
..
SERVER_PORT 8080
..
SERVER_ADMIN webmaster@localhost
HTTP_HOST localhost:8080
REQUEST_URI /cgi-bin/test.py
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
GATEWAY_INTERFACE CGI/1.1
..
HTTP_ACCEPT_LANGUAGE en-us
HTTP_ACCEPT_ENCODING gzip, deflate



The other thing I've done today is to install EMBOSS and PyCogent.

sudo apt-get install emboss

How easy is that! The rebase files are at

http://rebase.neb.com/rebase/rebase.files.html

We want # 5 and # 31 as described. chmod for the EMBOSS directories so we can write there:

sudo chmod 777 -R /usr/share/EMBOSS
rebaseextract


tell it where the files are, and it'll do its thing.

head -5 /usr/share/EMBOSS/data/REBASE/embossre.enz > cat

# REBASE enzyme patterns for EMBOSS
#
# Format:
# namepatternlenncutsbluntc1c2c3c4
#


put a sequence file DA19.txt on the Desktop

remap -sequence DA19.txt

DA19


SgeI
| PcsI
SgeI | SgeI
Cac8I | NspI | | SgeI HindIII
| PcsI Cac8I | SgeI | | | SgeI | Cac8I
\ \ \ \ \ \ \ \ \ \ \
GACGAACGCTGGCGGCGTGCTTAACACATGCAAGTCGAACGGAGCGAATGAAAGCTTGCT

..


[ UPDATE: Something wrong with the formatting here. The HindIII site, AAGCTT, is at the far right. ]

Get Cython:

sudo apt-get install cython

Get Pycogent from http://sourceforge.net/projects/pycogent/:

tar -xzvf ~/Downloads/PyCogent-1.5.1.tgz
python setup.py build
sudo python setup.py install


I tested Pocogent by downloading sequences and making a phylogenetic tree as described here (I had to install a MUSCLE binary first). I pasted the source into four scripts.

Not exactly as before, but it looks reasonable.



Saturday, August 13, 2011

Trying Ubuntu Linux (4)

As discussed in previous posts (here, here, here), I have Ubuntu Linux 11.0.4 running under VirtualBox 4.1.0 on my Powerbook with the host running OS X Lion 10.7 (in a second partition, actually). I set up and tested Apache Server 2.2 on the guest. Now I'd like to access the guest server from the host machine, and later the other machines on my Wi-Fi network. I haven't yet succeeded, so yesterday I asked a question on StackOverflow, which got moved by someone to a related site, "serverfault" (here).

I got a couple of good suggestions, but didn't yet solve my problem. However, there are a bunch of "related questions" in the sidebar that look promising. Time to be (even more) systematic.

The VirtualBox manual (here) has a section: Configuring port forwarding with NAT.

So it's pretty clear that we could stay with NAT. In that case we need to do "port forwarding," although other people have suggested using "bridged mode." In the NAT method, we simply instruct the VM (as we would a router) that packets arriving on certain ports should be "forwarded to the guest, on the same or a different port." The manual says to do this from the command line in the host (the first line is their template, the second my implementation):

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"
VBoxManage modifyvm Ubuntu --natpf1 "apache,tcp,,8888,,80"

There are six fields in the last argument: a name, which is "purely descriptive", the protocol for forwarding, and then two sets of an ip address and port. So, this example "forwards all TCP traffic arriving on the localhost interface (127.0.0.1) via port 2222 to port 22 in the guest":

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"

From the docs
Forwarding host ports < 1024 impossible:
On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible to bind to ports below 1024 from applications that are not run by root. As a result, if you try to configure such a port forwarding, the VM will refuse to start.

So that's why we used 8888. Under Port Forwarding we forward (in the second example) from the host port 8888 to the guest port 80.

I used the GUI to set this.




I believe we should not have to do the command line version. Just to be safe, I remove the forwarding rule I set when playing around, by doing this from the command line:

VBoxManage modifyvm Ubuntu --natpf1 delete "apache"

And then repeated setting up forwarding in the GUI (Settings > Network). To be sure that everybody has got the word, we:

Quit Ubuntu
Restart VirtualBox
Restart Ubuntu
Restart Apache with:

sudo /etc/init.d/apache2 restart

But it doesn't work. From the guest, I point Firefox at localhost or 127.0.0.1 and I can see the index page or run my scripts. Note that this works even though the Apache restart gave this message:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

But from Safari on the host with the same ip address I get "Safari can't connect to the server" and if I add the port (127.0.0.1:8888) it just hangs. 127.0.1.1 also doesn't work.

Now, what could be wrong? From serverfault (here):

Iain says to try bridged mode.

I tested that early on but it didn't make any difference. Also, the docs clearly say that NAT should work. I'll have to test some more, but first..

Eric Fortis says:

"then from the host PC browser access the IP of the Ubuntu virtual machine, instead of 127.0.0.1. ifconfig will show you your IP."

te@VB:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:88:33:a4
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe88:33a4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:122 errors:0 dropped:0 overruns:0 frame:0
TX packets:182 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:43296 (43.2 KB) TX bytes:23263 (23.2 KB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1642 (1.6 KB) TX bytes:1642 (1.6 KB)


If I'm reading this correctly, the second entry is for "local loopback", that is, it doesn't go through the virtual network card. And the first one uses eth0. So that might make a difference (Ethernet v. Wi-Fi)

Also, the ip address is 10.0.2.15, which I think should not be visible beyond the "router"---the VM.

The third comment is from anthonysomerset:

is apache in your vhost configured to listen on the correct ports? this will work in bridged or nat mode, also check any firewall rules in the guest and that network access works out of the guest as well.

So:
- this will work in bridged or NAT
- make sure the Listen directive is correct
- check the firewall
- check that network access works out of the guest

The guest is set up to listen on port 80. That is the standard port set up in Apache. I wrote a Python script to filter comments (filter.py) and do:

python filter.py /etc/apache2/apache2.conf

Include mods-enabled/*.load
Include mods-enabled/*.conf
Include httpd.conf
Include ports.conf
..
Include conf.d/
Include sites-enabled/


So there are lots of places to look for possible conflicts! Luckily, httpd.conf is empty. ports.conf:

..
NameVirtualHost *:80
Listen 80
..


I'm not quite sure about the first one, but the Listen part is correct.

Firewall rules are here (at least, some are):

te@VB:/etc/apache2/sites-available$ python ~/Desktop/filter.py default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
# Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
..


Skipping the script stuff, this has been edited from my previous rule restricting access to go back to Allow from all.

About checking network access from the guest: if he means accessing a server on the host machine, I haven't tried that yet. But of course, Firefox works.

So, out of all this, the only thing I can see is that I don't know what this stuff is about.

NameVirtualHost *:80
<VirtualHost *:80>


I tried switching from Wi-Fi to Ethernet in the host, but that didn't help.

I'm going to have to look through all the other posts related to this topic. But it seems like it's getting to be too hard, after all, I used VirtualBox to make things easy.

Friday, August 12, 2011

Trying Ubuntu Linux (3)

I have an idea that someday I might try to teach students how to set up a web site (for example, EMBOSS on a local network would be nice). Python would be a perfect fit and it should be fun and extensible. I would probably want a neutral platform to do that (since most would be trained on Windows and I know nothing except OS X), so I looked into adding Apache Server to my Ubuntu 11.0.4 Desktop install (posts here and here).

There is a nice guide on the web from Ubuntu (here), and some simple instructions are here, and the Apache docs are here. I could have started by grabbing the Server version of Ubuntu, but instead I did:

sudo apt-get install apache2

As easy as that. Start and stop commands:

sudo /etc/init.d/apache2 start

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 restart

To test it, just use Firefox and point it at localhost or 127.0.0.1. The index page is at /var/www/index.html (the "document root" is /var/www). If you want to get a little fancier, you can grab PHP:

sudo apt-get install php5 libapache2-mod-php5

sudo /etc/init.d/apache2 restart

And put this in /var/www/test.php:

<?php phpinfo(); ?>

Go to localhost/test.php and it should print a bunch of details about your setup.

I spent a lot of time working on access control (Apache docs here). I should probably have read the VirtualBox guide first (here):
A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router. The "router", in this case, is the VirtualBox networking engine, which maps traffic from and to the virtual machine transparently. The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet; you cannot run a server this way unless you set up port forwarding (described below).

Actually, we will want to do this later. A lot of time was wasted because I followed the "simple" instructions (e.g. Apache's) and couldn't figure out why stuff didn't work.

It turns out that although /etc/apache2/apache2.conf and /etc/apache2/httpd.conf have relevant settings there are a bunch of other files (in directories under /etc/apache2/). If you want to change access to the document root or scripts, you have to modify /etc/apache2/sites-available/default. Guess I should have read the first page (here) of the Ubuntu Server docs. It's right there!

Here is part of the file in the original form:

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

I'm not sure what all of this does, but using ScriptAlias means that (Apache docs again):
The ScriptAlias directive tells Apache that a particular directory is set aside for CGI programs. Apache will assume that every file in this directory is a CGI program, and will attempt to execute it, when that particular resource is requested by a client.

I just modified /usr/lib/cgi-bin/ to be /home/te/cgi-bin/.

And, since we will ultimately care about access permissions, you should read (at least) this page of the docs, which explains that

		Order allow,deny

is explained as:
Allow,Deny
First, all Allow directives are evaluated; at least one must match, or the request is rejected. Next, all Deny directives are evaluated. If any matches, the request is rejected. Last, any requests which do not match an Allow or a Deny directive are denied by default.
Deny,Allow
First, all Deny directives are evaluated; if any match, the request is denied unless it also matches an Allow directive. Any requests which do not match any Allow or Deny directives are permitted.

I copied from further down in the file (about access to /usr/share/docs) to the ScriptAlias directive above:

        Order deny,allow

Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

The subnet masking stuff will need an explanation of its own.

So now, I can put the first script from the second part of this post (that prints data from os.environ in cgi-bin under my home directory, and it works.


Thursday, August 11, 2011

Trying Ubuntu Linux (2)


I'm installing software on Ubuntu 11.0.4 (in a Virtual Box VM running under OS X Lion) and my standard test is matplotlib. To begin with, Ubuntu 11.0 has python but does not have numpy. So, let's start there.

I found build instructions here, but didn't actually follow them. Instead, I took their advice and used apt-get. While I was still thinking I would build everything I did:

sudo apt-get install gfortran

sudo apt-get install python-dev

And then I went after BLAS, and LAPACK. Based on the library name on this page, I did:

sudo apt-get install libblas3gf

And using the library name from this page, I did:

sudo apt-get install liblapack3gf

Then, I just did:

sudo apt-get install python-numpy

And, amazingly enough, it works:

>>> import numpy

>>>

Now:

sudo apt-get install zlib-bin

sudo apt-get install libpng3
sudo apt-get install libfreetype6
sudo apt-get install python-matplotlib
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.5/tcl8.5_8.5.9-2_amd64.deb Something wicked happened resolving 'us.archive.ubuntu.com:http' (-5 - No address associated with hostname)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Oops..

sudo apt-get update


And now it gets tcl8.5

What else to do for matplotlib?
Nothing!

We'll try the example from here, and we get a png in the right place, which I just double click and get the graphic at the top. Here is the whole Desktop:



I really can't take any credit for this. I am very impressed speechless with the Ubuntu dev guys.

[ UPDATE: Did the same apt-get for scipy and the test at the bottom of this post works too! ]

Trying Ubuntu Linux (1)

I thought I would play around with Linux a bit, trying to improve my Unix skills. I'm running it in a second partition on my Macbook that has OS X Lion installed (post here) and runs a Virtual Box VM.

I first heard about and tried Oracle's Virtual Box in connection with QIIME (post here).

I grabbed a VirtualBox version 4.1 binary installer for Mac OS X here.

Then I downloaded Ubuntu Linux 11.04 (now why is it called Natty Narwhal?) from here. There is another download page here but I think it has the same choices.

I ended up trying both Desktop "CD"s, because I was a little confused about the version I needed. There appears to be only 32-bit for i386 (ubuntu-11.04-desktop-i386.iso) but 64-bit for AMD (ubuntu-11.04-desktop-amd64.iso). However, the chip running the host OS is not relevant. The QIIME Linux is labeled AMD64 and is 64-bit and can run on my 64-bit machines under a VM. I suppose it would matter if I wanted to run Linux directly in the partition instead of in Virtual Box.

I have to confess, I've installed several different Linux versions (and then removed them) and the one described here a number of times, because I ran into problems with the install that I couldn't figure out how to back out of. But experimentation is relatively cheap, since it's just a VM. I don't have any worries about leftover crap on my disk. If worst comes to worst I can just erase the whole partition. Although it takes patience for the install steps.

Stock 64-bit Ubuntu Linux


So, I ran the Virtual Box installer, set the Name as Ubuntu, Operating System as Linux and the Version as Ubuntu 64. Then I set up the VM with all standard options (except 1 GB for RAM). Just click on through.

To actually install Linux using a .iso file, use the "First Run Wizard" by double-clicking the new machine in the list. For Select Installation Media: I navigated to the saved file. On one try I somehow got past the Wizard without properly installing and had to delete and re-configure the VM.

It takes quite a while to boot the first time, copying all the files over to the VM, I guess. Choose Erase disk and install Ubuntu (the disk size should be only the size of the VM disk). There are a bunch of dialogs to go through. After the install and reboot we get a message that Unity won't run on our hardware and so we're going to get Classic. Oh well.

Reboot..

Now, there are two things that seem really important to have but are not present in this stock install:

• a Shared Folder for file sharing between host and guest OS
• a Clipboard for copy/paste between host and guest OS

To have these features you must install what are called the "Guest Additions," which are additions to the Linux kernel. Some instructions are on this page:

After you have installed the Linux Guest system, there are a few additional packages needed for the Guest Additions. These packages enables you to create kernel modules. For Debian and Debian based distro's like Ubuntu, you need the following packages:
dkms
build-essential
linux-headers-generic


Find the Terminal (why not just drag it to the menu bar) and do:

sudo apt-get install dkms build-essential linux-headers-generic

You'll have to type in the command, since copy/paste doesn't work yet :)
When it's done:

Reboot to make the changes effective..

Next, "mount" the Guest Additions "iso": in the VB menu (in OS X) under Devices, choose Install Guest Additions. It shows up as a CD on the Desktop. Then from the dialog choose the default that automatically runs the shell script. Or hit Open AutoRun Prompt > OK and then in Terminal do:

media/VBOXADDITIONS{version}/VBoxLinuxAdditions.run

After it's done, reboot again..

At this point, copy/paste between host/guest should work. You'll have to click twice, once to switch focus to the VM and once to switch focus again to whatever application is receiving the paste.

There are two different key combos for Linux and neither is CMD. Not sure if this is standard Linux or it is just since the left CMD key is a special key for the VM. To copy and paste within Terminal on Linux use CTL-SHIFT-x and CTL-SHIFT-v rather than CMD (for Text Edit just use CTL-x and CTL-v).

Now we can try to get shared folders. In the Virtual Box window, from the Devices menu choose Shared Folders. Add a folder (navigate the host OS to the desired path). Also, make a folder under Linux that we'll use to share with, say /home/telliott/Desktop/share

In the dialog, choose Automount (and Make Permanent, see below). Even after the specification of a shared folder, you still have to mount it within Linux. The Qiime guys do:

sudo mount -a

Unfortunately, it doesn't seem to work for me. (Not in the Qiime install either). So then I tried this:

sudo mount -t vboxsf -o uid=1000,gid=1000 shared ~/Desktop/share

The first argument after vboxsf above is the name of the folder on the host OS (as defined by us in the Devices menu above). The second argument is the name of the sharepoint --- the path to a folder on the Guest.

It didn't work at first, because it turned out, I had failed to check Automount above. And, if you want to make a change to the Shared Folder setting, it seems that you have to reboot to be able to actually do it, otherwise there's a message about the resource being in use.

Also, I never did figure out how to change Make Permanent. Any change or attempt to delete in the Shared Folders dialog (even after a reboot) gives an error message: VERR_PERMISSION_DENIED. There's a note in the link about putting the mount command in

/etc/rc.local

but I don't see how that's going to work since it needs to run as root? Luckily, the VM allows me to suspend Linux in its current state. And now, thinking that I need to re-run that command every time upon booting, I try it and get:

sudo mount -t vboxsf -o uid=1000,gid=1000 shared ~/Desktop/share
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument


After re-boot, the same mount fails! I am starting to get angry with this thing.

I gave up and set up Dropbox access from within the VM. It works great.

Now, to build some software.