Install Node.js with an extension

更新时间:
复制 MD 格式

Learn how to quickly deploy a Node.js environment on an Elastic Compute Service (ECS) instance.

Deploy with Terraform

Click one-click run to use Terraform to automatically deploy a Node.js environment on a new or existing instance.

  • To create a new instance: Set the create = true parameter, and then click Start Debugging > Preview and Execute.

  • To use an existing instance: Set the create = false parameter, specify the instance_id, and then click Start Debugging > Preview and Execute.

Deploy with an extension

Prerequisites

  • The instance has a static public IP address or an Elastic IP Address. For more information, see Enable public network access.

  • The ECS instance must be in the Running state.

  • Cloud Assistant is installed on the ECS instance and is Normal.

  • The operating system must be one of the following versions:

    • Alibaba Cloud Linux 3

    • Ubuntu 20.04 or later

    • CentOS 7.5, 7.7, 7.8, or 7.9

  • If you are a RAM user, follow the principle of least privilege and use the following custom policy to grant the necessary permissions.

    Custom JSON Policy

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": "bssopenapi:GetOrderDetail",
          "Resource": "*"
        },
        {
          "Effect": "Allow",
          "Action": [
            "ecs:DescribeCloudAssistantStatus",
            "ecs:DescribeInstances",
            "ecs:DescribeInvocationResults",
            "ecs:DescribeInvocations",
            "ecs:RunCommand"
          ],
          "Resource": "*"
        },
        {
          "Effect": "Allow",
          "Action": [
            "oos:GetTemplate",
            "oos:ListInstancePackageStates",
            "oos:StartExecution",
            "oos:UpdateInstancePackageState"
          ],
          "Resource": "*"
        },
        {
          "Effect": "Allow",
          "Action": "oss:GetObject",
          "Resource": "*"
        }
      ]
    }

Procedure

Note

To install the extension on multiple instances, log on to the CloudOps Orchestration Service console. In the left-side navigation pane, choose Server Management > Extensions, and then select Node.js.

  1. Log on to the ECS Management Console, find the target ECS instance, and click the instance ID to open the instance details page.

  2. Choose Scheduled and Automated Tasks > Extension Installation/Uninstallation > Install Extension.

  3. In the Install Extension dialog box, select Node.js from the Extension to Install list and click Next.

    On the Public Extensions tab, select v8 for the Extension Version.

    When the task status is Completed, Node.js is installed. After the installation is complete, on the Installation/Uninstallation History tab, you can see that the installation task status for Node.js is displayed as Completed.

Verification

Connect to the ECS instance and run the following command to verify the Node.js installation and version:

node -v
[root@xxx ~]# node -v
v20.16.0
[root@xxx ~]#