我知道 AWS 上的 EC2 等云实例安装最少的 Linux 操作系统,因此 UI 无法通过任何远程桌面协议(protocol)(如 VNC)使用。
我想知道是否有任何方法可以在我的 AWS/EC2 上安装标准的 ubuntu UI,然后我可以使用一些远程桌面协议(protocol)进行访问?
最佳答案
是的,您可以安装 xfce 并在远程系统上使用 VNC 查看器使用它。
您需要执行以下步骤:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vnc4server
sudo apt-get install gnome-core xfce4 xfce4-goodies firefox nano -y --force-yes
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
vim ~/.vnc/xstartup
将这些行粘贴到其中
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
sudo chmod +x ~/.vnc/xstartup
sudo vim /etc/init.d/vncserver
将以下代码粘贴到其中:
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="user"
DISPLAY="1"
DEPTH="16"
GEOMETRY="1024x768"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
. /lib/lsb/init-functions
case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
sudo chmod +x /etc/init.d/vncserver
sudo service vncserver start
ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip_address
sudo update-rc.d vncserver defaults
这些指南提供了很大帮助。
Linode: Using VNC to operate a desktop on ubuntu
DigitalOcean: Installing and configuring VNC
关于ubuntu - 有没有办法在 EC2 上运行 Ubuntu 的 UI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22268152/