Skip to content

Latest commit

 

History

History
165 lines (123 loc) · 5.04 KB

File metadata and controls

165 lines (123 loc) · 5.04 KB

CS167 Virtual Machine


  1. Download the given .ova file (https://coursefiles.cs.ucr.edu/cs167-S22.ova) Note: The download is 4.96 GB.

  2. Download and install VirtualBox. There are versions for (https://www.virtualbox.org/wiki/Downloads) Warning: If you have VirtualBox installed already, please make sure you uninstall it and install version 6.1.18. Older versions of VirtualBox have known errors that can cause issues.

  3. Create a Virtual Machine by importing the given .ova file:

(a) Click on "File", then "Import Appliance...", and select the cs167.ova file. Import it, accepting all defaults. image image image

(b) After the appliance is imported, the new VM will show up. Select it, then press the large green arrow in the interface that says "Start". The virtual machine will boot up.

(c) Once it is booted up, log in to it with the username cs167 and password ChangeThisPassword!. A terminal can be opened by clicking on the "LXTerminal" icon on the desktop.

  1. Copy the following script in the setup.sh in home directory
#! /bin/bash
 
# Change to the home dir and setup the required vars
BIG_DATA_DIR=$HOME/BigData
 
JAVA_HOME=$BIG_DATA_DIR/jdk1.8.0_291
MAVEN_HOME=$BIG_DATA_DIR/apache-maven-3.8.5
HADOOP_HOME=$BIG_DATA_DIR/hadoop-3.2.3
INTELLIJ_HOME=$BIG_DATA_DIR/idea-IC-213.7172.25
 
# Download the required dependencies
download_dependencies() {
	mkdir $BIG_DATA_DIR
	cd $BIG_DATA_DIR
 
	echo "Downloading Hadoop..."
	wget "https://dlcdn.apache.org/hadoop/common/hadoop-3.2.3/hadoop-3.2.3.tar.gz"	
 
	echo "Downloading Maven..."
	wget "https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz"
	
 
	echo "Downloading IntelliJ IDEA..."
	wget "https://download.jetbrains.com/idea/ideaIC-2021.3.3.tar.gz"
  
  	cd $HOME
}
 
# Move a given file to the bigdata directory
move_to_big_data_dir() {
	cp $1 $BIG_DATA_DIR
}
 
# Extract the given .tar.gz files
extract_archives() {
	JDK_ARCHIVE_PATH=$1
 
	cd $BIG_DATA_DIR
	echo "Extracting JDK..."
	tar -xzf `basename $JDK_ARCHIVE_PATH`
	echo "Extracted JDK."
 
	echo "Extracting Maven..."
	tar -xzf apache-maven-*-bin.tar.gz 
	echo "Extracted Maven."
 
	echo "Extracting Hadoop..."
	tar -xzf hadoop*.tar.gz
	echo "Extracted Hadoop."
 
	echo "Extracting IntelliJ IDEA..."
	tar -xzf $BIG_DATA_DIR/ideaIC-*.tar.gz
	echo "Extracted IntelliJ IDEA."
}
 
# Set up the ~/.bash_profile
setup_paths() {
	touch ~/.bash_profile
	echo "export JAVA_HOME=$JAVA_HOME" >> ~/.bash_profile
	echo "export MAVEN_HOME=$MAVEN_HOME" >> ~/.bash_profile
	echo "export HADOOP_HOME=$HADOOP_HOME" >> ~/.bash_profile
 
	echo "export PATH=\$PATH:$JAVA_HOME/bin" >> ~/.bash_profile
	echo "export PATH=\$PATH:$MAVEN_HOME/bin" >> ~/.bash_profile
	echo "export PATH=\$PATH:$HADOOP_HOME/bin" >> ~/.bash_profile
	echo "export PATH=\$PATH:$INTELLIJ_HOME/bin" >> ~/.bash_profile
 
	source ~/.bash_profile 
}
 
# Run the final setup
setup() {
	# Get and check the full path of the JDK tar.gz archive
	JDK_ARCHIVE_PATH=`pwd`/$1
	if [ -z $JDK_ARCHIVE_PATH ]; then
		echo "Usage: setup.sh <JDK Path>"
		echo "Please input a valid JDK path."
		exit 1
	fi
 
	echo "Downloading required dependencies..."
	download_dependencies
 
	echo "Moving everything to the right place..." 
	move_to_big_data_dir $JDK_ARCHIVE_PATH
 
	echo "Extracting archives... could take a few minutes"
	extract_archives $JDK_ARCHIVE_PATH
 
	echo "Setting up paths"
	setup_paths
 
	echo "Done."
}
 
# Handle the command line args
case $1 in
help)
	echo "Usage: setup.sh <JDK Path>"
	;;
clean)
	rm -rf $JAVA_HOME
	rm -rf $MAVEN_HOME
	rm -rf $HADOOP_HOME
	rm -rf $INTELLIJ_HOME
	;;
*)
	setup $1   # Pass the JDK archive path to setup()
esac
  1. Create an Oracle account and download JDK 1.8 (https://www.oracle.com/java/technologies/javase-jdk8-downloads.html)

image

  1. Run
cd ~
chmod +x setup.sh
./setup.sh Downloads/<JDK_Path> 
source .bash_profile
  1. Test your setup. Run java, javac, mvn and hadoop.

  2. To run IntelliJ IDEA, open LXTerminal and run idea.sh.

Troubleshooting


  1. Virtualization not enabled in BIOS

image

Solution Follow the instructions for your computer manufacturer: https://2nwiki.2n.cz/pages/viewpage.action?pageId=75202968

  1. Kernel Driver not found (MacOS)

image

**Solution** Follow the instructions here: https://www.howtogeek.com/658047/how-to-fix-virtualboxs-“kernel-driver-not-installed-rc-1908-error/