Winse Blog

走走停停, 熙熙攘攘, 忙忙碌碌, 不知何畏.

在Centos7上安装VNC Server

安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[root@bigdata-dev ~]# yum install -y tigervnc-server

首先查看原来的默认配置
[root@bigdata-dev ~]# cat /lib/systemd/system/vncserver@.service 

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

复制一份修改,已root用户为例。其他用户类推
[root@bigdata-dev system]# cp vncserver@.service vncserver@:1.service 
[root@bigdata-dev system]# vi vncserver@\:1.service 

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[root@bigdata-dev system]# systemctl daemon-reload
[root@bigdata-dev system]# systemctl enable vncserver@:1.service
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:1.service to /etc/systemd/system/vncserver@:1.service.
[root@bigdata-dev system]# systemctl start vncserver@:1.service
[root@bigdata-dev system]# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-01-25 14:28:04 CST; 27s ago
   
[root@bigdata-dev system]# vncpasswd 
Password:
Verify:
[root@bigdata-dev system]# 
[root@bigdata-dev system]# 
[root@bigdata-dev system]# systemctl restart vncserver@:1.service
http://www.aboutyun.com/thread-17535-1-1.html
[root@bigdata-dev system]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

下载客户端并访问

https://www.realvnc.com/download/viewer/ 访问VNC服务的地址 HOST:5901

–END

Comments