How To Set Up GUI On Amazon EC2 Ubuntu server

How To Set Up GUI On Amazon EC2 Ubuntu server

Questions : How To Set Up GUI On Amazon EC2 Ubuntu server

728

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

Total Answers 6
26

Answers 1 : of How To Set Up GUI On Amazon EC2 Ubuntu server

This can be done. Following are the in4codes_amazon-ec2 steps to setup the GUI

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 up ui based ubuntu machine on AWS.

In security group open port 5901. Then in4codes_amazon-ec2 ssh to the server instance. Run in4codes_amazon-ec2 following commands to install ui and vnc in4codes_amazon-ec2 server:

sudo apt-get update sudo apt-get install ubuntu-desktop sudo apt-get install vnc4server 

Then run following commands and enter in4codes_amazon-ec2 the login password for vnc connection:

su - awsgui vncserver vncserver -kill :1 vim /home/awsgui/.vnc/xstartup 

Then hit the Insert key, scroll around in4codes_amazon-ec2 the text file with the keyboard arrows, in4codes_amazon-ec2 and delete the pound (#) sign from the in4codes_amazon-ec2 beginning of the two lines under the in4codes_amazon-ec2 line that says “Uncomment the following in4codes_amazon-ec2 two lines for normal desktop.” And on in4codes_amazon-ec2 the second line add “sh” so the line in4codes_amazon-ec2 reads

exec sh /etc/X11/xinit/xinitrc. 

When you’re done, hit Ctrl + C on the in4codes_amazon-ec2 keyboard, type :wq and hit Enter.

Then start vnc server again.

vncserver 

You can download xtightvncviewer to view in4codes_amazon-ec2 desktop(for Ubutnu) from here in4codes_amazon-ec2 https://help.ubuntu.com/community/VNC/Clients

In the vnc client, give public DNS plus in4codes_amazon-ec2 “:1” (e.g. www.example.com:1). Enter the in4codes_amazon-ec2 vnc login password. Make sure to use a in4codes_amazon-ec2 normal connection. Don’t use the key in4codes_amazon-ec2 files.

Additional guide available here: in4codes_amazon-ec2 http://www.serverwatch.com/server-tutorials/setting-up-vnc-on-ubuntu-in-the-amazon-ec2-Page-3.html

Mac VNC client can be downloaded from in4codes_amazon-ec2 here: in4codes_amazon-ec2 https://www.realvnc.com/en/connect/download/viewer/

Port opening on console

sudo iptables -A INPUT -p tcp –dport in4codes_amazon-ec2 5901 -j ACCEPT

If the grey window issue comes. Mostly in4codes_amazon-ec2 because of “.vnc/xstartup” file on in4codes_amazon-ec2 different user. So run the vnc server in4codes_amazon-ec2 also on same user instead of “awsgui” in4codes_amazon-ec2 user.

vncserver

0

6

Answers 2 : of How To Set Up GUI On Amazon EC2 Ubuntu server

So I follow first answer, but my vnc in4codes_amazon-ec2 viewer gives me grey screen when I in4codes_amazon-ec2 connect to it. And I found this Ask in4codes_amazon-ec2 Ubuntu link to solve that.

The only difference with previous answer in4codes_amazon-ec2 is you need to install these extra in4codes_amazon-ec2 packages:

apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal 

And use this ~/.vnc/xstartup file:

#!/bin/sh export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal & 

Everything else is the same.

Tested on EC2 Ubuntu 14.04 LTS.

0

3

Answers 3 : of How To Set Up GUI On Amazon EC2 Ubuntu server

For Ubuntu 16.04

1) Install packages

$ sudo apt update;sudo apt install --no-install-recommends ubuntu-desktop $ sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal vnc4server 

2) Edit /usr/bin/vncserver file and in4codes_amazon-ec2 modify as below

Find this line

"# exec /etc/X11/xinit/xinitrcnn". 

And add these lines below.

"gnome-session &n". "gnome-panel &n". "gnome-settings-daemon &n". "metacity &n". "nautilus &n". "gnome-terminal &n". 

3) Create VNC password and vnc session in4codes_amazon-ec2 for the user using “vncserver” command.

[email protected]:~$ vncserver You will require a password to access your desktops. Password: Verify: xauth: file /home/lonely/.Xauthority does not exist New 'ubuntu:1 (lonely)' desktop is ubuntu:1 Creating default startup script /home/lonely/.vnc/xstartup Starting applications specified in /home/lonely/.vnc/xstartup Log file is /home/lonely/.vnc/ubuntu:1.log 

Now you can access GUI using IP/Domain in4codes_amazon-ec2 and port 1

stackoverflow.com:1

Tested on AWS and digital ocean .

For AWS, you have to allow port 5901 on in4codes_amazon-ec2 firewall

To kill session

$ vncserver -kill :1 

Refer:

