Virtual machine

The fastest way to experiment with iSpec on any platform (Mac, Windows, Linux and Solaris) is to download the ready-to-use virtual machine with iSpec and all its dependencies already included (i.e. python packages and compilers). To run it, the only necessary step is to install the sofware for running virtual machines named VirtualBox (free software):

  • Go to the "Download" section of VirtualBox website, download the VirtualBox package for your platform and install it. A reboot might be necessary.
  • Download the "VirtualBox Extension Pack" too (platform independent), executed it and it will be automatically integrated into your installation of VirtualBox.
  • Once installed, download the iSpec virtual machine, open it (double click) and import it.
  • The new virtual machine will be listed in VirtualBox, now it can be run by selecting it and clicking Start

By default, the virtual machine will show the Xubuntu Desktop with an icon that launches iSpec. Additionally, iSpec can be found in the directory /home/virtual/iSpec/ in the virtual machine.

It is possible to share a folder from your real computer to the virtual one, thus files can be easily accessed from it. To activate that option, go to Settings - Shared folders and add a shared folder by clicking on the plus sign. It is important to mark the Auto-mount option to have an easier access from the virtual machine. It is possible that a virtual machine reboot is needed. The shared folder can be accessed from the virtual machine by double clicking the folder media on the Desktop.

How the virtual machine was built?

This are the instructions to follow in case the user wants to build his/her own virtual machine obtaining the same result as the machine that can be already downloaded:

  • Install VirtualBox platform packages that corresponds to your system
  • Download Ubuntu 16.04 64 bits minimal ISO
  • Create a virtual machine and in the setting, assign the Ubuntu ISO file to the CD device
  • During the installation:
    • In the package selection, chose "Xubuntu minimal installation"
    • Machine name: virtual
    • User name: virtual
    • Chose to execute security updates automatically
  • After the installation, go to settings and de-assign Ubuntu ISO file fromt he CD device
  • Start the virtual machine again, log in and click on "Devices -> Insert Guest Additions CD image..." in the VirtualBox menu
  • A CD will be mounted automatically inside the virtual machine, open it using the file browser, right click, select "open a terminal" there and run:
    sudo bash VBoxLinuxAdditions.run
    sudo addgroup virtual vboxsf 
  • Create the file '/etc/lightdm/lightdm.conf.d/10-xubuntu.conf' with the content:
    [SeatDefaults]
    autologin-user=virtual
    autologin-user-timeout=0
    user-session=xubuntu
  • Reboot the virtual machine.
  • Open a terminal and install:
    sudo apt-get update
    sudo apt-get dist-upgrade -y
    sudo apt-get install synaptic --no-install-recommends
    sudo apt-get install -y --no-install-recommends build-essential gfortran libncurses5-dev libblas-dev liblapack-dev libatlas-base-dev libfreetype6-dev libpng-dev libhdf5-dev
    sudo apt-get install -y --no-install-recommends htop git git-gui exuberant-ctags tmux sqlite3 sshfs
    # vim 8.0
    sudo add-apt-repository -y ppa:jonathonf/vim
    sudo apt-get update
    sudo apt-get install -y --no-install-recommends vim
    sudo apt-get install -y --no-install-recommends python python-dev python-tk python-qt4 python-pip python-pandas python-numpy python-scipy python-matplotlib python-setuptools
    sudo pip install --upgrade pip
    sudo pip install --upgrade pandas
    sudo pip install wheel
    sudo pip install jupyter
    sudo pip install pudb
    sudo pip install astropy
    sudo pip install cython
    sudo pip install pyflakes
    sudo pip install scikit-learn
    sudo pip install lockfile
    sudo pip install patsy
    sudo pip install statsmodels
    sudo apt-get install -y --no-install-recommends xfce4-cpugraph-plugin xfce4-xkb-plugin
    sudo apt-get install -y --no-install-recommends firefox
  • Go to settings, keyboard, layout and add French, Spanish and English (US)
  • Add to the panel the CPU Graph and the Keyboard layouts plugins
  • Configure vim:
    cd $HOME
    mkdir -p .vim/undodir/
    mkdir -p .vim/spell/
    mkdir -p .vim/autoload/
    cd $HOME/.vim/autoload
    wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    cd $HOME
    git clone https://github.com/marblestation/vim-complex-sensible
    cp vim-complex-sensible/vimrc .vim/vimrc
    ln -s .vim/vimrc .vimrc
    rm -rf vim-complex-sensible/
    cd $HOME/.vim/spell/
    wget http://ftp.vim.org/vim/runtime/spell/en.utf-8.spl
    wget http://ftp.vim.org/vim/runtime/spell/en.utf-8.sug
    wget http://ftp.vim.org/vim/runtime/spell/es.utf-8.spl
    wget http://ftp.vim.org/vim/runtime/spell/es.utf-8.sug
    wget http://ftp.vim.org/vim/runtime/spell/fr.utf-8.spl
    wget http://ftp.vim.org/vim/runtime/spell/fr.utf-8.sug
    wget http://ftp.vim.org/vim/runtime/spell/ca.utf-8.spl
    wget http://ftp.vim.org/vim/runtime/spell/ca.utf-8.sug
    cd $HOME
    vim +PlugInstall +qall
  • Create the file '$HOME/.bash_profile':
