歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> centos7安裝tigervnc經驗

centos7安裝tigervnc經驗

日期:2017/3/6 9:43:02   编辑:學習Linux

centos7安裝tigervnc經驗


centos7安裝tigervnc經驗


1、如果第一次安裝tigervnc,可以跳過注意事項;

2、如果以前安裝過,需要注意幾點:查看/tmp/.X11-unix目錄,將X[1-9]的文件刪掉,注意X0不能刪除;

安裝步驟:

1、yum install tigervnc-server;

2、創建用戶useradd 000;如果使用已有用戶,需注意該用戶的/home下是否有.vnc目錄,如果有,請刪除;

3、cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service,這裡需要注意的是這個1,這裡可能是不定的,需要後續步驟確定;

4、vi /etc/systemd/system/vncserver@:1.service,對vncserver@:1.service中內容進行編輯:

[...][Service]Type=forking# Clean any existing files in /tmp/.X11-unix environmentExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"#PIDFile=/home/<USER>/.vnc/%H%i.pidExecStart=/sbin/runuser -l 000 -c "/usr/bin/vncserver %i"PIDFile=/home/000/.vnc/%H%i.pidExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
其他地方可以不改;

5、添加防火牆規則

firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload

如果提示firewalld沒啟動,請運行firewalld啟動防火牆,再運行上面兩條命令;

6、切換到000用戶

su - 000
vncserver

[srijan@server1 ~]$ vncserver

You will require a password to access your desktops.

Password:<--yourvncpassword
Verify:<--yourvncpassword
xauth: file /home/srijan/.Xauthority does not exist

New 'server1.example.com:1 (srijan)' desktop is server1.example.com:1

Creating default startup script /home/kishore/.vnc/xstartup
Starting applications specified in /home/kishore/.vnc/xstartup
Log file is /home/srijan/.vnc/server1.example.com:1.log

這裡要非常注意這個“1”,如果這裡出現的結果不是1,那麼請將vncserver@:1.service改為對應的值,原因不知道;

7、設置啟動

systemctl daemon-reload

systemctl enable vncserver@:1.service

systemctl start vncserver@:1.service

如果出現錯誤代碼98,請將vncserver@:1.service中的forking改為simple;

http://xxxxxx/Linuxjc/1134353.html TechArticle

Copyright © Linux教程網 All Rights Reserved