Linux

CentOS开启GUI桌面

一键安装脚本

#先更新系统
yum update -y
#安装GUI
yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
#Centos8使用这个安装GUI
yum groupinstall "Server with GUI"
#设置GUI首选项
systemctl set-default graphical.target
#重启服务器
reboot或shutdown -r now
#安装vnc
yum install tigervnc-server -y
yum install vnc
yum -y groupinstall "development tools"
yum -y groupinstall "gnome desktop"
yum -y  install tigervnc tigervnc-server
#复制启动配置
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
#修改启动配置 /etc中的
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
user=root
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=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
#配置密码 Would you like to enter a view-only password 一定要选择n,否则可能无法连接VNC服务
vncpasswd
#启动服务
systemctl daemon-reload
systemctl start vncserver@:1
systemctl enable vncserver@:1
#测试
下载好"VNC-Viewer-6.1.0-Windows",输入vncpasswd的密码登录vnc


评论 0

还没有评论,来说两句吧。

验证码

登录后即可评论。评论需要填写验证码。