what's the VNC
VNC 是一款非常强大的远程控制工具, 服务端安装 vncserver 并启动服务后, 客户端安装 vncviewer 就可以远程操作服务端, VNC 的服务器端应用程序在 UNIX 和 Linux 操作系统中适应性很强, 图形用户界面十分友好, 看上去和 Windows 下的软件界面也很类似, 使得我们对于云服务器的操作相当巴适.
服务端安装及配置 VNC
这里以 CentOS 为例, Ubuntu 只需将 yum 改成 apt-get 即可
安装 vnc
- yum -y install vnc
- yum -y install xorg-x11-fonts-misc
- yum -y install tigervnc-server
配置 vncservers 文件
- VIM /etc/sysconfig/vncservers
- # 去掉下面两行的注释
- VNCSERVERS="1:root"
- VNCSERVERARGS[1]="-geometry 1024x768"
配置 xstartup 文件
编辑配置之前, 需要使用 vncserver 命令创建默认配置文件
- vncserver
- # 输入口令: 123456 (密码要求最少六位)
- # 确认口令: 123456
- VIM /root/.vnc/xstartup
- # 在最后增加这一行, 表使用 gnome 界面, 否则是 xfce 界面
- gnome-session & set starting GNOME desktop
设置远程登录口令
vncpasswd
启动 vncserver 服务
主服务启动
service vncserver start
启动多个界面
- vncserver :2
- vncserver :3
- vncserver :4
- ......
停止 vncserver 服务
停止主服务
service vncserver stop # 停止 start 时启动的界面: 1, 其它另启的界面: 2 不停止
停止指定界面
- vncserver -kill :1
- vncserver -kill :2
- ......
- # 通过 service vncserver status 命令可以得到进程 pid 号, 可以看出启动了多少个界面.
设置开机启动
- chkconfig --list vncserver
- chkconfig vncserver on
参考: https://blog.51cto.com/13043516/2055574
来源: http://www.bubuko.com/infodetail-3364784.html