Virtual Machines

Products

Virtual Machines

Documentation > Products > Virtual Machines > Ubuntu Configures Graphical Interface and vnc

Ubuntu Configures Graphical Interface and vnc

Note: The configuration and instructions of Linux in this article have been tested on the Ubuntu 14.04 64-bit operating system. For other types and versions of the operating system, configuration may vary. Please refer to the official documentation for the details about relevant operating systems.

Install gnome Desktop Environment:

  1. Install the infrastructure of x-windows and execute the following command:

sudo apt-get -y install x-window-system-core

  1. Install the login manager and execute the following command:

sudo apt-get -y install gdm

  1. Install the Ubuntu desktop and execute the following command:

sudo apt-get -y install ubuntu-desktop

  1. Enter the graphical interface and execute the following command:

startx -extension GLX

Install and Configure vncserver Service:

Installation

Excuting command

apt-get -y install vnc4server

Configuration

  1. Enter the command vncserver to enable the vnc service. At the first boot, it will be required to set a password, which can be modified later with vncpasswd

  1. Back up the original xstartup file and execute the command:

cp /root/.vnc/xstartup /root/.vnc/xstartup.bak

  1. Modify the vnc startup file, and use the following command:

vi /root/.vnc/xstartup

After opening, as shown, comment out the line x-window-manager &, and then add a line gnome-session &below

  1. Kill the original desktop process, enter the command (wherein: 1 refers to the desktop number), and execute the command:

vncserver -kill :1

Enter the following command again to generate a new session:

vncserver :1

  1. Set vncserver to boot automatically, and execute the following command:

vi /etc/rc.local

Add the vncserver startup command /usr/bin/vnc4server

Test Login

Client connects. After completing the above configuration, install VNC Viewer on the client, and then input the IP address of the server plus VNC port number (5901 by default) for VNC connecting:

Update Time:2019-08-28 21:38:32