# Unmap ctrl+s
stty stop undef

# Ignorar comandos duplicados y espacios en blanco delante (default blank)
export HISTCONTROL=ignorespace:ignoredups

# Save history with timestamp (default blank)
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "

alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
alias ln='ln -i'
alias vi='vim'
export EDITOR='vim'
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

if [ -f ~/.bash-git-prompt/gitprompt.sh  ]; then
    # Set config variables first
    GIT_PROMPT_ONLY_IN_REPO=1

    GIT_PROMPT_FETCH_REMOTE_STATUS=0   # uncomment to avoid fetching remote status

    # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
    GIT_PROMPT_SHOW_UNTRACKED_FILES=no # can be no, normal or all; determines counting of untracked files

    # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10

    # GIT_PROMPT_START=...    # uncomment for custom prompt start sequence
    # GIT_PROMPT_END=...      # uncomment for custom prompt end sequence

    # as last entry source the gitprompt script
    # GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
    # GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
    # GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
    source ~/.bash-git-prompt/gitprompt.sh
fi

# Execute 'tmux update-env' inside tmux to update environment variables in bash
function tmux() {
    local tmux=$(type -fp tmux)
    case "$1" in
        update-environment|update-env|env-update)
            local v
            while read v; do
                if [[ $v == -* ]]; then
                    unset ${v/#-/}
                else
                    # Add quotes around the argument
                    v=${v/=/=\"}
                    v=${v/%/\"}
                    eval export $v
                fi
            done < <(tmux show-environment)
            ;;
        *)
            $tmux "$@"
            ;;
    esac
}
  • Run the following commands to finish the bash configuration:
    echo "source \$HOME/.bash_profile" >> $HOME/.bashrc
    git clone https://github.com/magicmonty/bash-git-prompt.git /home/${USERNAME}/.bash-git-prompt
  • Create the file '$HOME/.tmux.conf':
# start a non-login shell by default for each new window
#set-option -g default-command "/opt/local/bin/reattach-to-user-namespace bash"
set -g default-command 'bash'

# Update environment variables (they should be manually updated in bash)
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
#
# Copy to .bashrc, so that 'tmux update-env' will update the previous variable in already opened bash
#
#function tmux() {
    #local tmux=$(type -fp tmux)
    #case "$1" in
        #update-environment|update-env|env-update)
            #local v
            #while read v; do
                #if [[ $v == -* ]]; then
                    #unset ${v/#-/}
                #else
                    ## Add quotes around the argument
                    #v=${v/=/=\"}
                    #v=${v/%/\"}
                    #eval export $v
                #fi
            #done < <(tmux show-environment)
            #;;
        #*)
            #$tmux "$@"
            #;;
    #esac
#}

# Replace C-b for C-a to be as similar as possible to GNU screen
set -g prefix C-a
unbind C-b
bind C-a send-prefix
bind-key C-a last-window # Conflicts with C-a C-a for going to beginning of line in bash

bind-key |      split-window -h
bind-key -      split-window -v
bind-key x      kill-pane
bind-key X      kill-window
bind-key Escape copy-mode -u

# Move between pains and not allow repetition
bind-key Up    select-pane -U
bind-key Down  select-pane -D
bind-key Left  select-pane -L
bind-key Right select-pane -R

# Start numbering at 1
set -g base-index 1

# Allows for faster key repetition
set -s escape-time 0

#set-option -g mouse-select-pane on
set-option -g status-keys vi
set-option -g bell-action any
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name,active (or not)
set-option -g visual-bell on

setw -g mode-keys vi
#setw -g mode-mouse on
setw -g monitor-activity on

#set-option -g status-utf8 on
# set-option -g status-justify centre
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 60

set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black

set-option -g message-fg black
set-option -g message-bg green

#setw -g mode-bg black

setw -g window-status-bg black
setw -g window-status-current-fg green
set -g status-interval 1 # seconds
set -g status-left '#[fg=red]#(whoami)@#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]'
set -g status-right '#[fg=green]][ #[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg) #[fg=blue]%Y-%m-%d #[fg=white]%H:%M:%S#[default]'

set -g history-limit 4096

bind r source-file ~/.tmux.conf

# New windows or panels go to the same current directory
bind c new-window -c "#{pane_current_path}"
bind \ split-window -h -c '#{pane_current_path}'  # Split panes horizontal
bind - split-window -v -c '#{pane_current_path}'  # Split panes vertically

bind -r S-Down resize-pane -D 5
bind -r S-Up resize-pane -U 5
bind -r S-Left resize-pane -L 5
bind -r S-Right resize-pane -R 5
  • Clean the system:
    sudo apt-get clean
    sudo apt-get --purge autoremove
    rm -f $HOME/.gitconfig
    rm -rf $HOME/.ssh
    export HISTFILE=/dev/null
    rm -f $HOME/.bash_history
    rm -f $HOME/.vim/undodir/*
    rm -rf $HOME/.mozilla/