安装脚本
Linux 和 macOS
您可以使用位于https://get.gpustack.ai
的安装脚本,在基于systemd和launchd的系统上将GPUStack安装为服务。
在运行脚本时,您可以设置额外的环境变量和CLI标志。以下是使用不同配置运行安装脚本的示例:
# Run server with the built-in worker.
curl -sfL https://get.gpustack.ai | sh -s -
# Run server with non-default port.
curl -sfL https://get.gpustack.ai | sh -s - --port 8080
# Run server with a custom data path.
curl -sfL https://get.gpustack.ai | sh -s - --data-dir /data/gpustack-data
# Run server without the built-in worker.
curl -sfL https://get.gpustack.ai | sh -s - --disable-worker
# Run server with TLS.
curl -sfL https://get.gpustack.ai | sh -s - --ssl-keyfile /path/to/keyfile --ssl-certfile /path/to/certfile
# Run server with external postgresql database.
curl -sfL https://get.gpustack.ai | sh -s - --database-url "postgresql://username:password@host:port/database_name"
# Run worker with specified IP.
curl -sfL https://get.gpustack.ai | sh -s - --server-url http://myserver --token mytoken --worker-ip 192.168.1.100
# Install with a custom PyPI mirror.
curl -sfL https://get.gpustack.ai | INSTALL_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple sh -s -
# Install a custom wheel package other than releases form pypi.org.
curl -sfL https://get.gpustack.ai | INSTALL_PACKAGE_SPEC=https://repo.mycompany.com/my-gpustack.whl sh -s -
# Install a specific version with extra audio dependencies.
curl -sfL https://get.gpustack.ai | INSTALL_PACKAGE_SPEC=gpustack[audio]==0.6.0 sh -s -
Windows
您可以使用位于https://get.gpustack.ai
的安装脚本,将GPUStack作为服务安装到Windows服务管理器中。
在运行脚本时,您可以设置额外的环境变量和CLI标志。以下是使用不同配置运行安装脚本的示例:
# Run server with the built-in worker.
Invoke-Expression (Invoke-WebRequest -Uri "https://get.gpustack.ai" -UseBasicParsing).Content
# Run server with non-default port.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --port 8080"
# Run server with a custom data path.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --data-dir 'D:\gpustack-data'"
# Run server without the built-in worker.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --disable-worker"
# Run server with TLS.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --ssl-keyfile 'C:\path\to\keyfile' --ssl-certfile 'C:\path\to\certfile'"
# Run server with external postgresql database.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --database-url 'postgresql://username:password@host:port/database_name'"
# Run worker with specified IP.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --server-url 'http://myserver' --token 'mytoken' --worker-ip '192.168.1.100'"
# Run worker with customize reserved resource.
Invoke-Expression "& { $((Invoke-WebRequest -Uri 'https://get.gpustack.ai' -UseBasicParsing).Content) } -- --server-url 'http://myserver' --token 'mytoken' --system-reserved '{""ram"":5, ""vram"":5}'"
# Install with a custom PyPI mirror.
$env:INSTALL_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple"
Invoke-Expression (Invoke-WebRequest -Uri "https://get.gpustack.ai" -UseBasicParsing).Content
# Install a custom wheel package other than releases form pypi.org.
$env:INSTALL_PACKAGE_SPEC = "https://repo.mycompany.com/my-gpustack.whl"
Invoke-Expression (Invoke-WebRequest -Uri "https://get.gpustack.ai" -UseBasicParsing).Content
# Install a specific version with extra audio dependencies.
$env:INSTALL_PACKAGE_SPEC = "gpustack[audio]==0.6.0"
Invoke-Expression (Invoke-WebRequest -Uri "https://get.gpustack.ai" -UseBasicParsing).Content
警告
避免使用PowerShell ISE,因为它与安装脚本不兼容。
安装脚本可用的环境变量
名称 | 默认值 | 描述 |
---|---|---|
INSTALL_INDEX_URL |
(empty) | Base URL of the Python Package Index. |
INSTALL_PACKAGE_SPEC |
gpustack[all] or gpustack[audio] |
The package spec to install. The install script will automatically decide based on the platform. It supports PYPI package names, URLs, and local paths. See the pip install documentation for details.
|
INSTALL_SKIP_POST_CHECK |
(empty) | If set to 1, the installation script will skip the post-installation check. |
INSTALL_SKIP_BUILD_DEPENDENCIES |
1 |
If set to 1 will skip the build dependencies. |
INSTALL_SKIP_IOGPU_WIRED_LIMIT |
(empty) | If set to 1 will skip setting the GPU wired memory limit on macOS. |
INSTALL_IOGPU_WIRED_LIMIT_MB |
(empty) | This sets the maximum amount of wired memory that the GPU can allocate on macOS. |
为GPUStack服务设置环境变量
您可以在以下位置的环境文件中为GPUStack服务设置环境变量:
- Linux和macOS:
/etc/default/gpustack
- Windows:
$env:APPDATA\gpustack\gpustack.env
以下是该文件内容的示例:
HF_TOKEN="mytoken"
HF_ENDPOINT="https://my-hf-endpoint"
注意
与Systemd不同,Launchd和Windows服务本身不支持从文件读取环境变量。通过环境文件进行配置是由安装脚本实现的。它会读取该文件并将变量应用到服务配置中。在Windows和macOS上修改环境文件后,您需要重新运行安装脚本以使更改生效于GPUStack服务。
可用的命令行标志
安装脚本附加的CLI标志会直接作为gpustack start
命令的标志传递。详情请参阅CLI参考文档。