Installation configuration notes for VNC in Ubuntu

Source: Internet
Author: User

The use of the server, the use of Remote Desktop is very convenient, or need to run to the server room operation is very troublesome, or the need for remote operation of the machine is also available, the general operating system will have Remote Desktop features, but not as good as third-party software, for Linux system commonly used Remote Desktop software is VNC , VNC is divided into server-side and client-side, the following first talk about the installation and configuration of the VNC server.

Installing the VNC server side

The installation of the VNC server side in Ubuntu is simple, run the following command:

$ sudo apt-get install Vnc4server
A password is required for the first run after installation is complete.

Setting the VNC login password

$ vncpasswd
Password:
Verify
Prompt for password, confirm password. After setting the password and starting vncserver for the first time, the. vnc/directory will be generated in the user home directory, note: There is no. vnc directory in the user's home directory just after installation.

Start and close Vcnserver

$ vncserver:1
Indicates start Vncserver, ": 1" for display number, which is the 1th display that launches Vncserver. The server can start different display numbers in different accounts, the client needs to fill in the corresponding display number login to the corresponding account. If multiple clients sign in to the same display, they will see the actions of others, which will scramble the mouse.
$ vncserver-kill:1
Turn off display No. 1th.

Configuration of the VNC server

The default configuration file is ~/.vnc/xstartup. Just finished installing if you do not modify the configuration file, you will not see the full desktop when you connect from the client, but only one terminal window, as shown in.

This is because of a problem with the desktop configuration that is enabled by default, and the configuration file needs to be modified. Many of the articles found online say, TWM & lines in the configuration file are commented out, and then add a line gnome-session &. But through experiments, it is not always possible to solve the problem! Later on the internet to find a reliable article: http://blog.csdn.net/njchenyi/article/details/8489689, the article said the configuration method is indeed feasible, the following will be the contents of the configuration file in this article moved to record here.

The default configuration file is as follows:

    1. #!/bin/sh
    2. # Uncomment the following-lines for normal desktop:
    3. # unset Session_manager
    4. # EXEC/ETC/X11/XINIT/XINITRC
    5. [-x/etc/vnc/xstartup] && Exec/etc/vnc/xstartup
    6. [-R $HOME/. Xresources] && Xrdb $HOME/. Xresources
    7. Xsetroot-solid Grey
    8. Vncconfig-iconic &
    9. X-terminal-emulator-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &
    10. X-window-manager &


The following configuration files are described in the article:

  1. #!/bin/sh
  2. # Uncomment the following-lines for normal desktop:
  3. Unset Session_manager
  4. Unset dbus_session_bus_address
  5. # EXEC/ETC/X11/XINIT/XINITRC
  6. [-x/etc/vnc/xstartup] && Exec/etc/vnc/xstartup
  7. [-R $HOME/. Xresources] && Xrdb $HOME/. Xresources
  8. Xsetroot-solid Grey
  9. Vncconfig-iconic &
  10. X-terminal-emulator-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &
  11. # X-window-manager &
  12. Export desktop_session=ubuntu-2d #这个 ubuntu-2d The file name under reference/usr/share/gnome-session/sessions/is set to a different value
  13. Export gdmsession=ubuntu-2d
  14. Export startup= "/usr/bin/gnome-session--session=ubuntu-2d"
  15. $STARTUP


The VNC client will be able to connect and display properly.

About clients

It is said that there are different clients can connect Vncserver, I have been using the VNC Viewer (official website address: http://www.realvnc.com/download/viewer/), the software is provided for different operating system versions, is a green version of the small software, directly run to use, very convenient. As shown in the following:

About the Vncserver boot

Install Vncserver is mainly to be able to operate the server remotely, but there is a problem: if the remote operation needs to restart the server, but after the server restarts if Vncserver does not boot itself, the client will not be able to remotely connect to the server, so it is very troublesome to use up So we have to find a way to vncserver boot. In the online review of a lot of relevant content, found very chaotic is also very unreliable, temporarily did not find a simple and effective configuration method.
Later, I used another method: Open the SSH service on the server and let the SSH service boot up, so that after the server restarts, SSH to the server, then start vncserver through the command line, and then you can connect with the VNC client. About the installation of SSH on Ubuntu configuration and boot can view this blog post: http://blog.csdn.net/lewsn2008/article/details/10160441.

Installation configuration notes for VNC in Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.