1. 程式人生 > >RHEL7.1安裝VNC

RHEL7.1安裝VNC

tracking mct span systemd table tin 開機 啟動 ||

1.安裝包
yum install vnc* -y
2.創建password
vncserver
3.創建參數文件
[[email protected] ~]# cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:1.service
4.改動參數文件
[[email protected] ~]# vi /lib/systemd/system/vncserver@\:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"                                    --------改動處1:以root用戶為例,-l後改動為username
PIDFile=/root/.vnc/%H%i.pid                                                                                  --------改動處2:.vnc前設置用戶的家文件夾,root為/root
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘

[Install]
WantedBy=multi-user.target
5.啟動
systemctl start vncserver@:1.service
6.假設想開機自啟動,那麽
systemctl enable vncserver@:1.service

註:假設你是第一次接觸RHEL7,那麽你此時肯定連接不上VNC。由於:
service iptables stop根本就關不掉防火墻!
須要:systemctl stop firewalld


RHEL7.1安裝VNC