# VNC

#### Installation

##### Ubuntu 9/11

- [How to Set Up a VNC Server In Ubuntu](https://www.maketecheasier.com/set-up-a-vnc-server-in-ubuntu/)

```
sudo apt-get install ubuntu-desktop --no-install-recommends
sudo apt-get install  vnc4server
```

編輯 .vnc/xstartup

```shell
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session & # support for GNOME
startkde $ #support for KDE
```

##### Lubuntu

編輯 .vnc/xstartup

```
/usr/bin/lxsession -s Lubuntu -e LXDE
```

##### CentOS

CentOS 6：

```
yum groupinstall Desktop
yum install tigervnc tigervnc-server
```

設定 VNC 密碼

```
vncserver
```

編輯 ~/.vnc/xstartup

```
# 移除註解
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
```

設定開機後自動啟動

/etc/sysconfig/vncservers

```
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1280x1024"     #這行可不加
```

```
chkconfig vncserver on
```

CentOS 5：

```
# Install
yum install vnc-server

# Set the password for vnc
vncserver
```

/root/.vnc/xstartup

```
xsetroot -solid grey
vncconfig -iconic &
gnome-session &   # 加這行
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & # 註解這行
#twm & # 註解這行
```

重啟 vncserver

```
vncserver -kill :1
vncserver
```

畫面解析太小

```
vncserver -geometry 1280x960
```

#### KasmVNC

KasmVNC - Linux Web Remote Desktop

- \[GitHub\] [KasmVNC - Modern VNC Server and client, web based and secure](https://github.com/kasmtech/KasmVNC)

#### Learning

- [How to install and access CentOS remote desktop on VPS](https://www.xmodulo.com/centos-remote-desktop-vps.html)
- [How to Access Remote Desktop from Browser Using TightVNC](https://www.tecmint.com/vnc-desktop-access-from-web-browser/)