Installation of Ubuntu 12.10 with Unity on VMWare

A while ago I posted a "how-to" doubling as a check list for installing Linux on VMWare and later I've added other posts full of little hints and reminders (e.g. fonts, keymaps). A few years later and that information is still valid, however my workflow has changed a bit, so here's a new post based on Ubuntu 12.10 (Quantal Quetzal) trying to consolidate everything into one big list.

Ingredients

  • A downloaded ISO image of your favourite distro (Ubuntu, Debian, Mint)
  • A newly created virtual machine with 1-1.5GB of RAM, a 20-40GB disk and a couple of CPU cores.

Installation

Mount the ISO image to your VM and boot it up, then follow the instructions to install your distro selecting your preferences (timezone, keyboard layout, etc.). It helps if your Linux account has the same username as the one on your host OS - it helps when accessing your computer via ssh.

Once the installation finishes and the VM boots up, log in with your newly created user account and password and admire the new clean desktop. It won't last long.

Change the Screen Resolution, Keyboard and Mouse speed

At this point I always change the screen resolution from the default 800x600 to something more appropriate that fits in your monitor (I assume you don't have a CRT from the late 90s), even though this is short-lived as we are installing VMWare tools with automatic screen resizing a bit later.

What I also do at this point, is set up the keyboard's repeat keys delay and speed, and the mouse's acceleration and sensitivity to my preferred values.

Terminal

Hit Ctrl+Alt+T to start the terminal, your new best friend. Ubuntu Quantal uses Unity by default, so the terminal's icon will appear on the launcher(dock) on the left. Right-click and "lock to launcher" if you'd like to keep this permanently pinned there.

Enable root account (optional)

To enable the root account (disabled by default on Ubuntu) type:

sudo passwd

Type your own password first, then choose a really difficult one for the root user (type it twice).

Log in as root if you can't be bothered to sudo all the time (I give you a waiver today just because it's installation time, normally you should sudo like a good user):

su - root

Update local apt package system and install ssh

sudo apt-get update
sudo apt-get install ssh

Install VMWare tools

Before installing VMWare tools we need to make sure that we have "make" and the gcc compiler, so quickly type:

sudo apt-get install make
sudo apt-get install gcc

On the latest Ubuntu these are installed by defaults, but it doesn't hurt it you just ensure they are there.

Install vmware tools by choosing VM -> Install VMWare tools... from VMWare Workstation's menu. This will mount a virtual DVD-ROM image that contains the VMWare tools tar archive. Extract it somewhere then from the command line change to that directory () and type:

sudo ./vmware-install.pl

When the VMWare tools are installed, restart your VM and log in as your user. You can now resize the desktop by using VMWare's menu View -> Autosize -> Autofir Guest, and you could always go full screen if you prefer.

Download and Install Chrome

Time to get a serious browser, so get out to a terminal window and install one dependency that I've found critical:

sudo apt-get install libgconf2-4

Google "Chrome download", download it and install it by getting out to the terminal again and typing in the directory where the .deb file has been downloaded to.

sudo dpkg --install google-chrome-stable_current_i386.deb

If you see any dependency errors like Errors were encountered while processing: google-chrome-stable, type the following to fix it:

sudo apt-get install -f

Install additional software

I would assume here that everybody has their own list, mine contains the following:

sudo apt-get install apache2
sudo apt-get install mercurial
sudo apt-get install git
sudo apt-get install curl
sudo apt-get install zip

Install additional desktops

Performance on VMs can be really bad, so here's how to install additional desktop environments if you feel that Unity is too much. It certainly is dog-slow on my 4-year old VAIO.

sudo apt-get install gnome-session-fallback
sudo apt-get install xubuntu-desktop 

After installation you can log-off and change the desktop environment from the login screen (click button next to your username).

Install Sublime Text 2

Everybody has their favourite editor, I won't get into the VI vs Emacs flame here. My favourite (of recent) text editor for all OS's is Sublime Text 2, if you haven't tried it yet you are half a (wo)man.

To install it follow the excellent instructions from technoreply.com.

Next, run it and from the menu choose Preferences -> Settings - User. I usually have the following settings:

{
  "bold_folder_labels": true,
  "font_face": "DejaVu Sans Mono",
  "font_size": 9,
  "highlight_modified_tabs": true,
  "rulers": [80,128],
  "show_tab_close_buttons": true,
  "translate_tabs_to_spaces": true,
  "tree_animation_enabled": false,
  "trim_automatic_white_space": true,
  "trim_trailing_white_space_on_save": true,
  "use_tab_stops": false
}

If you don't know what to put in the User preferences, you can see a full list with explanatory comments in Preferences -> Settings - Default, but be careful not to edit that file as those settings will be lost if you upgrade to the next Sublime patch.

For key bindings I leave everything as is, with the exception of two keystrokes taht stayed with me from the 80s. As I was too young and innocent I haven't managed to get over them no matter how many text editors and operating systems I've changed. From the menu again, choose Preferences -> Key Bindings - User and edit to your heart's content. I do this:

