RHEL7安装配置VNC
作者:Eric
微信:loveoracle11g 安装配置VNC服务程序
[root@zhouwanchun yum.repos.d]# cd ~
[root@zhouwanchun ~]# yum -y install tigervnc*
[root@zhouwanchun ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:3.service 编辑vnc服务的配置文件,将所有的修改为root用户
[root@zhouwanchun ~]# vim /etc/systemd/system/vncserver@\:3.service
32 [Unit]
33 Description=Remote desktop service (VNC)
34 After=syslog.target network.target
35
36 [Service]
37 Type=forking
38 # Clean any existing files in /tmp/.X11-unix environment
39 ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
40 ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
41 PIDFile=/root/.vnc/%H%i.pid
42 ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
43
44 [Install]
45 WantedBy=multi-user.target [root@zhouwanchun ~]# firewall-cmd --permanent --zone=public --add-port=5903/tcp
success
[root@zhouwanchun ~]# firewall-cmd --reload
success [root@zhouwanchun ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.70 zhouwanchun.example.com [root@zhouwanchun ~]# vncserver You will require a password to access your desktops. Password:
Verify: New 'zhouwanchun.example.com:1 (root)' desktop is zhouwanchun.example.com:1 Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/zhouwanchun.example.com:1.log [root@zhouwanchun ~]# systemctl status vncserver@:3.service
vncserver@:3.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:3.service; disabled)
Active: inactive (dead) [root@zhouwanchun ~]# systemctl start vncserver@:3.service
[root@zhouwanchun ~]# systemctl enable vncserver@:3.service
ln -s '/etc/systemd/system/vncserver@:3.service' '/etc/systemd/system/multi-user.target.wants/vncserver@:3.service' [root@zhouwanchun ~]# systemctl status vncserver@:3.service
vncserver@:3.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:3.service; enabled)
Active: active (running) since Thu 2017-12-07 23:25:07 CST; 10s ago
Main PID: 5008 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:3.service
‣ 5008 /usr/bin/Xvnc :3 -desktop zhouwanchun.example.com:3 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30... Dec 07 23:25:04 zhouwanchun.example.com systemd[1]: Starting Remote desktop service (VNC)...
Dec 07 23:25:07 zhouwanchun.example.com systemd[1]: Started Remote desktop service (VNC). 使用VNC远程连接RHEL7.0系统