如何在 Amazon EC2 Ubuntu 服务器上设置 GUI [英] How To Set Up GUI On Amazon EC2 Ubuntu server

查看:37
本文介绍了如何在 Amazon EC2 Ubuntu 服务器上设置 GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 amazon Ubuntu EC2 实例,它只有一个命令行界面.我想为该服务器设置 UI 以使用远程桌面工具进行访问.有什么办法可以将GUI应用到EC2实例上?

解决方案

这可以做到.以下是设置 GUI 的步骤

使用密码登录创建新用户

sudo useradd -m awsgui须藤密码awsguisudo usermod -aG admin awsguisudo vim/etc/ssh/sshd_config # 将PasswordAuthentication"行编辑为yes须藤/etc/init.d/ssh 重启

在 AWS 上设置基于 ui 的 ubuntu 机器.

在安全组中打开端口 5901.然后 ssh 到服务器实例.运行以下命令安装ui和vnc服务器:

sudo apt-get 更新sudo apt-get install ubuntu-desktop须藤 apt-get 安装 vnc4server

然后运行以下命令并输入vnc连接的登录密码:

su - awsgui虚拟服务器vncserver -kill :1vim/home/awsgui/.vnc/xstartup

然后按 Insert 键,使用键盘箭头滚动文本文件,然后删除下面两行开头的井号 (#)为普通桌面取消注释以下两行."在第二行添加sh",所以该行显示为

exec sh/etc/X11/xinit/xinitrc.conf

完成后,按键盘上的 Ctrl + C,输入 :wq 并按 Enter.

然后再次启动 vnc 服务器.

vncserver

您可以从这里下载 xtightvncviewer 以查看桌面(对于 Ubutnu)https://help.ubuntu.com/community/VNC/Clients

在 vnc 客户端中,给公共 DNS 加上:1"(例如 www.example.com:1).输入vnc登录密码.确保使用正常连接.不要使用密钥文件.

此处提供其他指南:http://www.serverwatch.com/server-tutorials/setting-up-vnc-on-ubuntu-in-the-amazon-ec2-Page-3.html

Mac VNC 客户端可以从这里下载:https://www.realvnc.com/en/connect/download/viewer/

在控制台上打开端口

<块引用>

sudo iptables -A 输入 -p tcp --dport 5901 -j 接受

如果出现灰色窗口问题.主要是因为不同用户的.vnc/xstartup"文件.因此,也在同一用户而不是awsgui"用户上运行 vnc 服务器.

<块引用>

vncserver

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?

解决方案

This can be done. Following are the 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 ssh to the server instance. Run following commands to install ui and vnc server:

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

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

su - awsgui

vncserver

vncserver -kill :1

vim /home/awsgui/.vnc/xstartup

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

exec sh /etc/X11/xinit/xinitrc. 

When you're done, hit Ctrl + C on the keyboard, type :wq and hit Enter.

Then start vnc server again.

vncserver

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

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

Additional guide available here: 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 here: https://www.realvnc.com/en/connect/download/viewer/

Port opening on console

sudo iptables -A INPUT -p tcp --dport 5901 -j ACCEPT

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

vncserver

这篇关于如何在 Amazon EC2 Ubuntu 服务器上设置 GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