VNC installation and use on Ubuntu 14.04

VNC is a remote control software that supports the visual operation of remote access to Linux systems from Windows systems, as well as mutual access between Linux systems. Here's how to install and use VNC software on Ubuntu 14.04.

1. Installation of VNC

(1) Install vncserver (vnc server)
          sudo apt-get install vnc4server  
(2) Install gnome (a graphical desktop environment for linux)
          sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal  
( 3) Create a password
          vncpasswd   for the current user
 and enter the password you want to set. At this time, a .vnc folder will be added to the user's root directory, which can be viewed through the ls -a ~ command. There is a file named passwd in this folder
(4) Create a new xstartup file in the .vnc directory, and its content is as follows:

#!/bin/sh  

export XKL_XMODMAP_DISABLE=1  
unset SESSION_MANAGER  
unset DBUS_SESSION_BUS_ADDRESS  
gnome-panel &  gnmoe-settings-daemon &  metacity &  nautilus &  gnome-terminal &  vncconfig &  startlxde &     






/usr/bin/ibus-daemon -d &  

(5) Add executable permissions to the xstartup file

        chmod + x ~ / .vnc / xstartup  

2. Use of VNC

(1) Open the server
        vncserver: 1  
        At this time, two files, computer name: 1.log and computer name: 1.pid, will appear in the ~/.vnc directory. You can use the ls ~/.vnc command to view
        if you need to specify the client's The screen size can be specified with the -geometry parameter. The usage method is (for example, specify the screen size as 1920*1080):
        vncserver -geometry 1920x1080 :1  
(2) Client access

        A. If the client is a windows system

        You need to install a VNC Viewer software. After installation, open the software and replace "input server IP" with your server IP address. The entire format is: IP: 1 (this: 1 is the first created on the server before) vnc user, you can create a new vnc user in the future, the number will become 2, that is, IP: 2, and so on), then click connect, and then you can connect to the server.

        B. If the client is ubuntu system
            (a) install the xvnc4viewer software
                    sudo apt-get install xvnc4viewer  
           (b) start the vncviewer software, connect to the server
                    vncviewer VNCServer-IP: 1  

                    The form is similar to the windows client

(3) Close the server

        vncserver -kill :1 

3. VNC Server self-starting

First, make sure that the vnc server has been installed. In the /etc/ file, create a new vncserver folder, and add two new files, startvnc.py and startvnc.sh, under the vncserver folder.

startvnc.py:

import sys  
import os  
user=["k40","wcg","szh","zf","yry","lxy","llp"] #不同账户的用户名,port按这个顺序依次是1到7,如:k40即port 1  
i = 1  
depth = "16"  
geometry = "1024x900"  #分辨率  
name = "vncserver"  
for name in user:  
    options = "-name %s -depth %s -geometry %s :%d" % (name, depth, geometry, i)  
    print(options)  
    i = i + 1  
    cmd = "su %s -c '/usr/bin/vncserver %s'" % (name, options)  
    print(cmd)  
    os.system(cmd)

startvnc.sh:

#!/bin/bash  
python /etc/vncserver/startvnc.py  
exit 0 
然后重启电脑。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324516282&siteId=291194637