sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo cat <<- LEADING_TABS_IGNORED | sudo tee -a /etc/apt/preferences
Package: gcc-7
Pin: release n=zesty
Pin-Priority: 990
LEADING_TABS_IGNORED
sudo cat /etc/apt/preferences
sudo apt-get update
sudo apt-get install gcc-7
note how here document can be redirected to a file with root priviledges: pipe to a tee -a
command run by root
sudo apt-get install build-essential checkinstall
sudo apt-get install cvs subversion git-core mercurial
sudo chown $USER /usr/local/src
sudo chmod u+rwx /usr/local/src