切换主题
📦 软件安装指南
📥 下载安装包
shell
# Windows 64位下载地址
https://software.wueasy.com/operation-log/latest/operation_log_win_64.zipshell
# Linux系统(Intel/AMD处理器)
https://software.wueasy.com/operation-log/latest/operation_log_linux_amd64.tar.gz
# Linux系统(飞腾/鲲鹏等ARM处理器)
https://software.wueasy.com/operation-log/latest/operation_log_linux_arm64.tar.gzshell
# Mac系统(M1/M2/M3芯片)
https://software.wueasy.com/operation-log/latest/operation_log_mac_arm64.tar.gz
# Mac系统(Intel处理器)
https://software.wueasy.com/operation-log/latest/operation_log_mac_amd64.tar.gz如何选择正确的版本?
Windows系统:直接使用Windows 64位版本
AMD64架构(x86_64):
- Linux系统:使用 Linux AMD64版本
- Mac系统:使用 Mac AMD64版本
- 适用于:Intel或AMD处理器
ARM64架构(aarch64):
- Linux系统:使用 Linux ARM64版本(飞腾/鲲鹏等)
- Mac系统:使用 Mac ARM64版本(M1/M2/M3芯片)
可以通过以下命令查看系统架构:
bash
# Linux/Mac系统
uname -m
# 输出说明:
# x86_64: 选择AMD64版本
# aarch64/arm64: 选择ARM64版本🛠️ 命令使用指南
软件管理命令
| 命令 | 说明 | 示例 |
|---|---|---|
install | 安装服务 | ./operation_log_linux_amd64 install |
uninstall | 卸载服务 | ./operation_log_linux_amd64 uninstall |
start | 启动服务 | ./operation_log_linux_amd64 start |
restart | 重启服务 | ./operation_log_linux_amd64 restart |
stop | 停止服务 | ./operation_log_linux_amd64 stop |
系统服务管理
提示
以下命令使用systemd管理服务,更加规范和可靠
| 命令 | 说明 |
|---|---|
systemctl enable operation-log.service | 设置开机自启动 |
systemctl disable operation-log.service | 取消开机自启动 |
systemctl start operation-log.service | 启动服务 |
systemctl stop operation-log.service | 停止服务 |
systemctl restart operation-log.service | 重启服务 |
systemctl status operation-log.service | 查看服务状态 |
📂 目录结构说明
安装完成后的建议目录结构如下:
plaintext
/srv/operation-log/
├── operation_log_linux_amd64 # 主程序文件
├── config.yaml # 配置文件(根目录,可选)
├── config/ # 配置目录(推荐)
│ └── config.yaml # 主配置文件
├── logs/ # 日志目录
│ └── app.log # 应用日志
├── sql/ # SQL脚本目录
│ ├── mysql.sql # MySQL建表脚本
│ └── pgsql.sql # PostgreSQL建表脚本
└── license.dat # 授权文件配置文件优先级
程序会按以下优先级查找配置文件:
- config 子目录:优先从
config/config.yaml读取(推荐) - 根目录:如果
config/目录不存在,则从根目录的config.yaml读取
建议使用 config/ 子目录,这样可以更好地组织配置文件,保持根目录整洁。
🔧 常见问题 (FAQ)
Q1: 如何修改配置?
A: 修改配置文件(推荐在 config/config.yaml,如果没有请新建),修改后需重启服务:
bash
# Linux
./operation_log_linux_amd64 restart
# 或使用 systemctl
systemctl restart operation-log.service
# Windows
operation_log_win_64.exe restart配置文件位置
- 推荐:创建
config/config.yaml(程序会优先读取此位置) - 备选:在根目录创建
config.yaml(当config/目录不存在时使用)
Q2: 如何组织配置文件?
A: 推荐使用 config/ 子目录来管理配置文件:
bash
# 创建配置目录
mkdir -p config
# 将配置文件放入 config 目录
mv config.yaml config/优势:
- ✅ 根目录更整洁,只保留可执行文件和授权文件
- ✅ 配置文件集中管理,便于备份和迁移
- ✅ 程序会自动优先读取
config/目录下的配置 - ✅ 如果
config/目录不存在,会自动降级到根目录读取(向后兼容)
Q3: 配置文件在哪里?
A: 程序启动时会在日志中输出配置文件的实际读取位置:
配置根目录: /srv/operation-log/config查看日志即可确认程序使用的配置路径。
Q4: 启动时提示 "Permission denied"?
A: 权限不足。请确保:
- 程序文件有执行权限:
chmod +x operation_log_linux_amd64 - 使用
sudo或 root 用户执行命令。
Q5: 执行 start 命令无反应或失败?
A:
- 确保已经先执行了
install命令。 - 检查日志文件(通常在
logs/目录下)查看错误信息。 - 确认数据库连接配置正确。
- Linux 下检查 SELinux 设置:bash
# 临时测试是否为 SELinux 问题 sudo setenforce 0 # 永久修复文件上下文 sudo chcon -R -t bin_t /srv/operation-log/operation_log_linux_amd64
Q6: 数据库连接失败?
A: 请检查以下配置:
- 数据库服务是否正常运行
- 配置文件中的数据库连接信息是否正确(地址、端口、用户名、密码)
- 数据库是否已创建(需要先创建数据库)
- 是否已执行建表SQL脚本(参考
sql/目录下的脚本) - 数据库用户是否有足够的权限
Q7: 如何修改默认端口?
A: 修改配置文件(推荐在 config/config.yaml),添加或修改如下配置:
yaml
server:
port: 8080 # 修改为你需要的端口修改后需重启服务。