Install Ubuntu in XenServer

4 minute read

Installation and config steps

  1. Right click on the server click on new VM
  2. Select your preferred configuration
  3. Attach installation iso (e.g. Ubuntu 16.04 x64.iso)
  4. Start the VM
    • If you face the error after creating a VM, that it cannot boot any ISO or CD Image to install your system, probably the boot order is not correctly set.
    • Login to XenServer with secure shell
    • Find the VM uuid by xe vm-list
    • Check the boot parameter first by xe vm-param-list uuid=<vm-uuid> |grep HVM-boot
    • Set the boot order by xe vm-param-set uuid=<vm-uuid> HVM-boot-policy=BIOS\ order HVM-boot-params:order=dc
  5. Proceed the Installation process
  6. Configure apt:
sudo vim /etc/apt/apt.conf
  • Put these lines in it:
Acquire::http::proxy "http://user:pass@proxy:port";
Acquire::https::proxy "https://user:pass@proxy:port";
  • If you have configured local repository, you can add its address as the proxy.
  1. Configure network:
$ sudo apt-get purge network-manager
$ sudo vim /etc/network/interfaces
# E.g.

auto eth0
iface eth0 inet static

$ sudo ifup eth0
$ sudo ifdown eth0
$ sudo ifup eth0
  1. Attach xen-tools.iso to the VM
  2. $ sudo mount /dev/sr0 /media
  3. $ sudo /media/Linux/
  4. Reboot VM
  5. $ sudo apt-get update
  6. Install a good editor with sudo apt-get install vim
  7. Install ssh server with sudo apt-get install openssh-server
  8. Install Java with sudo apt-get install openjdk-8-jdk
  9. Install git with sudo apt-get install git
  10. Install maven with sudo apt-get install maven
  11. Install axel with sudo apt-get install axel
  12. Install gradle with sudo apt-get install gradle
  13. Install npm with sudo apt-get install npm
  14. Install bower with sudo npm install -g bower
  15. Put these useful aliases in .bashrc
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ls='ls --color'
alias c='clear'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../../'
alias .2='cd ../../'
alias .3='cd ../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
alias mkdir='mkdir -pv'
alias diff='colordiff'
alias h='history'
alias histg="history | grep"
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
alias vi='vim'
alias svi='sudo vi'
alias vis='vim "+set si"'
alias edit='vim'
alias ports='netstat -tulanp'
alias su='sudo -i'
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown'
alias meminfo='free -m -l -t'
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'
alias wget='wget -c'
alias df="df -Tha --total"
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e"
alias top="htop"
alias myip="curl; echo"
alias DU="du --max-depth=1 -B M |sort -rn"
alias filecount="find . -type f 2> /dev/null | wc -l"
alias make='make -j8'
alias my-sbatch-report='sacct -aX -o jobid,jobname%36,NNodes,NCPUS,start,elapsed,state -u sojoodi'
alias sbatch-report='sacct -aX -o jobid,jobname%36,NNodes,NCPUS,start,elapsed,state'
  1. Create multiple users
  • Open a terminal and type: vim /tmp/name to create a file and the names of the users. e.g:
$ cat /tmp/name
  • Create User with Home Dir and default shell:
for i in `cat /tmp/name`; do useradd -m -d /home/$i -s /bin/bash $i; done
  • Create password for each user:
  • for i in cat /tmp/name; do passwd $i; done
  1. Configure remote desktop connection
sudo apt-get install xfce4 xrdp
sudo apt-get install xfce4-terminal
sudo apt-get install gnome-icon-theme-full tango-icon-theme
echo xfce4-session >~/.xsession
  • Put this line instead of the last line in this file /etc/xrdp/
sudo service xrdp restart
  1. To make your prompt status look nicer, put this line in .bashrc:
export PS1="\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]\[\033[0m\]\n$ "