[
    { "keys": ["ctrl+t"], "command": "delete_word", "args": { "forward": true } },
    { "keys": ["ctrl+y"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }
]

.bashrc

With the editor sorted out, it's time to change music... errm, some Linux settings I mean.

(U2 - Out of control just came up on my playlist, what a fantastic and uplifting tune this is - a real blast from the past!)

I'm not going to go into too much detail here, .bashrc settings are personal choice. My current list of general customisations includes:

# ==============================================================================
# == My Settings and Aliases
# ==============================================================================

# correct the key to the right of the left-shift in UK-keyboards to work when
# using US-keyboard layout (like me)
xmodmap -e "keycode 94 = backslash bar"

alias l="ls -lFa --color=auto"
alias la="ls -FA --color=auto"
alias ll="ls -lF --color=auto"
alias src="source ~/.bashrc"

# ==============================================================================
# == End of My Settings and Aliases
# ==============================================================================

# ==============================================================================
# == Functions
# ==============================================================================

function prompt() {
  case "$1" in
    'red')    export PS1="\n\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[0;31m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'green')  export PS1="\n\[\033[1;32m\]\u\[\033[1;37m\]@\[\033[0;32m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'yellow') export PS1="\n\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[0;33m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'blue')   export PS1="\n\[\033[1;34m\]\u\[\033[1;37m\]@\[\033[0;34m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'purple') export PS1="\n\[\033[1;35m\]\u\[\033[1;37m\]@\[\033[0;35m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'cyan')   export PS1="\n\[\033[1;36m\]\u\[\033[1;37m\]@\[\033[0;36m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] ";;
    'grey')   export PS1="\n\[\033[1;37m\]\u\[\033[1;37m\]@\[\033[0;37m\]\H\n\[\033[0m\][\[\033[1;37m\]\w\[\033[0m\]] ";;
    *) echo "Use: red, green, yellow, blue, purple, cyan or grey"
  esac
}

# ==============================================================================
# == End of Functions
# ==============================================================================

# ==============================================================================
# == Prompts
# ==============================================================================

# Red theme:
# export PS1="\n\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[0;31m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# Purple theme:
# export PS1="\n\[\033[1;35m\]\u\[\033[1;37m\]@\[\033[0;35m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# Blue theme:
# export PS1="\n\[\033[1;34m\]\u\[\033[1;37m\]@\[\033[0;34m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# Yellow theme:
# export PS1="\n\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[0;33m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# Cyan theme:
# export PS1="\n\[\033[1;36m\]\u\[\033[1;37m\]@\[\033[0;36m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# Grey theme:
# export PS1="\n\[\033[1;37m\]\u\[\033[1;37m\]@\[\033[0;37m\]\H\n\[\033[0m\][\[\033[1;37m\]\w\[\033[0m\]] "

# Green theme:
export PS1="\n\[\033[1;32m\]\u\[\033[1;37m\]@\[\033[0;32m\]\H\n\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] "

# ==============================================================================
# == End of Prompts
# ==============================================================================

Using ssh with Public Key Authentication

The final part of my setup on VMWare is to install my public key from the host onto the VM so that I can use key authentication. For the remainder of this section I will assume we are using cygwin on Windows.

On your PC (client), you need to generate a key pair. Using cygwin type:

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ksymeon/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:
Your identification has been saved in /home/ksymeon/.ssh/id_rsa.
Your public key has been saved in /home/ksymeon/.ssh/id_rsa.pub.
The key fingerprint is:
e8:bb:5f:d5:e0:f1:49:88:01:38:c1:cd:7d:b4:94:99 xxxxxxx@xxxxxx

You now have the public and private keys in your .ssh folder on your cygwin install.

Next thing to upload your public key to your linux VM (let's assume you called it "linuxvm"). The content of your public key needs to be added to the ~/.ssh/authorized_keys2 file on the VM. You can have multiple authorised keys for your account. I use different keys for each different machine I use to connect to my servers, i.e. my laptop has a different key than my desktop.

Using cygwin log in to your linux XM:

ssh linuxvm

Create the .ssh folder under your home (~) folder:

mkdir .ssh
chmod 700 .ssh

Open another local cygwin shell, copy your public key securely to your linux VM:

scp id_rsa.pub linuxvm:~/.ssh/temp.pub

From your remote cygwin shell, get into your .ssh folder and check the temp.pub is there:

cd .ssh
ls -lFa

Append the public key to your authorised keys and delete it:

cat temp.pub >> authorized_keys2
rm temp.pub

Now, back to you cygwin prompt, try to ssh again into your linux box:

ssh linuxvm
Enter passphrase for key '/home/xxxxxx/.ssh/id_rsa':

Instead of your password, now the passphrase is required unless you've left it empty.

You can now add your public key to other accounts, for example the root account if you would like to log in as root directly from your PC. Otherwise you can always log in as yourself and 'su - root' after you are in.

Conclusion

Customisations on Linux are endless. My next step, for example, is to customize the UI, colors, create new terminal profiles, add new fonts.

This post is only the beginning - I've just tried to write up my basic checklist after I install a new VM. Thanks for reading and I hope there's a few tips above for your own installs.

Comments

Unknown said…
Can we add few more rules to the Sublime list?

"save_on_focus_lost": true,
"ensure_newline_at_eof_on_save": true,
TODO: Update this:

sudo apt-get install mercurial
sudo apt-get install git
sudo apt-get install make
sudo apt-get install ssh

sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime

gnome-desktop-environment

Popular posts from this blog

GetDIBits vs. Scanline vs. Pixels[] in Delphi Bitmaps

Installation of Mint 17.1 Cinnamon on VMWare

Chrome Packaged Apps