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

Virtualized cloud computing-using vnc view to connect to public cloud servers

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

For public CVMs, especially linux, commands of ssh protocol are generally used to connect, and key pairs are used for secure password-free access. But the ssh connection is usually a character interface, and sometimes we need to use a graphical interface.

On Huawei Cloud, we try out a CVM and install ubuntu18, which can be controlled by using the vnc consle of the console. After installing the desktop, it is found that the effect is not very good. So I decided to use vnc view to connect to the CVM.

Prepare for

1. Configure the CVM and log in to unbuntu18 using the root account.

2. Install the vnc client on the personal computer, such as TightVNC or RealVNC

Install the desktop environment and vnc server

By default, the ubuntu18.04 server does not have a graphical environment or vnc server installed.

The desktop environment uses xfce, which is a compact, lightweight desktop that is suitable for remote connection scenarios of cloud servers.

Update package list

Sudo apt update

Install the xfce desktop environment now

Sudo apt install xfce4 xfce4-goodies

After the installation is complete, install the TightVNC server:

Sudo apt install tightvncserver

Use the vncserver command to configure after the installation is complete

Vncserver

Follow the prompts to configure

The password must be between six and eight characters long. Passwords longer than 8 characters are automatically truncated.

After verifying the password, you can choose to create a view-only password. Users who log in with only the view password will not be able to control the VNC instance using the mouse or keyboard. This is a useful option if you want to use a VNC server to present content to others, but it is not required.

Configure the vnc server

The vnc server needs to know the commands to be executed at startup, and which graphical interface to connect to

These commands are located in the configuration file called in the .vnc file of xstartup under the home directory, and vnc is enabled on tcp port 5901 for the first time. : 1 represents a vnc instance, such as: 2, 4, 4, 3, etc.

The first step is to stop: 1 instance

Vncserver-kill: 1

Modify the xtartup file

Vim / .vnc/xstartup

Add the following

#! / bin/bashxrdb $HOME/.Xresourcesstartxfce4 &

The first command in the file, xrdb $HOME/.Xresources, tells VNC's GUI framework to read the server user's .xresources file. Users can change some settings of the graphics desktop in .Xresources, such as terminal colors, cursor themes, and font rendering. The second command tells the server to start Xfce, where you can find all the graphics software you need to manage the server comfortably.

In order to ensure that the vnc service starts properly, you need to configure executable

Sudo chmod + x ~ / .vnc/xstartup

Now restart vncserver

Vncserver

CVM console configuration

Mainly configure security groups, release 5901 and 5900

Vnc login

Use vnc view to log in directly.

But there is no encryption when you log in directly using vnc, which is very dangerous. You can use xshell's ssh tunnel.

After ensuring that xshell can connect to the cloud server, configure the ssh tunnel

Then edit the add rule as follows

The destination host is a public cloud elastic ip address.

The tunnel will not take effect until xshell logs in to ssh and logs in to the public cloud server.

Then configure the vnc session as follows

Then log in.

Thinking

1. Consider changing to a more beautiful desktop

2. Vncserver can be configured with tls or ssl encryption

3. Xmanager can also connect to the desktop, but the configuration is very complex.

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