Yeast Cells Fluo
######################################################################
##### Documented script to create a virtual machine with vagrant ##### 
######################################################################
Created on 2017.05.18
# This script contains commands and annotations # that will allow you to create a virtual machine (VM) using vagrant, # get into it and out, and install in it R libraries and rotines. # The interest of doing this is to then give this VM to someone else # so that he/she can use your tools that you developed in R. # In principle, you can build this vm on any machine. # In the example below, the vm is then equipped with Ubuntu 14.04 LTS. # ################################## ##### Create Virtual Machine ##### ################################## # Create a directory called VirtualMachine # Open a terminal and cd into this directory. # Create a virtual machine by running in the terminal: vagrant init ubuntu/trusty64 # This will load ubuntu 14.04 LTS box. # This will generate a Vagrantfile (txt file). # Open it and increase memory by modifying the following lines: config.vm.provider "virtualbox" do |vb| vb.memory = "8192" end # Increase virtual hard disk size (https://tuhrig.de/resizing-vagrant-box-disk-space/). # Go in the directory where the "box-disk1.vmdk" was created and save it as a .vdi disk. VBoxManage clonehd "box-disk1.vmdk" "cloned.vdi" --format vdi VBoxManage modifyhd "cloned.vdi" --resize 51200 # 50Gb # Then open virtual box interface > Configuration > Storage > click on "+" to add an hard disk > Existing > "cloned.vdi". Eventually "remove box-disk1.vmdk" within virtual box interface. ################################################### ##### Start Virtual Machine and connect to it ##### ################################################### # Switch the virtual machine ON by running in the terminal: vagrant up # note that it is essential to turn on the machine before trying to connect to it. # Connect to the virtual machine by running in the terminal: vagrant ssh # You are now in the virtual machine, under vagrant user name. # To disconnect from the virtual machine, type: exit # To turn OFF the virtual machine, type in the terminal: vagrant halt ################################################################ ##### Install R libraries and tools on the virtual machine ##### ##### ##### ##### (Needed the first time you connect) ##### ##### ##### ################################################################ # Switch ON the virtual machine and connect to it as explained above. # Once you are into it, do the following to install the libraries. # You only need to do this the first time you connect: the libraries will # then be stored on the vm (in the .vdi) and be available at later sessions. # Add R repository in your source list /etc/apt/sources.list by typing: sudo add-apt-repository "deb https://cran.rstudio.com/bin/linux/ubuntu trusty/" # Add external R repository maintained by CRAN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 sudo apt-get update # Install R sudo apt-get install r-base # Install other R packages required for the R librairies needed (not mandatory for a basic installation) sudo apt-get install r-cran-rgl sudo apt-get install r-cran-XML sudo apt-get install libxml2-dev sudo apt-get install libhdf5-serial-dev # Run R in sudo mode sudo R # Within R, install the following R packages: packages <- c("quantmod", "ggplot2", "hexbin", "RColorBrewer", "gridExtra", "latticeExtra") install.packages(packages) # Install the following bioconductor packages source("https://bioconductor.org/biocLite.R") biocLite() # Say "y" to update packages but say "n" if it suggests to update rgl only packages_biocond <- c("ncdfFlow", "flowStats", "ggcyto") biocLite(packages_biocond) ##################################################### ##### Install Latex ##### ##### ##### ##### (Needed the first time you connect) ##### ##### ##### ##################################################### # On your VM, install Latex by typing: sudo apt-get install texinfo sudo apt-get install texlive texlive-xetex texlive-latex-extra ############################################## #### Enjoy your virtual machine ##### ############################################## # Connect to your virtual machine (see above) # Once connected, you can access files of your local computer by following the /vagrant/ path directory. # the R libraries installed above now allow you to analyse data contained on your local computer, # by accessing it using this path. # # Enjoy!