Ubuntu 22.04 安装 i-doit 38 指南

i-doit open 38 在 Ubuntu 22.04 裸机 LAMP(Apache 2.4 + MariaDB 10.6 + PHP 8.3)的端到端安装实录:PPA 装 PHP、console.php install 无人值守安装、tenant-create 建租户、Web 登录验证,含交互模式覆盖参数、.htaccess 生效对比等实测排障。

i-doit安装部署Ubuntu 22.04PHPMariaDBApache2026/11/03

Ubuntu 22.04 安装 i-doit 38 指南

i-doit 是德国 synetics 公司(i-doit GmbH)开发的 IT 资产管理与 CMDB(配置管理数据库)文档系统,遵循 ITIL 最佳实践,把"什么设备、什么软件、什么合同、谁在用、放在哪"全部记录在一个 Web 界面里。i-doit open 是其开源版本(AGPLv3),以 PHP 源码包(tarball/zip)形式经 SourceForge 发布,官方主推的安装形态就是经典的 LAMP 裸机部署:Apache + MariaDB/MySQL + PHP,解压即用,配合自带的 console.php 命令行安装器可全程无人值守完成。社区另有 Docker 镜像形态,但官方安装文档(kb.i-doit.com)以裸机 LAMP 为主线,本文也按此路径实测。

本文基于 i-doit open 38(2026-03-25 发布,SourceForge 当前 latest 的 open 版本)在 Ubuntu Server 22.04.5 LTS 上完成端到端安装:从 LAMP 环境准备、PHP 8.3 版本兼容处理、源码包校验、console.php install 无人值守安装、tenant-create 创建首个租户,到 Web 登录验证,全部命令均在真实服务器环境实测,输出逐行照抄。本次实验 Web 服务监听 8137 端口。

版本与兼容性依据

安装前先确认三件事,均来自官方文档与源码包实测:

  1. i-doit open 最新稳定版:SourceForge i-doit 项目 files 列表(查询日期 2026-11-03)中 open 发行包最新为 idoit-open-38.zip;latest/download 重定向实测同样落在 38。商业版 Pro 已发布 39(2026-10),但 open 尚未跟进,选型时以 38 为准。
  2. PHP 兼容矩阵:源码包 src/constants.inc.php 中定义 PHP_VERSION_MINIMUM = '8.2'、PHP_VERSION_MAXIMUM = '8.4.99'、PHP_VERSION_RECOMMENDED = '8.4'。也就是说 Ubuntu 22.04 自带的 PHP 8.1 不被 i-doit 38 支持,必须通过 PPA 安装 PHP 8.2/8.3/8.4。官方系统要求页(kb.i-doit.com/en/installation/system-requirements.html,查询日期 2026-11-03)与源码常量一致:PHP 8.2(已弃用)/8.3/8.4(推荐)。
  3. 数据库与 Web 服务器:官方支持 MariaDB 10.6/10.11(推荐)/11.4/11.8、MySQL 5.7(已弃用)/8.0/8.4(推荐),Apache 2.4。Ubuntu 22.04 默认源即 MariaDB 10.6 + Apache 2.4.52,无需额外仓库。

前置准备

  • 一台 Ubuntu Server 22.04 LTS 主机(内存建议 ≥ 4GB,磁盘 ≥ 20GB),root 或具备 sudo 权限的账号。
  • 可访问 sourceforge.net(下载发行包)与 ppa.launchpad.net(PHP 8.3)。
  • 规划一个空闲 Web 端口。本文实验环境占用情况如下(ss -ltn 节选):
root@idoit-server:~# ss -ltn | awk '{print $4}' | grep -oE '[0-9]+$' | sort -n | uniq | grep -E '^81(2[89]|3[0-9]|4[0-9]|5[0-2])$'
8129
8130
8131
8132
8133
8136
8141
8143
8146

8128-8152 区间内上述端口已被占用,本文选用空闲的 8137。

第一步:安装 Apache 与 MariaDB

root@idoit-server:~# export DEBIAN_FRONTEND=noninteractive
root@idoit-server:~# apt-get update
root@idoit-server:~# apt-get install -y apache2 mariadb-server unzip wget

开机自启并立即拉起两个服务:

root@idoit-server:~# systemctl enable mariadb apache2
Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2
root@idoit-server:~# systemctl start mariadb apache2
root@idoit-server:~# mysql -uroot -e "SELECT VERSION();"
+--------------------------+
| VERSION()                |
+--------------------------+
| 10.6.23-MariaDB-0ubuntu0.22.04.1 |
+--------------------------+

