본문 바로가기

Linux

CentOS 7 vnc-server 설치

CentOS 7 최소버전 설치 후 vnc 설치

 

<CentOS 7 설치>

http://angelhyun.tistory.com/58

 

 

[ GNOME 설치 ]

# yum -y groupinstall "GNOME Desktop" "Graphical Administration Tools"

 

[ runlevel 변경 ]

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

 

[tigervnc-server 설치]

# yum install -y tigervnc-server

 

[구성 파일 복사]

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

 

- ps : CentOS 6.x 버전까지는 /etc/sysconfig/vncservers 였으나 CentOS 7 로 올라오면서 해당 경로가 /lib/systemd/system/vncserver@.service 로 변경됨

 

[구성파일 설정]

# vi /etc/systemd/system/vncserver@\:1.service

- 빨간색 글씨 부분을 변경

 

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[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 || :'

[Install]
WantedBy=multi-user.target

 

[설정파일 재시작]

# systemctl daemon-reload

 

[vnc 서비스 활성화]

# systemctl enable vncserver@:1.service

 

[vnc 서비스 시작]

# vncserver

- 패스워드 입력(이 설정된 패스워드는 vnc 접속시 사용하는 패스워드입니다.)

 

[root@test ~]# vncserver

You will require a password to access your desktops.

Password:    <-- VNC 패스워드
Verify:         <-- VNC 패스워드
xauth:  file /root/.Xauthority does not exist

New 'test:1 (root)' desktop is test:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/test:1.log

[root@test ~]#

 

[방화벽 설정]

# firewall-cmd --permanent --zone=public --add-service vnc-server

# firewall-cmd --reload

 

[원격 접속]

- 접속하려는 IP 뒤에 5901 포트정보 넣어줘야됨 ex) 199.199.199.100:5901

 

 

[참고 Site]

https://www.howtoforge.com/vnc-server-installation-on-centos-7

 

[download Site]

https://www.realvnc.com/download/vnc/