Create an Ubuntu graphical interface for Aliyun lightweight server under Mac

This article first appeared on Chen Rui's blog ( 7988888.xyz ), and all links in this article are accessed through the blog.

By chance, I saw the official account activity of the computer tycoon Yupi, and earned the right to use Alibaba Cloud's lightweight server for one year. I have no idea about the server. Now that the wool has been collected, I wonder if I can put my personal blog on this server. The idea is good, but the reality is skinny.

1. Select the server system

Opening the server background of Alibaba Cloud, the first obstacle is to choose the server system. As for which system to choose, you need to choose according to your own preferences. I chose Windows at first, thinking that it would be easier to get started with a graphical interface. I didn't expect to be stumped by uppercase and lowercase in the first step of logging in. If you can't enter the password, you can't enter the system. I simply learned a little bit of Ubuntu knowledge at the front end and chose the Ubuntu system.

image-20211111204930128

image-20211111204947374

The second stumbling block is that I chose the 20.04 version. After looking at the remote connection, I didn’t expect it to be a command line interface. I also searched a lot on Baidu and found that the display interface can be connected remotely through VNC, but most of them use putty under windows, which is not important. , the difficulty is that I can't install vnc4server on 20.04, so I can't connect to the system.

Finally, I saw that many tutorials are based on 16.04, so I reset the system to Ubuntu 16.04 (as shown below)

image-20211111205742296

2. Install VNC and configure

Step 1: Connect to the server

Usually, you can use Alibaba Cloud's console browser to directly connect remotely (as shown in the figure below), but it always feels weird, and you should also pay attention to adjusting it to the root account.

image-20211111211048763

The advantage of the Mac system lies in the advantage of the terminal. You can directly connect to the server through SSH root@IP, which is simple and clear.

image-20211111211312180

Step 2: Install the VNC package

In the Ubuntu system, the installation package is really convenient, just use the command to install it online.

apt-get update #获取最新信息
apt-get install vnc4server #安装vnc,我的是已经安装了

image-20211111212757808

#启动vnc,看到desktop is  xxx:1表示启动成功
vncserver

You need to enter an 8-digit password. This password needs to be remembered. This password will be used later for remote connections via VNC.

3. Install the environment and configuration of the graphical desktop for Ubuntu

Several prerequisite packages that need to be installed.

#安装x-window
sudo apt-get install x-window-system-core
#安装登录管理器:
sudo apt-get install gdm
#安装Ubuntu的桌面:
sudo apt-get install ubuntu-desktop
#安装gnome软件:
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
#修改VNC配置文件:
vi ~/.vnc/xstartup
#重点文件修改为以下内容
#!/bin/sh
# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
 unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

image-20211111214143879

3. Remote connection (using VNC software)

First, enter vncserver -kill: 1 in the remote connection just now to disconnect the previous vnc connection. Re-enter the command to generate a new session:

vncserver :1

The important point is that you must set up two TCP ports 5900 and 5901 in the firewall of Alibaba Cloud, which are used by remote connections.

image-20211111214357395

Download the official website installation package VNC Viewer, the address is https://www.realvnc.com/en/connect/download/viewer/ , my local environment here is Macbook. The following platforms and software are supported

image-20211111214826659

After installing the VNC software, open it and enter the server IP: 1 in the figure to connect.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-9r8kp9Mf-1636639896493)(/Users/chenrui/Library/Application%20Support/typora-user-images/image- 20211111214930699.png)]

image-20211111215220812

image-20211111215247145

Enter the 8-digit password previously set using vnc to enter the following system interface.

image-20211111215352716

The interface appeared, successfully.

This article is only the recording process I used, if there is any errata, please understand.

image-20211111220238869

WeChat No public Station B Know almost CDN



Thank you for watching, if you find it helpful, please like or pay attention!


Author of this article: Chen Rui

Blog Address: Chen Rui Blog

Zhihu Address: Zhihu Column

Bookstore Address: Bookstore Homepage
Knowledge Planet: Planet Homepage

Guess you like

Origin blog.csdn.net/craig_cc/article/details/121277683