Skip to main content

Installing GitHub Enterprise Server on AWS

To install GitHub Enterprise Server on Amazon Web Services (AWS), you must launch an Amazon Elastic Compute Cloud (EC2) instance and create and attach a separate Amazon Elastic Block Store (EBS) data volume.

Prerequisites

This guide assumes you are familiar with the following AWS concepts:

For a diagram that provides an architectural overview, see the "AWS Architecture Diagram for Deploying GitHub Enterprise Server."

This guide recommends the principle of least privilege when setting up 你的 GitHub Enterprise Server 实例 on AWS. For more information, refer to the AWS Identity and Access Management (IAM) documentation.

Hardware considerations

最低要求

建议根据 你的 GitHub Enterprise Server 实例 的用户许可数选择不同的硬件配置。 如果预配的资源超过最低要求,您的实例将表现出更好的性能和扩展。

用户许可证x86-64 vCPU内存根存储附加(数据)存储
试用版、演示版或 10 个轻度用户432 GB200 GB150 GB
10-3000848 GB200 GB300 GB
3000-50001264 GB200 GB500 GB
5000-80001696 GB200 GB750 GB
8000-10000+20160 GB200 GB1000 GB

如果计划为实例的用户启用 GitHub Actions,则需要更多资源。

有关这些要求的详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

如果计划为实例的用户启用 Container registry,则需要更多资源。 有关这些要求的详细信息,请参阅“Getting started with GitHub Packages for your enterprise”。

有关为现有实例调整资源的详细信息,请参阅“增加存储容量”和“增加 CPU 或内存资源”。

存储

我们建议为 GitHub Enterprise Server 配置具有高每秒输入/输出操作数 (IOPS) 和低延迟的高性能 SSD。 工作负载是 I/O 密集型的。 如果使用裸机管理程序,建议直接连接磁盘或使用存储区域网络 (SAN) 中的磁盘。

您的实例需要一个独立于根磁盘的持久数据磁盘。 有关详细信息,请参阅“系统概览”。

若要配置 GitHub Actions,必须提供外部 Blob 存储。 有关详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

根文件系统上的可用空间将占磁盘总大小的 50%。 您可以通过构建一个新实例或使用现有实例来调整实例的根磁盘大小。 有关详细信息,请参阅“系统概览”和“增加存储容量”。

CPU 和内存

GitHub Enterprise Server 需要的 CPU 和内存资源取决于用户的活动水平、自动化和集成。

为 你的 GitHub Enterprise Server 实例 预配的任何 VM 都必须使用 x86-64 CPU 体系结构。 其他体系结构(例如 Aarch64 或 arm64)均不受支持。

如果计划为 GitHub Enterprise Server 实例的用户启用 GitHub Actions,则可能需要为实例预配额外的 CPU 和内存资源。 有关详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

增加 CPU 资源时,GitHub建议为实例预配的每个 vCPU(最多 16 个 vCPU)增加至少 6.5 GB 的内存。 如果您使用的 vCPU 超过 16 个,则无需为每个 vCPU 添加 6.5 GB 内存,但应监控您的实例以确保其有足够的内存。

警告:建议用户配置 Web 挂钩事件来通知外部系统有关 GitHub Enterprise Server 上的活动。 自动检查更改或轮询将对实例的性能和可扩展性产生不利影响。 有关详细信息,请参阅“关于 web 挂钩”。

有关监视 GitHub Enterprise Server 的容量和性能的详细信息,请参阅“监视实例”。

您可以增加实例的 CPU 或内存资源。 有关详细信息,请参阅“增加 CPU 或内存资源”。

Determining the instance type

Before launching 你的 GitHub Enterprise Server 实例 on AWS, you'll need to determine the machine type that best fits the needs of your organization. To review the minimum requirements for GitHub Enterprise Server, see "Minimum requirements."

可以随时通过调整实例大小来扩展 CPU 或内存。 更改实例的可用资源需要用户安排出故障时间,因此GitHub建议预配帐户资源以进行缩放。

GitHub 建议对 GitHub Enterprise Server 使用内存优化的实例。 有关详细信息,请参阅 Amazon EC2 网站上的 Amazon EC2 实例类型

Selecting the GitHub Enterprise Server AMI

You can select an Amazon Machine Image (AMI) for GitHub Enterprise Server using the GitHub Enterprise Server portal or the AWS CLI.

AMIs for GitHub Enterprise Server are available in the AWS GovCloud (US-East and US-West) region. This allows US customers with specific regulatory requirements to run GitHub Enterprise Server in a federally compliant cloud environment. For more information on AWS's compliance with federal and other standards, see AWS's GovCloud (US) page and AWS's compliance page.

Using the GitHub Enterprise Server portal to select an AMI

  1. 导航到要用于新实例的映像。

    • 导航到发行说明
    • 在右侧边栏中,单击要下载的版本。
    • 单击“下载 GitHub Enterprise Server X.X.X”。
  2. Under "GitHub in the Cloud", select the "Select your platform" dropdown menu, and click Amazon Web Services.

  3. Select the "Select your AWS region" drop-down menu, and click your desired region.

  4. Take note of the AMI ID that is displayed.