https://linode.com/docs/applications/remote-desktop/install-vnc-on-ubuntu-16-04/

Refer this guide to create permanent in4codes_amazon-ec2 sessions as service

http://www.krizna.com/ubuntu/enable-remote-desktop-ubuntu-16-04-vnc/

0

5

Answers 4 : of How To Set Up GUI On Amazon EC2 Ubuntu server

1) Launch Ubuntu Instance on EC2. 2) in4codes_amazon-ec2 Open SSH Port in instance security. 3) in4codes_amazon-ec2 Do SSH to instance. 4) Execute:

sudo apt-get update sudo apt-get upgrade 

5) Because you will be connecting from in4codes_amazon-ec2 Windows Remote Desktop, edit the in4codes_amazon-ec2 sshd_config file on your Linux instance in4codes_amazon-ec2 to allow password authentication.

sudo vim /etc/ssh/sshd_config 

6) Change PasswordAuthentication to yes in4codes_amazon-ec2 from no, then save and exit. 7) Restart in4codes_amazon-ec2 the SSH daemon to make this change take in4codes_amazon-ec2 effect.

sudo /etc/init.d/ssh restart 

8) Temporarily gain root privileges and in4codes_amazon-ec2 change the password for the ubuntu user in4codes_amazon-ec2 to a complex password to enhance in4codes_amazon-ec2 security. Press the Enter key after in4codes_amazon-ec2 typing the command passwd ubuntu, and in4codes_amazon-ec2 you will be prompted to enter the new in4codes_amazon-ec2 password twice.

sudo –i passwd ubuntu 

9) Switch back to the ubuntu user in4codes_amazon-ec2 account and cd to the ubuntu home in4codes_amazon-ec2 directory.

su ubuntu cd 

10) Install Ubuntu desktop functionality in4codes_amazon-ec2 on your Linux instance, the last command in4codes_amazon-ec2 can take up to 15 minutes to complete.

export DEBIAN_FRONTEND=noninteractive sudo -E apt-get update sudo -E apt-get install -y ubuntu-desktop 

11) Install xrdp

sudo apt-get install xfce4 sudo apt-get install xfce4 xfce4-goodies 

12) Make xfce4 the default window in4codes_amazon-ec2 manager for RDP connections.

echo xfce4-session > ~/.xsession 

13) Copy .xsession to the /etc/skel in4codes_amazon-ec2 folder so that xfce4 is set as the in4codes_amazon-ec2 default window manager for any new user in4codes_amazon-ec2 accounts that are created.

sudo cp /home/ubuntu/.xsession /etc/skel 

14) Open the xrdp.ini file to allow in4codes_amazon-ec2 changing of the host port you will in4codes_amazon-ec2 connect to.

sudo vim /etc/xrdp/xrdp.ini 

(xrdp is not installed till now. First in4codes_amazon-ec2 Install the xrdp with sudo apt-get in4codes_amazon-ec2 install xrdp then edit the above in4codes_amazon-ec2 mentioned file)

15) Look for the section [xrdp1] and in4codes_amazon-ec2 change the following text (then save and in4codes_amazon-ec2 exit [:wq]).

port=-1 - to - port=ask-1 

16) Restart xrdp.

sudo service xrdp restart 

17) On Windows, open the Remote Desktop in4codes_amazon-ec2 Connection client, paste the fully in4codes_amazon-ec2 qualified name of your Amazon EC2 in4codes_amazon-ec2 instance for the Computer, and then in4codes_amazon-ec2 click Connect.

18) When prompted to Login to xrdp, in4codes_amazon-ec2 ensure that the sesman-Xvnc module is in4codes_amazon-ec2 selected, and enter the username ubuntu in4codes_amazon-ec2 with the new password that you created in4codes_amazon-ec2 in step 8. When you start a session, the in4codes_amazon-ec2 port number is -1.

19) When the system connects, several in4codes_amazon-ec2 status messages are displayed on the in4codes_amazon-ec2 Connection Log screen. Pay close in4codes_amazon-ec2 attention to these status messages and in4codes_amazon-ec2 make note of the VNC port number in4codes_amazon-ec2 displayed. If you want to return to a in4codes_amazon-ec2 session later, specify this number in in4codes_amazon-ec2 the port field of the xrdp login dialog in4codes_amazon-ec2 box.

See more in4codes_amazon-ec2 details: https://aws.amazon.com/premiumsupport/knowledge-center/connect-to-linux-desktop-from-windows/ in4codes_amazon-ec2 http://c-nergy.be/blog/?p=5305

0

6

Answers 5 : of How To Set Up GUI On Amazon EC2 Ubuntu server

For LXDE/Lubuntu


1. connect to your instance (local forwarding port 5901)

ssh -L 5901:localhost:5901 -i “xxx.pem” in4codes_amazon-ec2 [email protected]

2. Install packages

