Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Red Hat 7 vncserver

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to configure Red Hat 7 vncserver", which is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to configure Red Hat 7 vncserver.

First, configure the yum source, query what packages vncserver needs to install, and then install it.

[root@localhost] # yum provides vncserverLoaded plugins: langpacks, product-id, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.yum | 4.1 kB 00:00:00 (1amp 2): yum/group_gz | | 134 kB 00:00:00 (2 amp 2): yum/primary_db | | | 3.4 MB 00:00:00 yum/filelists_db | 3.0 MB 00:00:00 tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64 | : A TigerVNC serverRepo: yumMatched from:Filename: / usr/bin/vncserver [root@localhost ~] # yum install tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64-y....Installed: tigervnc-server.x86_64 0VV 1.2.80-0.30.20130314svn5065.el7 Complete!

In this way, vncserver is installed, and the command vncserver can be started or managed. If you start vncserver for the first time, you will be prompted to change the password. This password is used for vnc client connections.

[root@localhost ~] # vncserver New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1Starting applications specified in / root/.vnc/xstartupLog file is / root/.vnc/localhost.localdomain:1.log starts with vncserver. By default, it starts from the lowest port (1), and then increments in turn. If you want to specify the vnc port, You can use ncserver [:] [root@localhost ~] # vncserver: 2016New 'localhost.localdomain:2016 (root)' desktop is localhost.localdomain:2016Starting applications specified in / root/.vnc/xstartupLog file is / root/.vnc/localhost.localdomain:2016.log to view the currently running vnc information through vncserver-list [root@localhost ~] # vncserver-listTigerVNC server sessions:X DISPLAY # PROCESS ID:1 8167 2016 8670 After vncserver-kill: you can close the vnc port [root@localhost ~] # vncserver-kill: 1Killing Xvnc process ID 8167

Of course, the client has to go through the consent of the firewall to access the vnc, and it needs to release the vnc in the firewall or turn off the firewall directly. It is tested here that after the firewall is released, it is accessed by default through the port initiated by vncserver, but the port initiated by vncserver: port_number is still inaccessible.

The firewall is configured to release vncserver [root@localhost ~] # firewall-cmd-- permanent-- add-service=vnc-server success [root@localhost ~] # firewall-cmd-reloadsuccess or turn off the firewall, and prohibit the firewall from booting itself. [root@localhost ~] # systemctl stop firewalld [root@localhost ~] # systemctl disable firewalld rm'/ etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'rm'/ etc/systemd/system/basic.target.wants/firewalld.service'

Above, the installation and configuration of vnc is almost complete. Next, you need to configure vncserver to boot.

Use rpm- qc tigervnc-server to query the configuration of vncserver.

Knowing that the configuration file has been transferred to / lib/systemd/system/vncsercer@.server, the header of the file is described in detail.

[root@localhost ~] # rpm-qc tigervnc-server/etc/sysconfig/vncservers [root@localhost ~] # cat / etc/sysconfig/vncservers# THIS FILE HAS BEEN REPLACED BY / lib/systemd/system/vncserver@.service [root@localhost ~] # head / lib/systemd/system/vncserver@.service # The vncserver service unit file## Quick HowTo:# 1. Copy this file to / etc/systemd/system/vncserver@:.service# 2. Edit and vncserver parameters appropriately# ("runuser-l- C / usr/bin/vncserver% I-arg1-arg2 ") # 3. Run `systemctl daemon- reload` # 4. Run `systemctl enable vncserver@: .service` # DO NOT RUN THIS SERVICE if your local area network is

Configuration method:

1. Copy the current file (/ lib/systemd/system/vncsercer@.server) to / etc/systemd/system/vncserver@:.server here is the startup port

two。 Edit the copied document and replace the two places with the user that needs to be started. It should be noted that if you start with root, the home directory of root is / root, not / home/root

3. Run systemctl daemon-reload to reload the configuration

4. Running systemctl enable vncserver@:.service is configured to boot automatically