Using the AWS CLI to select an AMI

  1. Using the AWS CLI, get a list of GitHub Enterprise Server images published by GitHub's AWS owner IDs (025577942450 for GovCloud, and 895557238572 for other regions). For more information, see describe-images in the AWS documentation.

    aws ec2 describe-images \
    --owners OWNER_ID \
    --query 'sort_by(Images,&Name)[*].{Name:Name,ImageID:ImageId}' \
    --output=text
    
  2. Take note of the AMI ID for the latest GitHub Enterprise Server image.

Creating a security group

If you're setting up your AMI for the first time, you will need to create a security group and add a new security group rule for each port in the table below. For more information, see the AWS guide Using Security Groups.

  1. Using the AWS CLI, create a new security group. For more information, see create-security-group in the AWS documentation.

    aws ec2 create-security-group --group-name SECURITY_GROUP_NAME --description "SECURITY GROUP DESCRIPTION"
    
  2. Take note of the security group ID (sg-xxxxxxxx) of your newly created security group.

  3. Create a security group rule for each of the ports in the table below. We recommend opening network ports selectively based on the network services you need to expose for administrative and user purposes. For more information, see "Network ports," and authorize-security-group-ingress in the AWS documentation.

    aws ec2 authorize-security-group-ingress --group-id SECURITY_GROUP_ID --protocol PROTOCOL --port PORT_NUMBER --cidr SOURCE IP RANGE
    

    This table identifies what each port is used for.

    端口服务说明
    22SSHGit over SSH 访问。 支持克隆、获取和推送操作到公共/私有仓库。
    25SMTP支持加密 (STARTTLS) 的 SMTP。
    80HTTPWeb 应用程序访问。 当 SSL 启用时,所有请求都会重定向到 HTTPS 端口。
    122SSH实例 shell 访问。 默认 SSH 端口 (22) 专用于应用程序 git+ssh 网络流量。
    161/UDPSNMP为网络监视协议操作所需。
    443HTTPSWeb 应用程序和 Git over HTTPS 访问。
    1194/UDPVPN采用高可用性配置的安全复制网络隧道。 使用 WireGuard 进行加密。
    8080HTTP基于纯文本 Web 的 管理控制台。 除非手动禁用 SSL,否则不需要。
    8443HTTPS基于安全 Web 的 管理控制台。 进行基本安装和配置时需要。
    9418Git简单的 Git 协议端口。 仅克隆和获取操作到公共仓库。 未加密的网络通信。 如果在实例上启用了私有模式,则仅当您也启用了匿名 Git 读取访问时才需要打开此端口。 有关详细信息,请参阅“Enforcing repository management policies in your enterprise”。

Creating the GitHub Enterprise Server instance

To create the instance, you'll need to launch an EC2 instance with your GitHub Enterprise Server AMI and attach an additional storage volume for your instance data. For more information, see "Hardware considerations."

Note: You can encrypt the data disk to gain an extra level of security and ensure that any data you write to your instance is protected. There is a slight performance impact when using encrypted disks. If you decide to encrypt your volume, we strongly recommend doing so before starting your instance for the first time. For more information, see the Amazon guide on EBS encryption.

Warning: If you decide to enable encryption after you've configured your instance, you will need to migrate your data to the encrypted volume, which will incur some downtime for your users.

Launching an EC2 instance

In the AWS CLI, launch an EC2 instance using your AMI and the security group you created. Attach a new block device to use as a storage volume for your instance data, and configure the size based on your user license count. For more information, see run-instances in the AWS documentation.

aws ec2 run-instances \
  --security-group-ids SECURITY_GROUP_ID \
  --instance-type INSTANCE_TYPE \
  --image-id AMI_ID \
  --block-device-mappings '[{"DeviceName":"/dev/xvdf","Ebs":{"VolumeSize":SIZE,"VolumeType":"TYPE"}}]' \
  --region REGION \
  --ebs-optimized

Allocating an Elastic IP and associating it with the instance

If this is a production instance, we strongly recommend allocating an Elastic IP (EIP) and associating it with the instance before proceeding to GitHub Enterprise Server configuration. Otherwise, the public IP address of the instance will not be retained after instance restarts. For more information, see Allocating an Elastic IP Address and Associating an Elastic IP Address with a Running Instance in the Amazon documentation.

Both primary and replica instances should be assigned separate EIPs in production High Availability configurations. For more information, see "配置高可用性."

Configuring the GitHub Enterprise Server instance

若要配置实例,必须上传许可证文件,设置 根管理控制台 密码,配置实例的设置,然后重启实例。

警告****:若要防止攻击者破坏新实例,请确保亲自设置 root 管理控制台 密码并尽快创建首个用户。

  1. 复制虚拟机的公共 DNS 名称,然后将其粘贴到 web 浏览器中。
  2. 在提示时上传许可文件并设置管理控制台密码。 有关详细信息,请参阅“管理 GitHub Enterprise 的许可证”。
  3. 管理控制台 中,配置并保存所需的设置。 For more information, see "Configuring GitHub Enterprise."
  4. 实例将自动重启。
  5. 单击“访问实例”。

Further reading