After I set up an Amazon EC2 Ubuntu Linux server, I can only access it with ssh command. But I really need the GUI interface to browse the ubuntu server easily. After investigating, I finally find the below method of how to enable the XServer on the amazon EC2 Ubuntu Linux server and how to connect to it with Microsoft remote desktop.
1. Enable GUI Access In Ubuntu Linux Server Side.
My ubuntu server version is 18.04.
- Connect to the Amazon EC2 Ubuntu Linux server with the ssh command line.
ssh -i "/Users/.../key.pem" [email protected]
- Update ubuntu server.
sudo apt-get update -y
- Install lxde package. This process may take some time to install a lot of packages.
sudo apt-get install lxde -y
- Install xrdp to allow the remote desktop connection.
sudo apt-get install xrdp -y
- Set a password for user ubuntu, this username is the default username when you use Microsoft remote desktop to connect to the ubuntu server.
sudo passwd ubuntu
2. Change Amazon EC2 Instance Security Group To Allow Remote Desktop Inbound Connection.
- Go to the Amazon EC2 Dashboard console in a web browser.
- Click the INSTANCES —> Instances menu item on left. In the right instance list panel, click the link in the ubuntu server instance Security Groups column.
- Then it will open the security group detail page. Click the Inbound tab.
- Click the Edit button below the Inbound tab to open the Inbound rule edit dialog.
- In the pop-up dialog, click Add Rule button then select RDP type, the port range number will be set to 3389 automatically.
- Input the source IP (0.0.0.0/0 if you want to access this ubuntu server instance from any IP address), click the Save button to save the changes.
3. Connect To EC2 Ubuntu Server Use Microsoft Remote Desktop.
- Open Microsoft remote desktop and add a server.
- Input the amazon EC2 Ubuntu Linux server IP address, then click Add button to add it.
- Double click the newly added server to connect to it, input username ubuntu and the password that you configured in section 1 in the popup authorization dialog. Then you can use the ubuntu server with GUI.