The recommended way to install TeamViewer is from a desktop environment using a package manager such as Synaptic, Yum, or apt-get. Sometimes you find yourself in a circumstance when ssh is the only way you have access to your server. This tutorial will help you get it installed on Ubuntu Server 14.04.2.
As a reminder, TeamViewer is free for personal use. If you are using TeamViewer for commercial purposes – PURCHASE A LICENSE! Purchasing a license ensures TeamViewer will be available for years to come.
First of all, download the latest teamviewer.
TeamViewer needs a desktop manager and desktop environment to run. The Ubuntu Server edition does not have a GUI. The below command makes the server edition turn into the desktop edition and installs a command line page installer.
sudo apt-get install ubuntu-desktop gdebi -y
Next, install teamviewer with the following command. I like using gdebi because you do not have to run sudo apt-get install -f to fix dependencies.
sudo gdebi teamviewer_i386.deb
TeamViewer is now installed, but we have to jump through a few hoops to get it to allow us to remotely conenct. The first configuration we have to do is set up a password and then we need to enable the TeamViewer daemon. Both of these steps can be accomplished by doing the following:
#set up teamviewer's password
sudo teamviewer passwd password946
#make teamviewer start at boot and start if it is not currently running
sudo teamviewer daemon enable
At this point, you will be able to get your TeamViewer ID by running sudo teamviewer info; however, if you try to connect now, it will time out after you log in to your desktop environment. This is because TeamViewer requires the end user to accept their EULA. Since we installed TeamViewer over ssh, we were never prompted to accept the EULA. If you were to watch the monitor of the server, you would see the EULA be presented (as seen below), but not shown on the TeamViewer session.
To get past the license agreement, you can accept it by running the following command and answering the question with a y.
sudo teamviewer license
You can now TeamViewer to your host, use the specified password you set above, log in to your desktop environment, and enjoy accessing your GUI over TeamViewer. Remember to play fair.