安装一台vnc server
安装vnc服务
yum install tigervnc-server -y
#安装依赖
yum install libXfont
yum install xorg-x11-xfs
yum install xorg-x11-xfs-utils
yum install xorg-x11-xinit
yum install xorg-x11-xdm
yum install xorg-x11-fonts*
#如果是最新安装需要安装桌面
yum -y groupinstall 'Desktop'
配置vnc账户(root用户,分配率800x600)
vim /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
设置vnc密码(第一次的时候会要求设置密码)
[root@cp01-cp01-qt-crontab01 ~]# vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /root/.Xauthority
New 'cp01-cp01-qt-crontab01.epc.baidu.com:1 (root)' desktop is cp01-cp01-qt-crontab01.epc.baidu.com:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/cp01-cp01-qt-crontab01.epc.baidu.com:1.log
启动vnc
[root@LVS01 vnc]# service vncserver start
[root@LVS01 vnc]# lsof -i:5901
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Xvnc 20670 root 5u IPv4 121064408 0t0 TCP *:5901 (LISTEN)
重启vnc
vncserver -list
vncserver -kill :1
vncserver
vncserver :1 -geometry 1920x1080
安装novnc
下载
git clone https://github.com/kanaka/noVNC
运行
/bin/sh launch.sh --vnc localhost:5901 --listen 8066
访问
http://localhost:8066/vnc.html?host=LVS01&port=8066
参考
- 黑屏解决方法 http://ju.outofmemory.cn/entry/222096
- novnc使用 https://vosamo.github.io/2016/07/noVNC%E7%9A%84%E4%BD%BF%E7%94%A8%E4%B9%8B%E4%B8%80/
- 安装桌面环境 https://cnzhx.net/blog/centos-yum-install-desktop/