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


    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

  • 相关阅读:
    Seq命令的用法
    Vsftp的PASV mode(被动模式传送)和Port模式及 Linux下VsFTP配置全方案
    PHP网页截图网页快照实现
    MimeType资料
    SQl 周报表 周统计
    IsolatedStorageFile 配额等
    SQL 月报表
    参数编码 完全解决方案
    File,FileStream,byte[]3者互相转换总结(转)
    SL 在 IE8下显示的高度变小 解决方法
  • 原文地址:https://www.cnblogs.com/SDYiHeng/p/9655708.html
Copyright © 2020-2023  润新知