cnetos7 vncserver安裝與配置

cnetos7 vnc server安裝與配置

一、安裝

1,查看是否安裝

[root@localhost ~]# rpm -qa |grep vnc
gvnc-0.5.2-7.el7.x86_64
tigervnc-server-minimal-1.3.1-4.el7_2.x86_64
gtk-vnc2-0.5.2-7.el7.x86_64
tigervnc-license-1.3.1-4.el7_2.noarch
tigervnc-server-minimal-1.3.1-3.el7.x86_64
tigervnc-license-1.3.1-3.el7.noarch
libvncserver-0.9.9-9.el7_0.1.x86_6

2,若未安裝使用yum安裝

[root@localhost ~]# yum installtigervnc-server tigervnc-server-module

3,關閉防火牆

[root@localhost ~]# systemctl disable firewalld.service
[root@localhost ~]# systemctl stop firewalld.service

二、配置

1copy配置文件

[root@localhost ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service


若出現cannot stat ‘/lib/systemd/system/[email protected]’: No such fileor directory重新yum安裝即可

2,修改配置文件

[root@localhost ~]# vim /etc/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=/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 || :'

#這裏使用root用戶,將<user>換成rootPIDFile路徑注意去掉/home/

3,開機啓動服務

[root@localhost~]# systemctl enable vncserver@:1.service


4,配置登錄密碼

[root@localhost ~]# vncpasswd

5,啓動服務

[root@localhost ~]# systemctl start vncserver@:1.service


6,查看監聽接口

[root@localhost ~]# netstat -nat | grep 590*
tcp       0    0 0.0.0.0:5901     0.0.0.0:*     LISTEN    
tcp6      0    0 :::5901      :::*       LISTEN

 

7,查看排錯日誌

[root@localhost ~]# grep vnc/var/log/messages

8,登錄

wKioL1fjsq6xP-QXAAIVvcfYzj8390.png-wh_50


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章