Para gerencie instâncias sem fazer login, execute comandos ou enviar arquivos pelo console ou por uma API, instale e execute o agente do Cloud Assistant nas instâncias de destino.
Aplicabilidade
O agente do Cloud Assistant é compatível com os seguintes sistemas operacionais:
Linux: Alibaba Cloud Linux, AlmaLinux 8+, Anolis OS 7+, CentOS 5+, Debian 8+, Ubuntu 12+, RHEL 5+, SUSE 11+, Fedora 33+, CoreOS e OpenSUSE.
FreeBSD: 11+.
Windows: Windows Server 2012+.
A Alibaba Cloud pré-instala o agente do Cloud Assistant em instâncias ECS criadas a partir de imagens públicas após 1º de dezembro de 2017.
Procedimento
Console
Acesse a página ECS console - Cloud Assistant.
No canto superior esquerdo da página, selecione o grupo de recursos e a região dos recursos de destino.
-
Clique em na aba ECS Instance para visualize o status do Cloud Assistant das instâncias ECS na região atual.
Normal: o agente está instalado.
Not Installed: clique em Install e aguarde a conclusão da instalação. Reinicie a instância e verifique se o status mudou para Normal.
Abnormal: para mais informações, consulte Handle exceptions for Cloud Assistant.
Linux instance
Etapa 1: Verificar a instalação do agente
-
Identifique o tipo de sistema init.
O sistema init carrega e gerencia processos de service na inicialização. Os comandos do agente do Cloud Assistant variam conforme o sistema init.
systemd: Alibaba Cloud Linux, CentOS 7+, RHEL 7+, Fedora 15+, Ubuntu 15.04+, Debian 8+ e outras distribuições similares.Upstart: Ubuntu 6.10 a 14.10, RHEL 6, CentOS 6 e outras distribuições similares.SysVinit: RHEL 5, CentOS 5, Debian 6 e outras distribuições similares.
-
Verifique se o agente do Cloud Assistant está instalado.
systemd
systemctl status aliyun.serviceSe a saída contiver a mensagem
Unit aliyun.service could not be found, o agente não está instalado.Upstart
/sbin/initctl status aliyun-serviceSe a saída contiver a mensagem
initctl: Unknown job: aliyun-service, o agente não está instalado.SysVinit
/etc/init.d/aliyun-service statusSe a saída estiver vazia, o agente não está instalado.
Etapa 2: Baixe e instale o agente
Este script destina-se a instâncias ECS da Alibaba Cloud. Por padrão, ele instala a versão mais recente do agente. Para instalar uma versão específica, modifique VERSION=latest.
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
REGION=$(curl -s http://100.100.100.200/latest/meta-data/region-id)
DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
# Detect whether the system is openSUSE or SLES.
is_suse_like() {
if [[ -f /etc/os-release ]]; then
local os_id
os_id=$(grep -E "^ID=" /etc/os-release | tr -d '"' | cut -d= -f2)
local os_version
os_version=$(grep -E "^VERSION_ID=" /etc/os-release | tr -d '"' | cut -d= -f2 | cut -d. -f1)
if ([[ "$os_id" == "opensuse"* ]] || [[ "$os_id" == "sles" ]]) && [[ "$os_version" == "16" ]]; then
return 0
fi
fi
return 1
}
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
if command -v rpm && ! command -v dpkg; then
if [[ "$arch" == "x86_64" ]] && is_suse_like; then
PACKAGE="aliyun_assist_${VERSION}_x86_64.rpm"
else
PACKAGE="aliyun_assist_${VERSION}.rpm"
fi
else
if [[ "$arch" == "x86_64" ]] && is_suse_like; then
PACKAGE="aliyun_assist_${VERSION}_x86_64.deb"
else
PACKAGE="aliyun_assist_${VERSION}.deb"
fi
fi
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
if command -v rpm && ! command -v dpkg; then
PACKAGE="aliyun-assist-${VERSION}-1.aarch64.rpm"
else
PACKAGE="aliyun-assist_${VERSION}-1_arm64.deb"
fi
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
;;
esac
echo "[main] package = ${PACKAGE}"
echo "[main] pkg_uri = ${PKG_URI}"
if command -v wget; then
sudo wget -O "${PACKAGE}" "${PKG_URI}"
elif command -v curl; then
sudo curl -o "${PACKAGE}" "${PKG_URI}"
else
echo "[WARN] command wget/curl not found, exit"
exit 1
fi
if command -v rpm && ! command -v dpkg; then
sudo rpm -ivh --force "${PACKAGE}"
elif command -v dpkg; then
sudo dpkg -i "${PACKAGE}"
else
echo "[WARN] command rpm/dpkg not found, exit"
exit 2
fi
if [[ -e /etc/redhat-release ]]; then
if sudo systemctl status qemu-guest-agent; then
sudo systemctl stop qemu-guest-agent
sudo systemctl disable qemu-guest-agent
sudo systemctl restart aliyun.service
fi
fi
Windows instance
Etapa 1: Verificar a instalação do agente
Connect to a Windows instance using a Remote Desktop client or the Windows App.
-
Verifique o status do service do Cloud Assistant.
Abra o menu Iniciar e pesquise por .
Acesse .
-
Procure por Aliyun Assist Service. Se não estiver listado, o agente não está instalado.
Se o service existir e seu status for Running com o tipo de inicialização definido como Automatic, o agente do Cloud Assistant está instalado e funcionando corretamente.
Etapa 2: Baixe e instale o agente
Método 1: Baixe pelo navegador
-
Baixe o agente do Cloud Assistant.
Substitua {regionId} pelo region ID da sua instância e abra a URL no navegador.
https://aliyun-client-assist-{regionId}.oss-{regionId}-internal.aliyuncs.com/windows/aliyun_agent_latest_setup.exe # Example download URL for the China (Hangzhou) region (cn-hangzhou) https://aliyun-client-assist-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/windows/aliyun_agent_latest_setup.exe -
Instale o agente do Cloud Assistant.
Clique em duas vezes no arquivo do agente do Cloud Assistant e siga o assistente de instalação. O caminho de instalação padrão é
C:\ProgramData\aliyun\assist\.
Método 2: Usar PowerShell
Substitua {regionId} pelo region ID da sua instância e execute os seguintes comandos no PowerShell.
curl -UseBasicParsing -Uri https://aliyun-client-assist-{regionId}.oss-{regionId}-internal.aliyuncs.com/windows/aliyun_agent_latest_setup.exe -OutFile 'C:\aliyun_agent_latest_setup.exe'
& "C:\aliyun_agent_latest_setup.exe" /S
API
O processo de instalação via API é o mesmo para todos os sistemas operacionais compatíveis.
-
Chame a operação DescribeCloudAssistantStatus para verificar se o agente do Cloud Assistant está instalado na instância ECS de destino.
Se o parâmetro
CloudAssistantStatusretornarfalse, o agente não está instalado. Caso o agente não esteja instalado, chame a operação InstallCloudAssistant para instalar o agente do Cloud Assistant.
Após concluir a instalação, chame a operação RebootInstance para reiniciar a instância ECS e aplicar as alterações.
CLI
Use a Alibaba Cloud CLI para instalar o agente do Cloud Assistant na maioria dos sistemas operacionais compatíveis. Substitua <YOUR-REGION-ID> pelo region ID da sua instância ECS e <YOUR-INSTANCE-ID> pelo ID da sua instância ECS.
O Red Hat Enterprise Linux (RHEL) não oferece suporte à instalação via Alibaba Cloud CLI.
-
Chame a operação DescribeCloudAssistantStatus para verificar se o agente do Cloud Assistant está instalado na instância ECS de destino.
aliyun ecs DescribeCloudAssistantStatus --RegionId <YOUR-REGION-ID> --InstanceId.1 <YOUR-INSTANCE-ID> --output cols=CloudAssistantStatus rows=InstanceCloudAssistantStatusSet.InstanceCloudAssistantStatus[]Se o comando retornar
CloudAssistantStatus=true, o agente do Cloud Assistant está instalado na instância ECS. -
Chame a operação InstallCloudAssistant para instalar o agente do Cloud Assistant.
aliyun ecs InstallCloudAssistant --RegionId <YOUR-REGION-ID> --InstanceId.1 <YOUR-INSTANCE-ID> -
Chame a operação RebootInstance para reiniciar a instância ECS.
aliyun ecs RebootInstance --InstanceId <YOUR-INSTANCE-ID>
FAQ
Sistemas operacionais incompatíveis
Migrate the OS: atualize ou migre o sistema atual para uma versão compatível.
Replace the OS (change the system disk): utilize o recurso Replace OS para instalar um sistema operacional compatível na instância.
Limites de instalação da versão mais recente
Alguns kernels limitam a versão máxima do agente que pode ser instalada.
Execute o comando uname -r para verificar a versão do kernel.
Versão do kernel da instância | Versão máxima compatível |
Versão do kernel Linux < 2.6.32 |
|
Versão do kernel FreeBSD < 12.x | 2.3.3.529 |
Instalação no FreeBSD
-
Para instâncias ECS da Alibaba Cloud
#!/bin/sh VERSION=latest use_curl=0 which curl >/dev/null 2>&1 && use_curl=1 if [ $use_curl -eq 1 ];then REGION=$(curl http://100.100.100.200/latest/meta-data/region-id) else REGION=$(wget -O - http://100.100.100.200/latest/meta-data/region-id) fi DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com PACKAGE=aliyun_assist_${VERSION}.txz PKG_URI="https://$DOMAIN/freebsd/$PACKAGE" if [ $use_curl -eq 1 ];then curl -o $PACKAGE $PKG_URI else wget -O $PACKAGE $PKG_URI fi pkg install -U -y $PACKAGE service aliyun start -
Para instâncias gerenciadas (servidores fora da Alibaba Cloud)
#!/bin/sh VERSION=latest DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com PACKAGE=aliyun_assist_${VERSION}.txz PKG_URI="https://$DOMAIN/freebsd/$PACKAGE" use_curl=0 which curl >/dev/null 2>&1 && use_curl=1 if [ $use_curl -eq 1 ];then curl -o $PACKAGE $PKG_URI else wget -O $PACKAGE $PKG_URI fi pkg install -U -y $PACKAGE service aliyun start
Instalação em instância gerenciada
Linux
Este script instala a versão mais recente do agente por padrão. Para instalar uma versão específica, modifique VERSION=latest .
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
# Detect whether the system is openSUSE or SLES.
is_suse_like() {
if [[ -f /etc/os-release ]]; then
local os_id
os_id=$(grep -E "^ID=" /etc/os-release | tr -d '"' | cut -d= -f2)
local os_version
os_version=$(grep -E "^VERSION_ID=" /etc/os-release | tr -d '"' | cut -d= -f2 | cut -d. -f1)
if ([[ "$os_id" == "opensuse"* ]] || [[ "$os_id" == "sles" ]]) && [[ "$os_version" == "16" ]]; then
return 0
fi
fi
return 1
}
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
if command -v rpm && ! command -v dpkg; then
if [[ "$arch" == "x86_64" ]] && is_suse_like; then
PACKAGE="aliyun_assist_${VERSION}_x86_64.rpm"
else
PACKAGE="aliyun_assist_${VERSION}.rpm"
fi
else
if [[ "$arch" == "x86_64" ]] && is_suse_like; then
PACKAGE="aliyun_assist_${VERSION}_x86_64.deb"
else
PACKAGE="aliyun_assist_${VERSION}.deb"
fi
fi
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
if command -v rpm && ! command -v dpkg; then
PACKAGE="aliyun-assist-${VERSION}-1.aarch64.rpm"
else
PACKAGE="aliyun-assist_${VERSION}-1_arm64.deb"
fi
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
;;
esac
echo "[main] package = ${PACKAGE}"
echo "[main] pkg_uri = ${PKG_URI}"
if command -v wget; then
sudo wget -O "${PACKAGE}" "${PKG_URI}"
elif command -v curl; then
sudo curl -o "${PACKAGE}" "${PKG_URI}"
else
echo "[WARN] command wget/curl not found, exit"
exit 1
fi
if command -v rpm && ! command -v dpkg; then
sudo rpm -ivh --force "${PACKAGE}"
elif command -v dpkg; then
sudo dpkg -i "${PACKAGE}"
else
echo "[WARN] command rpm/dpkg not found, exit"
exit 2
fi
if [[ -e /etc/redhat-release ]]; then
if sudo systemctl status qemu-guest-agent; then
sudo systemctl stop qemu-guest-agent
sudo systemctl disable qemu-guest-agent
sudo systemctl restart aliyun.service
fi
fi
Windows
Método 1: Baixe pelo navegador
-
Abra a seguinte URL no navegador para baixe o agente do Cloud Assistant.
https://aliyun-client-assist.oss-accelerate.aliyuncs.com/windows/aliyun_agent_latest_setup.exe -
Instale o agente do Cloud Assistant.
Clique em duas vezes no arquivo do agente do Cloud Assistant e siga o assistente de instalação. O caminho de instalação padrão é
C:\ProgramData\aliyun\assist\.
Método 2: Usar PowerShell
curl -UseBasicParsing -Uri https://aliyun-client-assist.oss-accelerate.aliyuncs.com/windows/aliyun_agent_latest_setup.exe -OutFile 'C:\\aliyun_agent_latest_setup.exe' & "C:\\aliyun_agent_latest_setup.exe" /S
Instalar a partir de binário ou código-fonte
Binary package
-
Para instâncias ECS da Alibaba Cloud
Este script instala a versão mais recente do agente por padrão. Para instalar uma versão específica, modifique
VERSION=latest.#!/bin/bash VERSION=latest PACKAGE= PKG_URI= REGION=$(curl -s http://100.100.100.200/latest/meta-data/region-id) DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com arch=$(uname -m) echo "[main] arch = ${arch}" # Detect whether the system is openSUSE or SLES. is_suse_like() { if [[ -f /etc/os-release ]]; then local os_id os_id=$(grep -E "^ID=" /etc/os-release | tr -d '"' | cut -d= -f2) local os_version os_version=$(grep -E "^VERSION_ID=" /etc/os-release | tr -d '"' | cut -d= -f2 | cut -d. -f1) if ([[ "$os_id" == "opensuse"* ]] || [[ "$os_id" == "sles" ]]) && [[ "$os_version" == "16" ]]; then return 0 fi fi return 1 } case $arch in "i386"|"i686"|"x86_64"|"amd64") if [[ "$arch" == "x86_64" ]] && is_suse_like; then PACKAGE="aliyun_assist_${VERSION}_update_x86_64.zip" else PACKAGE="aliyun_assist_${VERSION}_update.zip" fi PKG_URI="https://$DOMAIN/linux/$PACKAGE" ;; *) PACKAGE="aliyun_assist_${VERSION}_update_arm.zip" PKG_URI="https://$DOMAIN/arm/$PACKAGE" ;; esac echo "[main] package = ${PACKAGE}" echo "[main] pkg_uri = ${PKG_URI}" if command -v wget; then sudo wget -O "${PACKAGE}" "${PKG_URI}" elif command -v curl; then sudo curl -o "${PACKAGE}" "${PKG_URI}" else echo "[WARN] command wget/curl not found, exit" exit 1 fi TARGET_DIR=/usr/local/share/aliyun-assist sudo unzip -o "${PACKAGE}" -d $TARGET_DIR/ TRUE_VERSION=$(cat $TARGET_DIR/version) sudo chmod a+x $TARGET_DIR/$TRUE_VERSION/update_install sudo bash $TARGET_DIR/$TRUE_VERSION/update_install -
Para instâncias gerenciadas (servidores fora da Alibaba Cloud)
#!/bin/bash VERSION=latest PACKAGE= PKG_URI= DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com arch=$(uname -m) echo "[main] arch = ${arch}" # Detect whether the system is openSUSE or SLES. is_suse_like() { if [[ -f /etc/os-release ]]; then local os_id os_id=$(grep -E "^ID=" /etc/os-release | tr -d '"' | cut -d= -f2) local os_version os_version=$(grep -E "^VERSION_ID=" /etc/os-release | tr -d '"' | cut -d= -f2 | cut -d. -f1) if ([[ "$os_id" == "opensuse"* ]] || [[ "$os_id" == "sles" ]]) && [[ "$os_version" == "16" ]]; then return 0 fi fi return 1 } case $arch in "i386"|"i686"|"x86_64"|"amd64") if [[ "$arch" == "x86_64" ]] && is_suse_like; then PACKAGE="aliyun_assist_${VERSION}_update_x86_64.zip" else PACKAGE="aliyun_assist_${VERSION}_update.zip" fi PKG_URI="https://$DOMAIN/linux/$PACKAGE" ;; *) PACKAGE="aliyun_assist_${VERSION}_update_arm.zip" PKG_URI="https://$DOMAIN/arm/$PACKAGE" ;; esac echo "[main] package = ${PACKAGE}" echo "[main] pkg_uri = ${PKG_URI}" if command -v wget; then sudo wget -O "${PACKAGE}" "${PKG_URI}" elif command -v curl; then sudo curl -o "${PACKAGE}" "${PKG_URI}" else echo "[WARN] command wget/curl not found, exit" exit 1 fi TARGET_DIR=/usr/local/share/aliyun-assist sudo unzip -o "${PACKAGE}" -d $TARGET_DIR/ TRUE_VERSION=$(cat $TARGET_DIR/version) sudo chmod a+x $TARGET_DIR/$TRUE_VERSION/update_install sudo bash $TARGET_DIR/$TRUE_VERSION/update_install
Source code
O exemplo a seguir utiliza yum. Para outras distribuições Linux, use o gerenciador de pacotes correspondente.
-
Instale os pré-requisitos, como Git e Go.
# Install Git sudo yum install git -y # Install Go sudo yum install go -y -
Baixe o código-fonte do agente do Cloud Assistant.
sudo git clone https://github.com/aliyun/aliyun_assist_client -
Acesse o diretório do código-fonte e compile o código.
# Go to the source code directory. cd ./aliyun_assist_client # Compile the source code. sudo go buildSe a resposta não contiver mensagens de erro, a instalação foi bem-sucedida.