1.安装窗口软件
yum groupinstall "X Window System"
2.安装图形化程序组
yum -y groupinstall "Server with GUI"
3.以执行命令者的身份启动X图形界面
startx
4.启动run level5所对应的服务,并运行图形登录管理器,只有root有权执行
init 5
nit:序号说明
#1 - 单用户模式
#2 - 多用户,没有NFS
#3 - 完全多用户模式(标准的运行级)
#4 - 没有用到
#5 - Xwindow
#6 - 重新启动
5.设置界面开机自启
5.1.用下面命令查看查看是哪个模式
systemctl get-default
5.2. 设置开机启动图形界面模式
systemctl set-default graphical.target(图形界面模式)
reboot(重启系统)
5.3. 设置开机启动字符界面模式
systemctl set-default multi-user.target(字符界面模式)
reboot(重启系统)
6.安装VNC
查询是否安装了VNC服务:
rpm -qa | grep vnc
安装VNC服务:
yum -y install vnc vnc-server
yum -y install tightvnc-server
配置vnc密码
vncserver
两次输入密码之后,提示是否设置只读用户密码,回复N
将VNC需要使用的5901-5910端口加入防火墙例外端口
firewall-cmd --permanent --zone=public --add-port=5900-5910/tcp
firewall-cmd --reload
设置开机自启动
复制启动文件
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
替换用户
vi /etc/systemd/system/vncserver@:1.service
把文件中 <user> 的文字替换为 root 然后保存退出
设置自启动服务
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl enable --now vncserver@:1.service
至此vnc server已经设置完成,打开VNC-Viewer 的客户端软件,连接地址是 IP:5901 密码是之前设置的密码