1. Origin
In the near future, we need a development platform with better performance, but the performance of the local computer is not very good, so we have the idea of using Aliyun's cloud server. We can try to install the Linux desktop environment in the cloud, and then use VNC to perform remote desktop. connect.
2. Install the Ubuntu desktop environment on Alibaba Cloud
2.1 Install related software
After we have purchased the ECS server on Alibaba Cloud, we can use xshell to remotely log in to the server. The Linux distribution we use this time is Ubuntu server 16.04. After the system is started, we first update the server:
sudo apt-get update
sudo apt-get upgrade
Next install the desktop environment:
sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
We can also enter directly
sudo apt-get install ubuntu-desktop
, but this will install libreOffice and other software unrelated to development.
There are a lot of programs to install, we Y
can start downloading and installing after entering:
Install vnc4server:
sudo apt-get install vnc4server
2.2 Configure vncserver
To run vncserver, enter the following command:
vncserver :1
vncserver will prompt you to set a password, you can enter the same password twice according to the situation. In this way, the vncserver is started, but we cannot access the vnc server through the vnc client normally.
Because in Alibaba Cloud's security policy, we did not release the port of vncserver , check the port that vncserver listens to.
At the same time, we need to release port 5901 in the Alibaba Cloud console.
Next we connect to the vnc server again
The system prompts that our communication is not encrypted. We have not completed the setup of vncserver, and now connect with the vnc client, the system returns only a white screen , because the gnome environment has not been started:
Next, we will add a statement to start gnome in the vncserver startup file. Before modifying the vncserver startup file, we need to close the vncserver. The command is as follows:
vncserver -kill :1
Then, we add the following statement to ~/.vnc/xstartup:
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
The final edit result is:
Start vncserver again
vncserver :1
According to the vncserver man manual, the command after the command :1
means "display number":
After the vnc service starts, the output:
We can now successfully use the vnc client to connect to the remote vnc server:
Next, we can also modify the resolution of the vnc server. According to the man manual of vncserver, we can geometry
set the resolution through options:
vncserver -kill :1
vncserver :1 -geometry 1920x1080
At this point, we can see a vnc desktop with a resolution of 1920x1080.