[desktop] CentOS7 vncserver

CentOS 7 vncserver 설치

TigerVNC is a high-performance, platform-neutral implementation of VNC (Virtual Network Computing), a client/server application that allows users to launch and interact with graphical applications on remote machines. TigerVNC provides the levels of performance necessary to run 3D and video applications, and it attempts to maintain a common look and feel and re-use components, where possible, across the various platforms that it supports. TigerVNC also provides extensions for advanced authentication methods and TLS encryption

참고페이지: https://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-vnc-server-on-centos-7-rhel-7.html


tigervnc viewer : https://github.com/TigerVNC/tigervnc/releases


tigervnc-server 설치

[root@centos74 ~]# yum install -y tigervnc-server


vncserver 파일 복사

[root@centos74 ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service


vncserver 파일 수정

[root@centos74 ~]# vi /etc/systemd/system/vncserver@\:1.service

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
ExecStop=-/usr/bin/vncserver -kill %i




# 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"
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'


vncserver 설정후 변경을 위하여 systemctl 설정을 Reload 합니다.

[root@centos74 ~]# systemctl daemon-reload


vncserver enable 

[root@centos74 ~]# 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@centos74 ~]#


vncuser password 설정

[root@centos74 ~]# vncserver

You will require a password to access your desktops.

Would you like to enter a view-only password (y/n)? y

New 'centos74:2 (root)' desktop is centos74:2

Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/centos74:2.log

[root@centos74 ~]#


방화벽을 설정 합니다.

[root@centos74 ~]#  firewall-cmd --permanent --zone=public --add-service vnc-server
[root@centos74 ~]# firewall-cmd --reload
[root@centos74 ~]#


vncserver 동작확인

[root@centos74 ~]# 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-11-29 09:04:27 KST; 30s ago
  Process: 1100 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
  Process: 1082 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
 Main PID: 1231 (Xvnc)
   CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
           ‣ 1231 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop centos74:1 (root) -fp catalogue:/etc/X11/fontpath...

Nov 29 09:04:24 centos74 systemd[1]: Starting Remote desktop service (VNC)...
Nov 29 09:04:27 centos74 systemd[1]: Started Remote desktop service (VNC).
[root@centos74 ~]#



client 에는 tigervnc site 에서 다운받을수 있습니다.



vncserver접속 vncport 의 경우 5901 port 를 사용하며 vnc-client 에서는 편의상 1 로 입력합니다.

password 입력후 vnc접속 확인을 할수 있습니다. 


vnc-server 가 정상적으로 동작을 하지 않을 경우

/root/.vnc 디렉토리의 *.log 및 *.pid 삭제

/tmp/.X11-unix 디렉토리의 X로 시작하는 파일을 삭제후 재시작 하시면 됩니다.


[root@test-machine ~]# cd .vnc/
[root@test-machine .vnc]# rm -f test-machine\:6.*
[root@test-machine .vnc]# cd /tmp/
[root@test-machine tmp]# rm .X11-unix/ -rf




댓글 남기기