Centos7 Install VNC Step
I. Installation
1. Run the following command with root user to install vncserver;
Yum Install Tigervnc-server
2. Also run the following command to install the vncviewer;
Yum Install VNC
3. Stop and disable the firewall;
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
Two. Configure
1. Vncviewer is basically not configured;
2. Vncserver configuration, create a new configuration file to open window 1th as an example (you can also open multiple windows at the same time, modify the number), as follows:
Cp/lib/systemd/system/vncserver@.service/etc/systemd/system/vncserver@:1.service
Or add another window:
Cp/lib/systemd/system/vncserver@.service/lib/systemd/system/vncserver@:2.service
Edit Vi/etc/systemd/system/vncserver@:1.service to set user root related parameters (replace "<USER>" in the article with the username of your system, where I am filling in root, You can fill in your system login name, and the final contents are as follows:
1 2 3 4 5 6 7 8 9 10 |
[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" pidfile=/Root/.vnc/%h%i.pid Execstop=/bin/sh-c '/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | :' |
· The above content is best set to root, or you may see the following error:
1 2 3 4 5 6 7 8 9 10 11 |
Vncserver@:1.service-remote Desktop Service (VNC) Loaded:loaded (/usr/lib/systemd/system/vncserver@:1.service; enabled) Active:failed (Result:exit-code) since Tue 2015-04-14 CST; 1min 36s ago process:3258 execstart=/sbin/runuser-l sysadmin-c/usr/bin/vncserver%i (code=exited, Status=1/FAILURE) process:3254 execstartpre=/bin/sh-c/usr/bin/vncserver-kill%i >/dev/null 2>&1 | | : (code=exited, Status=0/success) APR 10:09:24 F1a-vmhost-swpe systemd[1]: Starting Remote Desktop Service (VNC) ... APR 10:09:24 f1a-vmhost-swpe runuser[3258]: Password: APR 10:09:24 f1a-vmhost-swpe systemd[1]: Vncserver@:1.service:control process exited, code=exited Status=1 APR 10:09:24 f1a-vmhost-swpe systemd[1]: Failed to start Remote Desktop Service (VNC). APR 10:09:24 f1a-vmhost-swpe systemd[1]: unit Vncserver@:1.service entered failed state. Warning:unit file changed on disk, ' Systemctl daemon-reload ' recommended. |
Three. Application
1. Update the SYSTEMCTL for the entry into force;
Systemctl Daemon-reload
2. Set the vncserver password;
VNCPASSWD Root
Enter a password and Confirm password as prompted
3. Launch the service window 1th to enable VNC;
Systemctl start Vncserver@:1.service or vncserver:1
Close Window No. 1th:
Systemctl Stop Vncserver@:1.service or vncserver-kill:1
4. Set to boot automatically;
Systemctl Enable Vncserver@:1.service
End.
Problem handling:
1, if the remote use of SSH can log on normally, and when the local log in Prompt "module is unknow", then use the remote use of "Tail-n 100/var/log/secure" to view the error, I was found the following error:
PAM unable Todlopen (/lib/security/pam_limits.so):/lib/security/pam_limits.so:cannot openshared object File:no such File or directory
That is to find pam_limits.so, looked at the corresponding directory does not have a corresponding file, after the search confirmed that the corresponding location of the 64-bit operating system is "/lib64/security/", so you can modify the login file.
Modify Vi/etc/pam.d/login
Comment out the following:
Session required/lib/security/pam_limits.so
To
Session required/lib64/security/pam_limits.so
And then try to login on the host can be resolved, at this time login can enter startx into the graphical interface, at this time VNC client login display "Oh no! Something has gone wrong "will not appear again.
2, show "Oh no! Something has gone wrong "
If the prompt "Oh no!" appears Something has gone wrong ", then ctrl+alt+f2 into command line mode
If you are prompted with "Moduleis Unknow" with the command line, use the following instructions to view the log:
Tail-n 100/var/log/secure
This error was found in the log.
PAM unable Todlopen (/lib/security/pam_limits.so):/lib/security/pam_limits.so:cannot openshared object File:no such File or directory
So in the/lib/security/below to see if the file is in the absence. No, sure.
Pam_limits.so configured in Oracle
Vi/etc/pam.d/login
Session required/lib/security/pam_limits.so
pam_limits.so this file system in the province should have, it is not the same Linux version of the path is not the same,
On the Internet, 64-bit systems are under/lib64/security/.
Modify Vi/etc/pam.d/login
Session required/lib64/security/pam_limits.so
Reboot system
Finally went in, the problem solved.
3, view the port number
View port Status: Netstat-lnt |grep 590*
4, view the port by that program occupy
lsof-i:5905
5,