Centos 配置 VNC服务器

第一部 yum安装

yum install tigervnc-server tigervnc-server-module -y

在linux、Centos 中配置 VNC服务器
检查 Selinux 和 防火墙
在linux、Centos 中配置 VNC服务器

第二步,修改配置信息,在/etc/systemd/system/下建立文件夹[email protected]:1.service 把example config 文件从/lib/systemd/system/[email protected]复制到里面
[[email protected] ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service
然后打开这个配置文件vim /etc/systemd/system/[email protected]:1.service替换掉默认用户名
改成root登入 必须改不然启动不了服务
ExecStart=/sbin/runuser -l root -c “/usr/bin/vncserver %i”
PIDFile=/root/.vnc/%H%i.pid

在linux、Centos 中配置 VNC服务器
[[email protected] ~]# systemctl daemon-reload 重新加载
第四步,为VNC设密码
[[email protected] ~]# vncpasswd
在linux、Centos 中配置 VNC服务器

在linux、Centos 中配置 VNC服务器

如果是用Centos 7 默认防火墙的可能需要
[[email protected] ~]# firewall-cmd --permanent --add-service vnc-server
[[email protected] ~]# systemctl restart firewalld.service
[[email protected] ~]# ps aux | grep vnc 查看服务启动没有
root 11609 0.0 0.0 112708 980 pts/0 S+ 14:57 0:00 grep --color=auto vnc 表示没有启动
[[email protected] ~]# vncserver 启动服务
[[email protected] ~]# ps aux | grep vnc 在查看服务
以下内容就是正常启动了!
在linux、Centos 中配置 VNC服务器
root 20459 1.3 0.4 207660 38992 pts/0 Sl 19:18 0:00 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop localhost.localdomain:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000
root 20466 0.0 0.0 113176 1196 pts/0 S 19:18 0:00 /bin/sh /root/.vnc/xstartup
root 20886 0.0 0.0 112712 980 pts/0 R+ 19:19 0:00 grep --color=auto vnc
第六步,设默认启动并开启VNC
[[email protected] ~]# systemctl enable [email protected]:1.service
[[email protected] ~]# systemctl start [email protected]:1.service

在linux、Centos 中配置 VNC服务器
登入

在linux、Centos 中配置 VNC服务器

在linux、Centos 中配置 VNC服务器

在linux、Centos 中配置 VNC服务器

相关文章: