指南配置
安装程序变量
控制 bootstrap.sh 以及 install-ubuntu.sh / install-almalinux.sh 安装程序的环境变量。
所有安装命令都接受放在命令之前的变量。在没有终端的情况下(cron、cloud-init、ssh server 'command'),安装程序不会提出任何询问,因此变量是修改默认值的唯一方式。
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo VARIABLE=value bash变量参考
| 变量 | 默认值 | 说明 |
|---|---|---|
MODE | all(有终端时会询问) | all:Web 服务器 + 数据库都在本服务器上。web:仅 Web 服务器 + PHP,数据库位于另一台服务器(需要 DB_HOST)。db:仅 MariaDB,对网络开放,不含 Web 服务器和代码。 |
DB_HOST | — | 配合 MODE=web:数据库服务器的 IP。 |
DB_ALLOW | 任意 IP(%) | 配合 MODE=db:允许连接 3306 端口的 Web 服务器 IP。 |
WEB_PORT | 80(有终端时会询问) | 网站端口。端口 22、3306 和 8108 会被拒绝。 |
DOMAIN | _ | Web 服务器的 server_name。示例:pos.mystore.com。 |
PHP_VER | 8.3 | PHP 版本。支持的值:8.2 和 8.3。 |
WITH_PRINTING | yes | no 表示跳过 CUPS、Chrome/Chromium 和打印功能。 |
ENV_ONLY | no | yes 或 1 表示只安装运行环境(依赖和服务),不安装 HWD POS 代码。 |
APP_DIR | /var/www/HWDPOS | 代码安装目录。安装程序会拒绝 /、/tmp 或 /var 等系统目录。 |
DB_NAME | hwd_pos | 数据库名称。 |
DB_USER | hwdpos_manager | 数据库用户。 |
DB_PASS | — | 数据库用户的密码。如果为空,安装程序会沿用正在使用的密码(storage/config.php 或凭据文件中的),只有在都不存在时才生成新密码。无论哪种情况,它都会将密码应用到数据库用户,因此文件与数据库始终一致。 |
SET_TIMEZONE | — | yes 将服务器时区设为 America/Panama;no 保持不变。为空时会询问(默认:是);没有终端时保持不变并显示警告。 |
HWPOS_ZIP | — | bootstrap.sh 使用的 HWD POS .zip 包的本地路径或 URL。该 .zip 的根目录必须是 HWDPOS/。 |
HWPOS_REPLACE | — | 1 表示允许 HWPOS_ZIP 替换已安装的系统。原目录会保留为 HWDPOS.anterior-DATE。 |
HWPOS_BASE_URL | https://3r.com.pa/hwdpos_inst | 下载 bootstrap.sh、各安装程序、install-workers.sh、hwdpanel.sh、check.sh 和 scripts.zip 的地址。 |
INSTALLER_URL | — | 发行版系列安装程序(install-ubuntu.sh 或 install-almalinux.sh)的直接 URL,用于 HWPOS_BASE_URL 中无法获取的情况。 |
check.sh 也接受 PHP_VER、APP_DIR、DB_NAME、DB_USER、DOMAIN、MODE 和 CHECK_ONLY。参见 check.sh 诊断。
示例
# Different port, without asking
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo WEB_PORT=8080 bash
# No printing (server that does not print)
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo WITH_PRINTING=no bash
# With your own domain name
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo DOMAIN=pos.mystore.com bash
# Environment only (dependencies and services), without the system code
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo ENV_ONLY=1 bash
# From a specific package already on the server
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo HWPOS_ZIP=/root/HWDPOS-v1.5.0.zip bash
# Unattended, also changing the time zone
curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo HWPOS_ZIP=/root/HWDPOS-v1.5.0.zip SET_TIMEZONE=yes bash当代码已在服务器上且 deploy/ 存在时(首次安装时创建),可以直接调用发行版系列安装程序:
sudo DOMAIN=pos.mystore.com PHP_VER=8.3 WITH_PRINTING=no bash /var/www/HWDPOS/deploy/install-ubuntu.sh首次安装之前,请改用 bootstrap.sh 配合 HWPOS_ZIP,因为官方 .zip 不包含 deploy/ 目录。