MariaDB 10.6.23 在官方支持列表内。给 root 设置密码(示例统一用 q1w2e3r4,生产环境务必替换):

root@idoit-server:~# mysql -uroot -e 'ALTER USER "root"@"localhost" IDENTIFIED BY "q1w2e3r4"; FLUSH PRIVILEGES;'
root@idoit-server:~# mysql -uroot -pq1w2e3r4 -e "SELECT 1;"
+---+
| 1 |
+---+
| 1 |
+---+

第二步:安装 PHP 8.3(跳过系统默认 8.1)

Ubuntu 22.04 默认 PHP 为 8.1,i-doit 38 要求 8.2 起,直接装默认包会在安装阶段被拒。加入 ppa:ondrej/php 后安装 PHP 8.3 及 i-doit 需要的全部扩展(官方清单:bcmath、ctype、curl、fileinfo、gd、imagick、json、ldap、mbstring、memcached、mysqli、mysqlnd、pgsql、session、soap、xml、xmlwriter、zip):

root@idoit-server:~# add-apt-repository -y ppa:ondrej/php
root@idoit-server:~# apt-get update
root@idoit-server:~# apt-get install -y php8.3 libapache2-mod-php8.3 \
    php8.3-bcmath php8.3-curl php8.3-gd php8.3-imagick php8.3-intl \
    php8.3-ldap php8.3-mbstring php8.3-mysql php8.3-pgsql php8.3-soap \
    php8.3-xml php8.3-zip php8.3-memcached

验证版本与扩展:

root@idoit-server:~# php -v
PHP 8.3.36 (cli) (built: Oct 10 2025 10:36:25) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.36, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.36, Copyright (c), by Zend Technologies
root@idoit-server:~# php8.3 -m | grep -E "bcmath|curl|gd|imagick|intl|ldap|mbstring|mysqli|pgsql|soap|xmlwriter|zip|memcached|fileinfo" | tr "\n" " "
bcmath ctype curl dom fileinfo ftp gd intl ldap libxml mbstring memcached mysqli pdo_mysql pdo_pgsql pgsql SimpleXML soap xml xmlwriter zip

ctype、fileinfo、session、json 已编译进 PHP 核心,php -m 中同样可见。

第三步:调优 PHP 运行参数

i-doit 安装器会检查 max_input_vars ≥ 10000 与 post_max_size ≥ 128M,Ubuntu 默认值(1000 / 2M)不达标。不达标不会阻断安装(仅提示 failed OK),但表单提交多字段的 CMDB 对象时会出问题,建议安装前就改好。对 apache2 与 cli 两个 SAPI 同步修改:

root@idoit-server:~# for s in apache2 cli; do f=/etc/php/8.3/$s/php.ini
  sed -i "s/^;\?max_input_vars.*/max_input_vars = 10000/;s/^post_max_size.*/post_max_size = 128M/;s/^upload_max_filesize.*/upload_max_filesize = 100M/;s/^memory_limit.*/memory_limit = 512M/;s|^;\?date.timezone.*|date.timezone = Asia/Shanghai|" $f
done
root@idoit-server:~# grep -hE "^(max_input_vars|post_max_size|upload_max_filesize|memory_limit|date.timezone)" /etc/php/8.3/apache2/php.ini
date.timezone = Asia/Shanghai
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 100M
max_input_vars = 10000
root@idoit-server:~# systemctl restart apache2

第四步:Apache 监听端口与站点配置

修改监听端口(按上文规划改为 8137):

root@idoit-server:~# sed -i "s/^Listen 80$/Listen 8137/" /etc/apache2/ports.conf
root@idoit-server:~# grep -h Listen /etc/apache2/ports.conf
Listen 8137
Listen 443
root@idoit-server:~# systemctl restart apache2
root@idoit-server:~# ss -ltn | grep 8137
LISTEN 0      512                *:8137            *:*

启用 .htaccess 依赖的模块(i-doit 根目录 .htaccess 使用 php_value、ExpiresByType、Header 指令):

root@idoit-server:~# a2enmod rewrite expires headers
Considering dependency mime for rewrite:
Module mime already enabled
Enabling module rewrite.
Module expires already enabled
Module headers already enabled
Run 'systemctl restart apache2' to activate the new configuration.
root@idoit-server:~# systemctl restart apache2