[root@localhost ~] # cp / lib/systemd/system/vncserver@.service / etc/systemd/system/vncserver@:1.service [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 environmentExecStartPre=/bin/sh-c'/ usr/bin/vncserver-kill% I > / dev/null 2 > & 1 |: 'ExecStart=/sbin/ Runuser-l root-c "/ usr/bin/vncserver% I" # modify the user name of this line PIDFile=/root/.vnc/%H%i.pid # modify the user home directory of this line ExecStop=/bin/sh-c'/ usr/bin/vncserver-kill% I > / dev/null 2 > & 1 | |'[Install] WantedBy=multi-user.target [root@localhost ~] # systemctl daemon-reload [root@localhost ~] # systemctl start vncserver@:1.service ( Start manually here) [root@localhost ~] # systemctl status vncserver@:1.service (check the operation is active) vncserver@:1.service-Remote desktop service (VNC) Loaded: loaded (/ etc/systemd/system/vncserver@:1.service) Enabled) Active: active (running) since Fri 2016-01-22 17:00:34 CST 7s ago [root@localhost ~] # vncserver-list TigerVNC server sessions:X DISPLAY # PROCESS ID:1 9959 [root@localhost ~] # systemctl enable vncserver@:1.service add self-boot after confirming that manual startup is OK) [root@localhost ~] # reboot (restart test) Last login: Fri Jan 22 16:30:36 2016 from 192.168.175.1 [root@localhost ~] # vncserver-list (check that vnc has been started after reboot. ) TigerVNC server sessions:X DISPLAY # PROCESS ID:1 1522 [root@localhost ~] # ps-ef | grep vncroot 1522 11 17:10? 00:00:00 / usr/bin/Xvnc: 1-desktop localhost.localdomain:1 (root)-auth / root/.Xauthority-geometry 1024x768-rfbwait 30000-rfbauth / root/.vnc/passwd-rfbport 5901-fp catalogue:/etc/X11/fontpath.d-pnroot 1907 10 17:10? 00:00:00 / usr/bin/vncconfig-iconicroot 3167 3120 0 17:11 pts/0 00:00:00 grep-- color=auto vnc

At this point, the configuration of vncserver is complete.

In the process, once do not know what misoperation, port 1 has been unable to start. Cannot see the process, but keeps prompting that it has been started, and the restart auto-boot also fails.

[root@kvm02 ~] # systemctl status vncserver@\: 1.service vncserver@:1.service-Remote desktop service (VNC) Loaded: loaded (/ usr/lib/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2016-01-22 21:28:33 CST 1min 35s ago Process: 1154 ExecStart=/sbin/runuser-l root-c / usr/bin/vncserver% I (code=exited, status=2) Process: 1132 ExecStartPre=/bin/sh-c / usr/bin/vncserver-kill% I > / dev/null 2 > & 1 | | (code=exited, status=0/ SUCCESS) [root@kvm02 .vnc] # vncserver: 1A VNC server is already running as: 1 [root@kvm02 .vnc] # ps-ef | grep vncroot 7146 1667 0 22:29 pts/0 00:00:00 grep-- color=auto vnc

Finally, during a startup, a file was found to be locked under / tmp/.X11-unix/. Just change to the directory and delete the file.

Error message: Warning: kvm02:1 is taken because of / tmp/.X11-unix/X1Remove this file if there is no X server kvm02:1 solution: [root@kvm02 ~] # cd / tmp/.X11-unix [root@kvm02. X11-unix] # rm-rf * (deleted all files, here is impulsive In fact, just delete X1) [root@kvm02. X11-unix] # vncserver (after deletion can start normally) xauth: (stdin): 1: bad display name "kvm02:1" in "commandNew 'kvm02:1 (root)' desktop is kvm02:1Starting applications specified in / root/.vnc/xstartupLog file is / root/.vnc/kvm02:1.log above is" Red Hat 7 vncserver how to configure "all the contents of this article, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report