본문 바로가기

Operating Systems/Linux

[ Linux ] VNC 서버 설치

1. CentOS7

 

[ VNC 서버 ]

yum -y install tigervnc-server

# vnc 서버는 접속할 사용자를 
# 미리 정해 사용자에게 디스플레이 번호를
# 할당해야함 원본 파일을 복사하여 
# 디스플레이 번호 지정
/usr/bin/cp -f /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

sed -i "s/<USER>/root/g" /etc/systemd/system/vncserver@:1.service

firewall-cmd --permanent --add-port=5900-5903/tcp

firewall-cmd --reload

firewall-cmd --list-all

echo -e "123456\n123456\nN\n" | vncserver &

 

[ 리눅스 클라이언트 ]

VNC_SERVER_IP=192.168.108.67

yum -y install tigervnc

# here string(<<<) 로 패스워드 생성후 패스워드 전달
vncviewer -passwd <(vncpasswd -f <<<"123456") ${VNC_SERVER_IP}:1

 

[ 윈도우 클라이언트 ]

Download TigerVNC SourceForge

 

2. Ubuntu20

 

[ VNC 서버 ]

# vnc 의존성 프로그램 설치
apt-get -y install xbase-clients

# vnc 환경 설치
apt-get -y install gnome-panel gnome-settings-daemon metacity

mkdir -p /app/install

wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vnc4/vnc4server_4.1.1+xorg4.3.0-37.3ubuntu2_amd64.deb -O /app/install/vnc4server.deb

dpkg -i /app/install/vnc4server.deb

echo -e "123456\n123456\nN\n" | vncserver &

vncserver -kill :1

cat <<VNC_SETTING > /root/.vnc/xstartup
#!/bin/sh

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
VNC_SETTING

vncserver :1

ufw allow 5901/tcp
ufw allow 5901/udp

ufw status

 

[ 리눅스 클라이언트 ]

mkdir -p /app/install

apt-get -y install tigervnc-viewer tigervnc-xorg-extension

# root 계정으로는 접속할수 없음
exit

VNC_SERVER_IP=192.168.108.20

vncviewer -passwd <(vncpasswd -f <<<"123456") ${VNC_SERVER_IP}:1

'Operating Systems > Linux' 카테고리의 다른 글

[ Linux ] GIT 서버 설치  (0) 2021.09.26
[ Linux ] NFS 서버 설치  (0) 2021.09.25
[ Linux ] Cron 활용  (0) 2021.08.22
[ Linux ] DHCP 서버 설치  (0) 2021.08.21
[ Linux ] 사용자 관리 및 생성 [임시작성]  (0) 2021.08.15