创建站点配置,关键是 AllowOverride All——Ubuntu 默认对 /var/www 是 AllowOverride None,不改这一条,i-doit 自带的 .htaccess 安全规则(禁止直接访问 src/config.inc.php 等敏感文件)完全不生效。实测对比:

root@idoit-server:~# cat > /etc/apache2/sites-available/i-doit.conf <<'EOF'
<VirtualHost *:8137>
    DocumentRoot /var/www/html
    <Directory /var/www/html/i-doit>
        Options -Indexes +SymLinksIfOwnerMatch
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/idoit-error.log
    CustomLog ${APACHE_LOG_DIR}/idoit-access.log combined
</VirtualHost>
EOF
root@idoit-server:~# a2ensite i-doit.conf
Enabling site i-doit.
To activate the new configuration, you need to run:
  systemctl reload apache2
root@idoit-server:~# systemctl reload apache2

配置生效前后各请求一次配置文件 URL,效果立竿见影:

root@idoit-server:~# curl -s -o /dev/null -w "config.inc.php: %{http_code}\n" http://localhost:8137/i-doit/src/config.inc.php
config.inc.php: 200        # AllowOverride None 时:配置可被明文下载(危险)
root@idoit-server:~# curl -s -o /dev/null -w "config.inc.php: %{http_code}\n" http://localhost:8137/i-doit/src/config.inc.php
config.inc.php: 403        # AllowOverride All 生效后:.htaccess 拦截
root@idoit-server:~# curl -s -o /dev/null -w "index.php: %{http_code}\n" http://localhost:8137/i-doit/index.php
index.php: 200

第五步:下载并解压 i-doit open 38

官方 open 发行包走 SourceForge(i-doit 项目 files 列表中的 idoit-open-38.zip):

root@idoit-server:~# cd /usr/local/src
root@idoit-server:/usr/local/src# wget "https://sourceforge.net/projects/i-doit/files/latest/download" -O idoit-open-38.zip
--2026-11-03 03:15:44--  (try: 2)  https://sourceforge.net/projects/i-doit/files/latest/download
Resolving sourceforge.net (sourceforge.net)... 104.18.143.20
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://downloads.sourceforge.net/project/i-doit/i-doit/38/idoit-open-38.zip [following]
Length: 16947460 (16M) [application/zip]
Saving to: 'idoit-open-38.zip'

idoit-open-38.zip   100%[================>]  16.16M  4.98MB/s    in 3.3s

2026-11-03 03:15:48 (4.98 MB/s) - 'idoit-open-38.zip' saved [16947460/16947460]
root@idoit-server:/usr/local/src# md5sum idoit-open-38.zip
d053a5a72d7107a7df65ce96db580418  idoit-open-38.zip

zip 包解压即应用根目录(无顶层目录),直接铺到 /var/www/html/i-doit:

root@idoit-server:~# mkdir -p /var/www/html/i-doit && cd /var/www/html/i-doit
root@idoit-server:/var/www/html/i-doit# unzip -q /usr/local/src/idoit-open-38.zip
root@idoit-server:/var/www/html/i-doit# ls
CHANGELOG  REVISION  admin  checkmk_transfer.sh  console.php  idoit-rights.sh  images  imports  index.php  proxy.php  setup  src  temp  updates  upload  vendor  xsl
root@idoit-server:/var/www/html/i-doit# cat REVISION
38
root@idoit-server:/var/www/html/i-doit# head -3 CHANGELOG
Version 38 (2026-03-25)

- New: Improved performance of category deletion

REVISION 文件内容 38 与 CHANGELOG 首行 Version 38 (2026-03-25) 互相印证版本。把属主交给 Apache 运行账号:

root@idoit-server:~# chown -R www-data:www-data /var/www/html/i-doit

第六步:console.php install 无人值守安装

i-doit 3.x 起 setup/install.sh 已废弃(脚本首行即打印 "This script is deprecated. Please use the 'install' command of the i-doit console."),官方 CLI 安装路径是应用根目录的 console.php。

关键坑(实测踩过):console.php 基于 Symfony Console,交互模式下安装器会把命令行传入的选项逐项重新提问,非终端环境(管道/cron)里提示读取为空,导致 Access denied for user ''@'localhost' using password: NO。因此无人值守必须加 -n(--no-interaction)。

