Added a root permission check before installing

You need to be root or to have root privileges to be able to install packages using apt-get