Centos 配置vnc

参考 : http://www.centoscn.com/image-text/install/2014/0504/2905.html

service iptables stop 也可以通过下面修改ippables

vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
service iptables restart

setenforce 0

vi /etc/sysconfig/selinux

SELINUX=disabled

yum install xorg-x11-xauth xterm libXi libXp libXtst libXtst-devel libXext libXext-devel

yum install Xvfb

x11vnc -storepasswd 12345 /etc/x11vnc.pass 设置密码为12345

启动项加入

vi /etc/init/x11vnc

!/bin/sh

chkconfig: - 98 02

description: auto start x11vnc

case "$1" in
start)
/usr/local/bin/x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900;;
stop)
echo "x11vnc stopped";;
*)
echo "usage";;
esac

chkconfig --add x11vcn
chkconfig x11vnc on
测试 service x11vnc start ,grep -aux |grep x11应该可以看到x11vnc启动起来了
以上应该是可以在启动的时候自动运行了,但centos 不知道怎么配置的,service 里面看不到x11vnc 所以加入到~/.bashrc

vi ~/.bashrc
service x11vnc start

ubuntu 上用下面的启动项
vi /etc/init/x11vnc.conf 添加

start on login-session-start

script

x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900

end script

posted @ 2015-11-26 14:48  fastwave2004  阅读(448)  评论(0编辑  收藏  举报