先演示错误姿势(省略 -n,stdin 无终端输入):

root@idoit-server:/var/www/html/i-doit# php console.php install --root-user=root --root-password=q1w2e3r4 --host=localhost --database=idoit_system --user=idoit --password=q1w2e3r4 --admin-password=q1w2e3r4
Please, enter Username of privileged DB User [root]:
Please, enter Password of privileged DB User [ ]:
Access denied for user ''@'localhost' (using password: NO)

正确姿势——加 -n 后命令行参数才真正生效:

root@idoit-server:/var/www/html/i-doit# php console.php install -n \
  --root-user=root --root-password=q1w2e3r4 --host=localhost \
  --database=idoit_system --user=idoit --password=q1w2e3r4 \
  --admin-password=q1w2e3r4
PHP Version check: OK
Ini Setting: max_input_vars: failed OK
Ini Setting: post_max_size: failed OK
PHP Extensions: OK
OK
 ------------------------------- --------
  Message                         Result
 ------------------------------- --------
  i-doit installation             OK
  Environment Check               OK
  Check directories               OK
  PHP Extensions                  OK
  MySql                           OK
  Configuration                   OK
  System DB                       OK
  Import DB: idoit_system_temp    OK
  Save Config                     OK
 ------------------------------- --------

System database successfully created.
System database successfully imported.
 -------------------------- --------
  Message                    Result
 -------------------------- --------
  i-doit installation        OK
  Environment Check          OK
  Check directories          OK
  PHP Extensions             OK
  MySql                      OK
  Configuration              OK
  System DB                  OK
  Import DB: idoit_system    OK
  Save Config                OK
 -------------------------- --------

Installation successful.

说明两点:

  • Ini Setting: max_input_vars: failed OK 是安装器在调优前的那次运行里给出的告警(默认 1000 < 10000、post_max_size 2M < 128M),failed 后紧跟 OK 表示"未达建议值但不阻断"。按第三步调优后重跑,安装日志只剩九步 OK 汇总表,不再出现这两行。
  • 安装器会创建系统库 idoit_system(9 张表,存租户注册表 isys_mandator 等)与数据库账号 idoit,并把连接信息写入 src/config.inc.php。

重复安装保护:src/config.inc.php 已存在时再次执行 install 会中止并自动回滚(Undo),不会破坏现有环境:

root@idoit-server:/var/www/html/i-doit# php console.php install -n --root-user=root --root-password=q1w2e3r4 --host=localhost --database=idoit_system2 --user=idoit --password=q1w2e3r4 --admin-password=q1w2e3r4
 -------------------------- --------
  Message                    Result
 -------------------------- --------
  i-doit installation        OK
  Environment Check          OK
  Check directories          OK
  PHP Extensions             OK
  MySql                      OK
  Configuration              OK
  System DB                  OK
  Import DB: idoit_system2   OK
  Save Config                OK
  File: /var/www/html/i-doit//src/config.inc.php should not exist:  failed   FAIL
  i-doit installation: Undo  OK
  Save Config: Undo          OK
  System DB: Undo            OK
  Environment Check: Undo    OK
  Configuration: Undo        OK
  PHP Extensions: Undo       OK
  MySql: Undo                OK
  Check directories: Undo    OK
 -------------------------- --------

要重装就先把 src/config.inc.php 移走(或走 uninstall 命令,见运维篇)。

第七步:创建首个租户(tenant)

i-doit 的数据按租户(tenant)分库:系统库存连接与账号,业务 CMDB 数据全部在租户库。open 版只支持单租户(实测第二条租户创建会报 i-doit open does not include multi tenancy feature and supports only a single tenant.),但流程与 Pro 多租户一致。同样必须 -n:

root@idoit-server:/var/www/html/i-doit# php console.php tenant-create -n \
  -u root -p q1w2e3r4 -U idoit -P q1w2e3r4 \
  -d idoit_data -t "quzuo-lab" \
  --login-user=admin --login-password=q1w2e3r4 \
  --login-recovery-email=admin@quzuo.local
 ---------------------------- --------
  Message                      Result
 ---------------------------- --------
  i-doit tenant-create         OK
  Check directories            OK
  MySql                        OK
  Create Tenant                OK
  Tenant DB                    OK
  Import DB: idoit_data        OK
  Save Config                  OK
 ---------------------------- --------

Database idoit_data successfully created.
Database idoit_data successfully imported.

