How To Set Up GUI On Amazon EC2 Ubuntu server

后端 未结 5 1233
青春惊慌失措
青春惊慌失措 2020-11-29 14:34

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 wa

5条回答
  •  情话喂你
    2020-11-29 15:15

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

    sudo apt-get update    sudo apt-get upgrade
    

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

    sudo vim /etc/ssh/sshd_config
    

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

    sudo /etc/init.d/ssh restart
    

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

    sudo –i
    passwd ubuntu
    

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

    su ubuntu
    cd
    

    10) Install Ubuntu desktop functionality on your Linux instance, the last command 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 manager for RDP connections.

    echo xfce4-session > ~/.xsession
    

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

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

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

    sudo vim /etc/xrdp/xrdp.ini
    

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

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

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

    16) Restart xrdp.

    sudo service xrdp restart
    

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

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

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

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

提交回复
热议问题