原文:https://help.aliyun.com/knowledge_detail/59330.html
1. 创建Ubuntu服务器
访问轻量应用服务器购买页面,选择Ubuntu镜像,并选择套餐、购买时长,确认订单支付并确认。
2. 安装配置软件
创建服务器成功后,点击服务器列表页的Ubuntu轻量应用服务器卡片的远程连接按钮
连接成功后开始安装软件。
VNC的安装与配置
安装之前先输入
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
apt-get update
</pre>
获取最新套件的信息。
输入以下命令安装VNC,安装过程中需要输入Y来确认
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
apt-get install vnc4server
</pre>
启动VNC
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
vncserver
</pre>
看到 New ‘iZbp1idfrdpf1c3its2hpkZ:1 (root)’ desktop is iZbp1idfrdpf1c3its2hpkZ:1字样的时候,说明启动成功。
gnome 桌面环境安装与配置
安装x-windows的基础
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
sudo apt-get install x-window-system-core
</pre>
安装登录管理器
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
sudo apt-get install gdm
</pre>
安装Ubuntu的桌面
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
sudo apt-get install ubuntu-desktop
</pre>
安装gnome配套软件
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
</pre>
修改VNC配置文件
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
vi ~/.vnc/xstartup
</pre>
修改为
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
#!/bin/sh
# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
</pre>
杀掉原桌面进程,输入命令(其中的:1是桌面号):
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
vncserver -kill :1
</pre>
输入以下命令生成新的会话:
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; padding: 10px; margin: 0px 0px 25px; overflow: auto; font: 14px / 1.45 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; background: rgb(247, 247, 247); overflow-wrap: break-word; white-space: pre-wrap;">
vncserver :1
</pre>
开启VNC服务需要用到的5900和5901端口,具体可查看防火墙功能说明。