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

The solution of connecting black screen with vnc

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

Share

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

What this article shares to you is about the solution of vnc connecting to the black screen. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Try to install a VNC Server on CentOS. CentOS5 already has its own VNC, which is installed by default, as long as it is configured (if it is not installed, it can be installed by yum install vnc vncserver). The Windows client only needs to install a vncviewer, such as realvnc.

I use the IIS7 server management tool.

The VNC function in the IIS7 server management tool can be said to be very good to use. It can open links in batch.

Of course, since its VNC tools are so useful, its other functions must not be too bad. IIS7 server bulk management tools benefits: batch management, synchronization operations, expiration reminders, data security and periodic execution. Applicable systems: Windows and liunx operating systems. Vnc and Ftp batch operations are supported. The automatic update of the program will not make you suffer from the update, which saves you a lot of trouble. After all, the current software updates need to be re-downloaded and installed, which is very troublesome.

After installation and configuration, it cannot be used. There are two main problems:

1. Unable to connect to VNC Server.

2. Black screen appears after connecting.

The solution is summarized as follows:

VNCServer configuration:

1. Modify configuration file / root/.vnc/xstartup

Note: some system configurations have-nolisten tcp and-nohttpd, which prevent Xwindows login and HTTP VNC login. If you need a graphical interface, delete this part.

If you are using the gnome graphics interface, you need to comment out the following two lines

Xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" & twm &

And add the following line:

Gnome-session &

For example, my configuration file is as follows

! / bin/shUncomment the following two lines for normal desktop:

Unset SESSION_MANAGER

Exec / etc/X11/xinit/xinitrc

[- x / etc/vnc/xstartup] & & exec / etc/vnc/xstartup

[- r $HOME/.Xresources] & & xrdb $HOME/.Xresources

Xsetroot-solid grey

Vncconfig-iconic &

Xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" & twm &

Gnome-session &

Modify the user profile: / etc/sysconfig/vncservers

Open the configuration file: vi / etc/sysconfig/vncservers, and remove the "#" before the following two lines, that is, remove the comments from these two lines.

VNCSERVERS= "1:root"

VNCSERVERARGS [1] = "- geometry 800 × 600"

1 means that VNC runs as Desktop 1, which starts the desktop of root. You can add other users, such as VNCSERVERS= "

1RolootMagic 2Rom user1Rom User2 ", of course, these users exist in the implementation system.

For example, my / etc/sysconfig/vncservers configuration file is as follows:

VNCSERVERS= "1:root"

VNCSERVERARGS [1] = "- geometry 800 × 600"

In addition: if there is an image interface, check vncserver in system Settings > Server Settings > Services, and you can start with the system.

3. Change the permissions of xstartup

This problem is easy for many people to ignore, and it is also one of the reasons for the black screen after a successful connection.

In CentOS, the file path of xstartup is: / root/.vnc/ (you can view the file path of xstartup through locate xstartup)

So you need to execute: chmod 777 root/.vnc/xstartup

Turn off firewall restrictions on VNC ports

If you need to control a Linux of the internal network from the external network, you need to open the corresponding port of the firewall and map the port on the router.

The port of VNC to the browser is 5800N, and the port to vncviewer is 5900NMagneN is the set display number.

If you do not want to turn on the firewall, but still need the VNC service, you need to:

Edit vi / etc/sysconfig/iptables

Add the following two lines:

-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 5901-j ACCEPT

-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 5902-j ACCEPT

What is needed here is that the port corresponding to display N is 5900mm N, so it is not recommended to set too much.

Start VNC Server:

Open the terminal to execute: vncserver

The first time you run vncserver, you will be asked to enter your password twice and you will see the following prompt:

New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1

Starting applications specified in / root/.vnc/xstartup

Log file is / root/.vnc/localhost.localdomain:1.log

The ": 1" in the above information indicates the first vnc desktop launched.

Stop vncserver: (optional read)

Stop vncserver by executing: vncserver-kill: 1

Note: ": 1" means to stop the first vnc desktop, 1 represents the currently enabled VNCserver sequence number, and ": 1" is preceded by a space. If the current startup sequence number is 2, to turn it off, you should use "vncserver-kill: 2".

Modify vnc password: (optional read)

The way to change the vnc password is to execute: vncpasswd

Enter the password twice.

8: check whether the server-side VNC Server is running properly:

Execute: ps-ef | grep vnc

If vnc is executing, you can see a message similar to this:

[root @ IMS ~] # ps-ef | grep vnc

Root 3605 10 Jul13? 00:13:51 Xvnc: 1-desktop MyIMS.local:1 (root)-httpd / usr/share/vnc/classes-auth / root/.Xauthority-geometry 800x600-depth 16-rfbwait 30000-rfbauth / root/.vnc/passwd-rfbport 5901-pn

The description is that the serial number is ": 1" the vnc process listens on port 5901.

9.VNC client

After the server side is working properly, we can consider using the VNC client to connect to it.

Configuration of Windows client VNC Viewer:

Download VNC Free Edition for Windows Version 4.1.2

Open VNCViewer:

Fill in the IP of VNCServer: number (1 or 2 or …)

VNCViewer toggles full screen mode: F8

10 some configuration files:

/ etc/X11/xorg.conf sets the screen resolution

At this point, your VNC should be able to connect, but there may be a black screen problem:

1. Check the log log under / root/.vnc/ to see if there is any error; it is possible that the xstartup permission is not enough. "chmod xstartup 777" change

Permission, restart and then enter.

Restart the computer and give it a try. I am after various configurations, always black screen, restart the computer after OK.

The above is the solution for vnc to connect to the black screen. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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