首页 > 其他 > 详细

转载 CentOS 7安装GNOME桌面 和 配置 VNC 服务器

时间:2018-09-16 14:30:50      阅读:128      评论:0      收藏:0      [点我收藏+]

CentOS 7安装GNOME桌面 和 配置 VNC 服务器
这是一个关于怎样在你的 CentOS 7 上安装GNOME桌面 和 配置 VNC 服务器的教程。当然这个教程也适合 RHEL 7 安装GNOME桌面 和 配置 VNC 服务器。

1、安装桌面
yum check-update
yum groupinstall "X Window System" "GNOME Desktop" -y

2、设置默认启动图形界面
unlink /etc/systemd/system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

3、安装 VNC 服务器
yum install tigervnc-server -y

然后,我们需要在 /etc/systemd/system/ 目录里创建一个配置文件。我们可以将 /lib/systemd/sytem/vncserver@.service 拷贝一份配置文件范例过来。

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

4、配置VNC服务器
vi /etc/systemd/system/vncserver@:1.service
然后打开这个配置文件/etc/systemd/system/vncserver@:1.service替换掉默认用户名
找到这一行
ExecStart=/sbin/runuser -l -c "/usr/bin/vncserver %i"
PIDFile=/home//.vnc/%H%i.pid
这里我直接用root 用户登录,所以我替换成
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid

5、重加载 systemd
# systemctl daemon-reload

6、VNC设密码
# vncpasswd

7、配置防火墙iptables或者firewalld
vim /etc/sysconfig/iptables
在合适位置加上
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT
重启iptable
service iptables restart

如果是用Centos 7 默认防火墙的可能需要
# firewall-cmd --permanent --add-service vnc-server
# systemctl restart firewalld.service

8、设默认启动并开启VNC
# systemctl enable vncserver@:1.service
# systemctl start vncserver@:1.service

9、重新启动服务器
reboot
技术分享图片

转载 CentOS 7安装GNOME桌面 和 配置 VNC 服务器

原文:https://www.cnblogs.com/SDYiHeng/p/9655708.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!