Seems like master and worker are not running. You have to start the Master and the Worker nodes before invoking the Spark shell. Follow the below step to do the same.
Change the directory to sbin and give the start command.
cd $HADOOP_HOME/sbin
./start-all.sh
Give the spark-shell command to invoke the spark shell and sc should work