Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vps:x-server-vnc [2015-10-06 16:48:43]
rory.blanchard
vps:x-server-vnc [2017-08-16 17:06:30]
rory.blanchard
Line 1: Line 1:
-===== How To Install X Server on a VPS (with VNC access) =====+====== How To Install X Server on a VPS (with VNC access) ======
  
 This guide is intended to provide those users who desire it instructions on how to install a graphical user environment on their VPS. Because the usual method of access your VPS (SSH) does not support a graphical environment, we will also install a way of doing so, called VNC. [[http://en.wikipedia.org/wiki/Virtual_Network_Computing|VNC]] is an open-source desktop sharing protocol allowing, among many other things, remote access to the GUI of a system. It is very similar in function to the Terminal Services functionality on Windows. This guide is intended to provide those users who desire it instructions on how to install a graphical user environment on their VPS. Because the usual method of access your VPS (SSH) does not support a graphical environment, we will also install a way of doing so, called VNC. [[http://en.wikipedia.org/wiki/Virtual_Network_Computing|VNC]] is an open-source desktop sharing protocol allowing, among many other things, remote access to the GUI of a system. It is very similar in function to the Terminal Services functionality on Windows.
  
 Before we begin, we would like to caution users that a graphical user environment such as the X server (X windows) consumes significantly more resources than a typical SSH-based access system, and as such is not recommended for use in an environment where resources are scarce. We also do not recommend running a GUI on a server with any less than 512MB of memory. Before we begin, we would like to caution users that a graphical user environment such as the X server (X windows) consumes significantly more resources than a typical SSH-based access system, and as such is not recommended for use in an environment where resources are scarce. We also do not recommend running a GUI on a server with any less than 512MB of memory.
-==== Installing the Components ==== 
  
-Our VPS images are intended to be very minimal to allow the most user customization, so you must install the full group packages for Xwindows and Gnome (the default window manager for most operating systems). For CentOS:+===== Installing the Components =====
  
-<sxh bash>yum groupinstall "X Window System" "GNOME Desktop Environment" tigervnc-server</sxh>+Our VPS images are intended to be very minimal to allow the most user customization, so you must install the full group packages for Xwindows and Gnome (the default window manager for most operating systems).  
 + 
 +Use **SSH** to log in to your server and run the following: 
 + 
 +For CentOS: 
 + 
 +<code>yum groupinstall "X Window System" "GNOME Desktop Environment" tigervnc-server</code>
  
 For Ubuntu (as root): For Ubuntu (as root):
  
-<sxh bash>apt-get install ubuntu-desktop gdm vnc4server</sxh>+<code>apt-get install ubuntu-desktop gdm vnc4server</code>
  
 For Debian (as root): For Debian (as root):
  
-<sxh bash>apt-get install xorg gdm gnome vnc4server</sxh>+<code>apt-get install xorg gdm gnome vnc4server</code>
  
 You will also need a VNC viewer for your PC. If you are on Microsoft Windows, you can try one of the free VNC viewers such as [[http://www.realvnc.com/products/download.html|RealVNC Free Version]]. For Mac, we reccomend the open source project [[http://sourceforge.net/projects/cotvnc/|Chicken of the VNC]]. You will also need a VNC viewer for your PC. If you are on Microsoft Windows, you can try one of the free VNC viewers such as [[http://www.realvnc.com/products/download.html|RealVNC Free Version]]. For Mac, we reccomend the open source project [[http://sourceforge.net/projects/cotvnc/|Chicken of the VNC]].
  
-==== Running VNC Server ====+===== Running VNC Server =====
  
 Out of the box, the X server should come configured properly. We will however need to configure the VNC server to start automatically as well as start a new X server session when it is started as well. Out of the box, the X server should come configured properly. We will however need to configure the VNC server to start automatically as well as start a new X server session when it is started as well.
Line 26: Line 31:
 First, we'll make sure VNC is working OK: First, we'll make sure VNC is working OK:
  
-<sxh bash>vncserver :1</sxh>+<code>vncserver :1</code>
  
 This will start the VNC server for the first time, create some configuration files, and start the VNC server listening on port 5091 (make sure to open this port in your firewall if necessary). You can now use your VNC viewer to connect to your server to make sure it is working properly. You can use the syntax //hostname.domain.com:1// to connect to the server. This will start the VNC server for the first time, create some configuration files, and start the VNC server listening on port 5091 (make sure to open this port in your firewall if necessary). You can now use your VNC viewer to connect to your server to make sure it is working properly. You can use the syntax //hostname.domain.com:1// to connect to the server.
  
-==== Running X Server ====+===== Running X Server =====
  
 Once you have logged in for the first time, you will notice VNC only launches an xterm window with a very basic interface by default. We want to change its configuration to start a Gnome graphical environment when launched so we have a nice GUI to work with. Once you have logged in for the first time, you will notice VNC only launches an xterm window with a very basic interface by default. We want to change its configuration to start a Gnome graphical environment when launched so we have a nice GUI to work with.
Line 36: Line 41:
 What we need to do is first stop the running VNC server: What we need to do is first stop the running VNC server:
  
-<sxh bash>vncserver -kill :1</sxh>+<code>vncserver -kill :1</code>
  
 Next we need to edit <c>/root/.vnc/xstartup</c> (or /home/user if you're running the server as a regular user) and modify the final line in the file, which should read <c>twm &</c> to the following (note the last line): Next we need to edit <c>/root/.vnc/xstartup</c> (or /home/user if you're running the server as a regular user) and modify the final line in the file, which should read <c>twm &</c> to the following (note the last line):
  
-<sxh bash>#!/bin/bash+<code>#!/bin/bash
  
 # Uncomment the following two lines for normal desktop: # Uncomment the following two lines for normal desktop:
Line 53: Line 58:
  
 unset SESSION_MANAGER unset SESSION_MANAGER
-gnome-session &</sxh>+gnome-session &</code>
  
 If this file doesn't exist, create it, and make sure it is executable (chmod 0777). If this file doesn't exist, create it, and make sure it is executable (chmod 0777).
Line 59: Line 64:
 Once done, we can restart our VNC server: Once done, we can restart our VNC server:
  
-<sxh bash>vncserver :1</sxh>+<code>vncserver :1</code>
  
 Now you can log in as you did before, however this time you will be presented with a Gnome Desktop environment! Now you can log in as you did before, however this time you will be presented with a Gnome Desktop environment!
Line 65: Line 70:
 {{ :vps:vnc-desktop.png?200&direct |VNC Gnome Desktop}} {{ :vps:vnc-desktop.png?200&direct |VNC Gnome Desktop}}
  
-==== Starting on Boot ====+===== Starting on Boot =====
  
 If you would like your VNC server to start with the system boot, we will need to modify the init startup scripts. For CentOS: If you would like your VNC server to start with the system boot, we will need to modify the init startup scripts. For CentOS:
  
-<sxh bash>chkconfig vncserver --levels 2345 on</sxh>+<code>chkconfig vncserver --levels 2345 on</code>
  
 For Debian/Ubuntu, the VNC server should be automatically configured to start on boot. If not, you may need to update the rc scripts: For Debian/Ubuntu, the VNC server should be automatically configured to start on boot. If not, you may need to update the rc scripts:
  
-<sxh bash>update-rc.d vnc4server defaults</sxh>+<code>update-rc.d vnc4server defaults</code>
  
-==== Securing VNC ====+===== Securing VNC =====
  
 By default, VNC only encrypts the initial password communication then results to unencrypted transmission of the data stream. This can lead to problems if someone is able to sniff your network traffic, as could be the case communicating over the 'net with your VPS.  To secure VNC, we will use an SSH tunnel to encrypt the VNC traffic: By default, VNC only encrypts the initial password communication then results to unencrypted transmission of the data stream. This can lead to problems if someone is able to sniff your network traffic, as could be the case communicating over the 'net with your VPS.  To secure VNC, we will use an SSH tunnel to encrypt the VNC traffic:
Line 81: Line 86:
 http://www.cs.arizona.edu/computing/access/x11vnc.html http://www.cs.arizona.edu/computing/access/x11vnc.html
  
-{{tag>centos how-to vps ubuntu}}+\\ 
 +\\ 
 +\\