1、安装
yum install tigervnc-server -y
2、配置用户
vi /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
3.用vncpasswd创建一个vnc的口令
注意这将同时在你的home目录下,创建一个隐藏的目录.vnc,其中有一个文件passwd保存着你的vnc口令.
4.启动vnc服务,并设置开机自动启动服务.
service vncserver start
chkconfig vncserver on
5.防火墙端口设置
在使用防火墙的情况下来连接到一个远程系统,需要打开端口5901.
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
service iptables save
,然后重启iptables服务。
service iptables restart
iptables如何删除一条规则
-- 查找所有规则
iptables -L INPUT --line-numbers
-- 删除一条规则
iptables -D INPUT 11 (注意,这个11是行号,是iptables -L INPUT --line-numbers 所打印出来的行号)