sudo apt update && sudo apt in4codes_amazon-ec2 upgrade sudo apt-get install xorg lxde in4codes_amazon-ec2 vnc4server lubuntu-desktop

3. Create /etc/lightdm/lightdm.conf

sudo nano /etc/lightdm/lightdm.conf

4. Copy and paste the following into the lightdm.conf and save

[SeatDefaults] allow-guest=false in4codes_amazon-ec2 user-session=LXDE #user-session=Lubuntu

5. setup vncserver (you will be asked to create a password for the vncserver)

vncserver sudo echo “lxpanel & in4codes_amazon-ec2 /usr/bin/lxsession -s LXDE &” in4codes_amazon-ec2 >> ~/.vnc/xstartup

6. Restart your instance and reconnect

sudo reboot ssh -L 5901:localhost:5901 in4codes_amazon-ec2 -i “xxx.pem” [email protected]

7. Start vncserver

vncserver -geometry 1280×800

8. In your Remote Desktop Client (e.g. Remmina) set Server to localhost:5901 and protocol to VNC

0

5

Answers 6 : of How To Set Up GUI On Amazon EC2 Ubuntu server

I ran into the same problem, and ended in4codes_amazon-ec2 up writing a how-to guide for myself in4codes_amazon-ec2 (https://dugas.ch/lord_of_the_files/run_your_unity_ml_executable_in_the_cloud.html)

The responses here are good for getting in4codes_amazon-ec2 one solution up and running, but I in4codes_amazon-ec2 recommend understanding the basics of in4codes_amazon-ec2 the different layers which result in a in4codes_amazon-ec2 functioning GUI / OpenGL environment / in4codes_amazon-ec2 remote desktop in Unix. It also matters in4codes_amazon-ec2 whether you want things to run on the in4codes_amazon-ec2 GPU, or the CPU.

In that mindset, launching each in4codes_amazon-ec2 component yourself makes it clearer what in4codes_amazon-ec2 is doing what.

In short, you want to:

  • start the x server (GPU / CPU)
  • start the desktop environment
  • start the vnc server
  • enable firewall traffic on the vnc port (in the AWS console)

the trickiest part is to get the in4codes_amazon-ec2 x-server running, either directly with in4codes_amazon-ec2 xorg using nvidia drivers and a virtual in4codes_amazon-ec2 screen (GPU) or using Xvfb (CPU)

For example with Xvfb (CPU):

  • x server
Xvfb :0 -screen 0 1024x768x24 +extension GLX +render -noreset >> xsession.log 2>&1 & 
  • desktop environment
DISPLAY=:0 startxfce4 
  • vnc server
x11vnc -display :0 -usepw -rfbport 5901 

0

Answer Link
jidam
  • Unable to run NoraUI mvn verify goal
  • Unable to run my app on emulator in VS Code
  • Unable to run multiple instances of libVLC(MobileVLCKit) in IOS via flutter framework
  • Unable to run make on griddb source on ubuntu 20.04 (building from source)
  • Unable to run latexindent macOS Monterey 12.0.1
  • Unable to run kotlinc-native command
  • Unable to run JUnit Test… Java.lang.ExceptionInInitializerError (Android Studio)
  • Unable to run java with -Xmx > 966m
  • Unable to run ionic cap run android from wsl2 inorder to start android emulator
  • Unable to run Intel HAXM installer: Cannot start process, the working directory does not exist
  • fs
  • Unable to run Google Analytics sample code
  • unable to run flutter run after upgarding to flutter 2.8.0 from 2.5.3
  • Unable to run Django with PostgreSQL in Docker
  • Unable to Run Container Using testcontainers
  • Unable to run ClojureScript Hello World program, Error building classpath. Error reading edn.
  • unable to run client command for apache karaf 4.3.3 through remote server
  • Unable to run c program 2nd time using eclipse
  • unable to run c++ in visual studio code on m1 chipset
  • Unable to run Android Instrumented Tests
  • Unable to run adb, check your Android SDK installation and ANDROID_SDK_ROOT environment variable: …AndroidSdkplatform-toolsadb.exe
  • Unable to run a singlespecific .spec.ts file through angular cli using ng test –include option
  • Unable to run a Mango query
  • Unable to return response back to view in laravel from package
  • Unable to return object reference in std::optional
  • Unable to return NULL in a function that expects an integer return type
  • Unable to return correct change in JavaScript Cash Register
  • Unable to retrieve version information from Elasticsearch nodes. Request timed out
  • Unable to retrieve values from Axios Response data
  • Unable to retrieve dotenv JWT secret Error: secretOrPrivateKey must have a value
  • Unable to resolve your shell environment
  • Unable to resolve token for FCM while implementing Push notification for Xamarin
  • Unable to resolve the request yii
  • Unable to resolve service for type Swashbuckle.AspNetCore.Swagger.ISwaggerProvider
  • Unable to resolve service for type Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger