centos安装桌面和远程连接

centos安装火狐

yum -y install firefox

centos安装桌面

安装 MATE 桌面环境为例:

登录服务器,执行命令
yum groups install "X Window System"
安装 X Window System。

执行命令

yum groups install "MATE Desktop"

安装 MATE Desktop。

查看已安装是否有GNOME Desktop

yum grouplist

执行命令

systemctl set-default graphical.target

设置默认通过桌面环境启动服务器。

执行命令 reboot 重启服务器,您也可以在云服务器 ECS 控制台重启服务器。

通过云服务器 ECS 控制台管理终端连接服务器,测试验证安装情况。

安装vncserver

yum -y install tigervnc-server tigervnc

Centos7需要配置的文件/lib/systemd/system/[email protected],复制一份文件,并改名为vncserver@:1.service

cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:1.service

将文件中的

[Unit]
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/home/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :

更新systemctl

systemctl daemon-reload

设置为自动启动

systemctl enable vncserver@:1.service

启动vnc服务

systemctl start vncserver@:1.service

出现错误:

解决把 vncserver@:1.service 中的 Type 參數設置為 simple
再執行 systemctl daemon-reload
再執行 systemctl start vncserver@:1.service

重启vnc服务,输入如下两个命令

vncserver -kill :1  
vncserver

完成所有配置(防火墙放行590X端口的设置不在此列出),客户端可以使用IP:5901进行远程桌面连接

猜你喜欢

转载自www.cnblogs.com/Mysterious/p/10154739.html
今日推荐