CentOS 7.0 VNC Server安装和配置


一、安装VNC相关包

yum-yinstalltigervnctigervnc-servertigervnc-server-module

二、复制配置模板文件为vncserver@:1.service

cp/lib/systemd/system/vncserver@.service/lib/systemd/system/vncserver@:1.service

三、修改/lib/systemd/system/vncserver@:1.service配置文件

- [root@kvm01~]#cat/lib/systemd/system/vncserver\@\:1.service|grep-v^#|grep-v^$
- [Unit]
- Description=Remotedesktopservice(VNC)
- After=syslog.targetnetwork.target
- [Service]
- Type=forking
- ExecStartPre=/bin/sh-c'/usr/bin/vncserver-kill%i>/dev/null2>&1||:'
- ExecStart=/usr/sbin/runuser-lroot-c"/usr/bin/vncserver%i"
- PIDFile=/root/.vnc/%H%i.pid
- ExecStop=/bin/sh-c'/usr/bin/vncserver-kill%i>/dev/null2>&1||:'
- [Install]
- WantedBy=multi-user.target

四、设置VNC用户密码

vncpasswd

输入两次密码,完成密码设置

五、重新载入system配置

systemctldaemon-reload

六、启动vncserver@:1.service服务,并设置开机自启

systemctlstartvncserver@:1.service&&systemctlenablevncserver@:1.service

注:若系统无法正常关机,则再次启动,此服务无法启动,解决办法参照步骤八

七、配置防火墙

  • firewall-cmd --permanent --add-service vnc-server
  • systemctl restart firewalld.service

注:若系统无法正常关机,则再次启动,此服务无法启动,解决办法参照步骤八

八、问题解决

1. 报错:Job for vncserver@:1.service failed because the control process exited with error code. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details.

处理方法:

rm-rf/tmp/.X11-unix/*

或者:

将步骤三种 Type=forking改为 Type=simple

九、参考文献:

  1. http://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-vnc-server-on-centos-7-rhel-7.html
  2. http://www.linuxeye.com/Linux/2457.html
  3. http://blog.csdn.net/hnhuangyiyang/article/details/50827670
  4. http://www.server-world.info/en/note?os=CentOS_7&p=x&f=3

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim /etc/sysconfig/network-scripts/ifcfg-eth0 B...