0 votes
1 view
in AWS by (17.6k points)

I'm using an Amazon Ubuntu EC2 instance which is only has a command line interface. I want to setup UI for that server to access using remote desktop tools. Is there any way to apply GUI to the EC2 instance?

1 Answer

0 votes
by (41.4k points)

Follow these steps to do what you are asking:

Create new user with password login

sudo useradd -m awsgui

sudo passwd awsgui

sudo usermod -aG admin awsgui

 

sudo vim /etc/ssh/sshd_config # edit line "PasswordAuthentication" to yes

 

sudo /etc/init.d/ssh restart

Setting UI based Ubuntu machine

In security group, open port 5901. Then ssh to the server instance. Run these commands to install UI and VNC

sudo apt-get update

sudo apt-get install ubuntu-desktop

sudo apt-get install vnc4server 

Then run these commands and enter login password for VNC connection:

su - awsgui

vncserver

vncserver -kill :1

vim /home/awsgui/.vnc/xstartup

Now hit insert key. Scroll down and remove ‘#’ from two lines under “Uncomment the following two lines for normal desktop” this. Add “sh” so the line is read.

exec sh /etc/X11/xinit/xinitrc. 

Save by “:wq”, and enter.

Then start VNC server again.

vncserver

...