Tenant successfully created.
 ---------------------------- --------
  Message                      Result
 ---------------------------- --------
  i-doit tenant-create         OK
  Check directories            OK
  MySql                        OK
  Create Tenant                OK
  Tenant DB                    OK
  Import DB: idoit_data        OK
  Save Config                  OK
 ---------------------------- --------

Tenant created with id 1

核对租户注册表:

root@idoit-server:/var/www/html/i-doit# php console.php tenant-list
 ---- --------------------- --------------- ----------------------
  id   Title                 Database        Hostname
 ---- --------------------- --------------- ----------------------
  1    quzuo-lab             idoit_data      localhost
 ---- --------------------- --------------- ----------------------

第八步:Web 访问与登录验证

root@idoit-server:~# curl -sI http://localhost:8137/i-doit/ | head -5
HTTP/1.1 200 OK
Date: Tue, 03 Nov 2026 03:20:14 GMT
Server: Apache/2.4.52 (Ubuntu)
Set-Cookie: i-doit=smk2401k45241l18k639882702; path=/; HttpOnly; SameSite=Lax
Expires: Thu, 19 Nov 1995 08:12:00 GMT

登录页标题为 Login - i-doit,表单字段是 login_username / login_password,并携带 _csrf_token。实测用安装时写入的账号(admin / q1w2e3r4)POST 登录:

root@idoit-server:~# TOKEN=$(curl -s -c /tmp/cj.txt http://localhost:8137/i-doit/ | grep -oE "_csrf_token\" value=\"[^\"]+" | cut -d\" -f3)
root@idoit-server:~# curl -s -L -b /tmp/cj.txt -c /tmp/cj.txt \
  -d "_csrf_token=$TOKEN&login_username=admin&login_password=q1w2e3r4" \
  http://localhost:8137/i-doit/ | head -c 60
<script>window.location.reload();</script>
root@idoit-server:~# curl -s -b /tmp/cj.txt http://localhost:8137/i-doit/ | grep -oE "<title>[^<]*</title>"
<title>i-doit - CMDB > i-doit 38</title>

登录后页面标题从 Login - i-doit 变为 i-doit - CMDB > i-doit 38,页面出现 Logout 入口,安装完成。浏览器访问 http://<服务器IP>:8137/i-doit/ 同样进入登录页,Admin Center(管理后台)位于 /i-doit/admin/。

常见问题与排障实录

Q1:install 传了 --root-password 仍报 Access denied ... using password: NO? 交互模式覆盖了 CLI 参数(见第六步实录)。无人值守一律加 -n;tenant-create 同理。

Q2:Ubuntu 22.04 直接 apt install php 后安装报 PHP 版本不符? i-doit 38 要求 PHP ≥ 8.2(src/constants.inc.php 实测),22.04 默认 8.1 不可用,需 ppa:ondrej/php 装 8.3/8.4。

Q3:/i-doit/src/config.inc.php 能被直接下载? AllowOverride None 导致 .htaccess 未生效。按第四步建 vhost 并 a2enmod rewrite,生效后返回 403(实测 200→403)。

Q4:安装汇总出现 Ini Setting: max_input_vars: failed OK? 默认值低于建议值(10000 / 128M),按第三步调优 php.ini 并重启 Apache,告警消失。

Q5:想换库重装,install 一直 FAIL? 先删除或移走 src/config.inc.php(安装器检测到该文件即拒绝并回滚,不会留下半成品);正式卸载用 php console.php uninstall,详见运维篇。

Q6:用 root 跑 console.php 之后 Web 端报权限错误? root 运行 CLI 会在 temp/、log/ 下生成 root 属主的缓存文件(实测 temp/constants.php 即为 root:root),www-data 无法覆盖。跑完 CLI 记得 chown -R www-data:www-data /var/www/html/i-doit,或统一用 sudo -u www-data php console.php ... 执行。

小结

至此,i-doit open 38 已在 Ubuntu 22.04 的 Apache 2.4.52 + MariaDB 10.6.23 + PHP 8.3.36 环境完成裸机部署:系统库 idoit_system 与租户库 idoit_data 就绪,admin 账号可登录 Web 端。i-doit 的形态选择上,官方主线就是这种 tarball/LAMP 部署(社区 Docker 镜像非官方主推,本文不采用);后续阅读:

Ubuntu 22.04 安装 i-doit 38 指南 - Quzuo