The Coding Notebook
Memorable coding moments of a software engineer
Installing Ubuntu Server on VMware
Today I installed Ubuntu Server on VMware, this is note to self about the process, so if I'll have to do it again I'll have a reference...


# The Process
1. Take this opportunity to update to the latest VMware Player (free)
1. Download Ubuntu Server(64 bit) iso installation file from [here](http://www.ubuntu.com/download/server)
1. In VMware Player open the "New Virtual Machine" wizard, choose "Installer disc image file (iso)", and choose the file downloaded above
1. Configure the machine as wanted (I choose 2 core CPUs and 1024MB RAM)
1. Let the VMWare Easy Installation do its magic (can ignore the VMware tools now)
1. Once in the machine update the "sudoers" file (can skip this if you don 't mind entering your password anytime you sudo something):
    - `sudo visudo`
    - find an empty spot and enter (replace `YourUsername` with your own username):
    `%YourUsername ALL=(ALL) NOPASSWD: ALL`
1. Update the hostname if wanted (default is ubuntu):
    - `sudo hostname`
    - `sudo nano /etc/hosts` and update `127.0.1.1` address to the new name
1. Install SSH server:
    - `sudo apt-get update`
    - `sudo apt-get install openssh-server`
    - Under home dir create ".ssh" folder and chmod it to 700:
    - `cd && mkdir .ssh && chmod 700 .ssh`
    - `cd .ssh && touch authorized_keys && chmod 600 authorized_keys`
    (Then put the public key inside the authorized_keys file).
1. Install make/gcc and other development tools (note this is required for VMware tools as well)
`sudo apt-get install build-essential`
1. Time to install VMware tools, from the Player menus (when the machine is selected):
`Player --> Manage --> Install VMware Tools...`
Now this may give error that "easyinstall is in progress", it is not, the following solution was taken from VMWare knowledge base article [1017687](https://kb.vmware.com/s/article/1017687)
    - `sudo shutdown now`
    - Remove the Floppy and DVD devices from the machine
    - Add the devices back, make sure DVD is not pointing to any iso file but set to "Use Physical Device"
    - Power on the machine
    - And again: `Player --> Manage --> Install VMware Tools...`
    Follow the installation instructions from VMWare knowledge base article [1022525](https://kb.vmware.com/s/article/1022525)
1. If wanted a shared folder between your Ubuntu and PC, from within the Player, right click on the machine `Settings --> "options" tab --> "shared folder" --> Add...`
Follow the instructions, at the end the shared folder is mounted to `/mnt/hgfs`

# Extra Stuff
1. Install git: `sudo apt-get install git-core`
1. Make a nicer prompt (PS1):
    - `sudo nano ~/.bashrc`
    - At the end of the file put the new PS1, then one I like is:
`PS1='\[\033[00;31m\]\u@\h \[\033[00;33m\]\w\[\033[00;32m\] $(__git_ps1 "(%s)")\[\033[00;37m\]\n$ '`
1. Install node.js following these [instructions](https://github.com/nodesource/distributions/blob/master/README.md#debinstall)
1. If wanted to start the VM without using the Player GUI you'll have to install VMware VIX SDK, and then to start:
`"c:\Program Files (x86)\VMware\VMware VIX\vmrun.exe" -T player start [path to VM .vmx file] nogui`

OK, that's about it !!