# Vagrant **Repository Path**: linux_20/vagrant ## Basic Information - **Project Name**: Vagrant - **Description**: Vagrant - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-03 - **Last Updated**: 2026-06-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Vagrant Alpine Linux 开发环境 基于 Alpine Linux 3.19 + Podman 的轻量级开发虚拟机。 ## 环境信息 | 项目 | 配置 | |------|------| | 系统 | Alpine Linux 3.19 | | 容器运行时 | Podman (兼容 Docker) | | CPU | 2 核 | | 内存 | 2 GB | | 镜像源 | 阿里云 | ## 端口转发 | 主机端口 | 虚拟机端口 | 用途 | |----------|------------|------| | 3000 | 3000 | Web 应用 | | 9306 | 9306 | Manticore SQL | | 9308 | 9308 | Manticore HTTP | | 2222 | 22 | SSH | ## 共享目录 | 主机目录 | 虚拟机目录 | |----------|------------| | F:\Vagrant | /work | ## 快速开始 ```bash # 安装 Vagrant 和 VirtualBox # https://developer.hashicorp.com/vagrant/install # https://www.virtualbox.org/wiki/Downloads # 销毁旧虚拟机(如存在) vagrant destroy -f # 创建并启动虚拟机 vagrant up # SSH 登录 vagrant ssh # 进入工作目录 cd /work ``` ## 常用命令 ```bash # 启动虚拟机 vagrant up # 停止虚拟机 vagrant halt # 重启虚拟机 vagrant reload # SSH 登录 vagrant ssh # 查看虚拟机状态 vagrant status # 销毁虚拟机 vagrant destroy -f ``` ## Podman 使用 虚拟机内已安装 Podman,命令兼容 Docker: ```bash # 运行容器 podman run -d --name nginx -p 80:80 nginx # 使用 docker 命令(已配置兼容套接字) docker ps docker-compose up -d ``` ## Manticore Search Manticore 已配置好共享目录: - 数据目录:`F:\manticore_data` ↔ `/manticore_data` - 配置文件:`F:\manticore_conf` ↔ `/etc/manticore` ### 启动 Manticore ```bash vagrant reload # 虚拟机内 podman run -d \ -p 9306:9306 \ -p 9308:9308 \ -v /manticore_data:/var/lib/manticore \ -v /etc/manticore:/etc/manticore \ --name manticore \ manticoresearch/manticore podman run -d -p9306:9306 -p9308:9308 -v /manticore_data:/var/lib/manticore --name manticore manticoresearch/manticore ``` ### 使用方式 #### HTTP API (端口 9308) ```bash # 创建表 curl -X POST 'http://localhost:9308/sql' -d 'CREATE TABLE products (title text, price float)' # 插入数据 curl -X POST 'http://localhost:9308/sql' -d "INSERT INTO products (title, price) VALUES ('iPhone 15', 999.0)" # 搜索 curl -X POST 'http://localhost:9308/sql' -d "SELECT * FROM products WHERE MATCH('iPhone')" ``` #### MySQL 协议 (端口 9306) ```bash # 使用 mysql 客户端连接 mysql -h 127.0.0.1 -P 9306 # SQL 查询 SHOW TABLES; SELECT * FROM products WHERE MATCH('iPhone'); ``` #### Docker Compose 方式 在 `/work` 目录创建 `docker-compose.yml`: ```yaml version: '3' services: manticore: image: manticoresearch/manticore ports: - "9306:9306" - "9308:9308" volumes: - /manticore_data:/var/lib/manticore - /etc/manticore:/etc/manticore ``` ```bash podman-compose up -d # 或使用 docker 命令 docker-compose up -d vagrant ssh podman pull manticoresearch/manticore ```