谷歌云安装图形界面一键脚本

Chrome 远程桌面还支持 Windows 系统, 不限于 linux 系统,可从本地计算机或移动设备使用图形界面远程访问应用。按照以下过程使用自定义启动脚本来自动执行此过程。
复制以下 Shell 脚本并将其粘贴到自动化/启动脚本文本框中:

#!/bin/bash -x
#
# Startup script to install Chrome remote desktop and a desktop environment.
#
# See environmental variables at then end of the script for configuration
#

function install_desktop_env {
  PACKAGES="desktop-base xscreensaver"

  if [[ "$INSTALL_XFCE" != "yes" && "$INSTALL_CINNAMON" != "yes" ]] ; then
    # neither XFCE nor cinnamon specified; install both
    INSTALL_XFCE=yes
    INSTALL_CINNAMON=yes
  fi

  if [[ "$INSTALL_XFCE" = "yes" ]] ; then
    PACKAGES="$PACKAGES xfce4"
    echo "exec xfce4-session" > /etc/chrome-remote-desktop-session
    [[ "$INSTALL_FULL_DESKTOP" = "yes" ]] && \
      PACKAGES="$PACKAGES task-xfce-desktop"
  fi

  if [[ "$INSTALL_CINNAMON" = "yes" ]] ; then
    PACKAGES="$PACKAGES cinnamon-core"
    echo "exec cinnamon-session-cinnamon2d" > /etc/chrome-remote-desktop-session
    [[ "$INSTALL_FULL_DESKTOP" = "yes" ]] && \
      PACKAGES="$PACKAGES task-cinnamon-desktop"
  fi

  DEBIAN_FRONTEND=noninteractive \
    apt-get install --assume-yes $PACKAGES $EXTRA_PACKAGES

  systemctl disable lightdm.service
}

function download_and_install { # args URL FILENAME
  curl -L -o "$2" "$1"
  dpkg --install "$2"
  apt-get install --assume-yes --fix-broken
}

function is_installed {  # args PACKAGE_NAME
  dpkg-query --list "$1" | grep -q "^ii" 2>/dev/null
  return $?
}

# Configure the following environmental variables as required:
INSTALL_XFCE=yes
INSTALL_CINNAMON=yes
INSTALL_CHROME=yes
INSTALL_FULL_DESKTOP=yes

# Any additional packages that should be installed on startup can be added here
EXTRA_PACKAGES="less bzip2 zip unzip"

apt-get update

! is_installed chrome-remote-desktop && \
  download_and_install \
    https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb \
    /tmp/chrome-remote-desktop_current_amd64.deb

install_desktop_env

[[ "$INSTALL_CHROME" = "yes" ]] && \
  ! is_installed google-chrome-stable && \
  download_and_install \
    https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
    /tmp/google-chrome-stable_current_amd64.deb

echo "Chrome remote desktop installation completed"

每次重新启动机器时,此脚本都将执行以下任务:

  • 如果未安装远程桌面软件包:
    • 下载并安装 Chrome 远程桌面软件包。
    • 安装必需的软件包。
  • 安装 Xfce 或 Cinnamon 桌面环境(具体取决于脚本设置)。
  • 如果已启用完整桌面环境选项,请安装必要的软件包。
  • 如果已启用但未安装 Chrome 浏览器选项,请执行以下操作:
    • 下载并安装 Chrome 远程桌面软件包。
    • 安装必需的软件包。

监控进度,请使用 SSH 连接到虚拟机实例,并在实例的终端中运行以下命令:

sudo journalctl -o cat -f _SYSTEMD_UNIT=google-startup-scripts.service

//此命令显示启动脚本的输出。脚本完成后,您将看到以下内容:
INFO startup-script: Chrome remote desktop installation completed
INFO startup-script: Return code 0.
INFO Finished running startup scripts.

Debian安装图形界面

#环境 Linux 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64

#安装gnome图形相关软件
apt install x-window-system-core gnome-core  

#设置系统为图形界面启动,该命令执行后系统会重启
init 6 

#===设置系统可以root登录===

#修改/etc/gdm3/daemon.conf文件
vi /etc/gdm3/daemon.conf
#在[security]下增加一行AllowRoot = true

#修改/etc/pam.d/gdm-password文件
vi /etc/pam.d/gdm-password

#注释掉auth required pam_succeed_if.so user != root quiet_success

#重启系统后,即可使用root登录。