# 搭建环境 **Repository Path**: printlim/building ## Basic Information - **Project Name**: 搭建环境 - **Description**: 搭建喵崽机器人环境 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-30 - **Last Updated**: 2024-01-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 搭建喵崽机器人(Centos7) # 介绍 搭建喵崽及环境教程 ## 喵崽所需环境:Nodejs(版本 ≥ V16)、Redis(版本 ≥ 6) ## 安装教程 ### 安装Nodejs v16 ##### 1. yum安装设置Nodejs v16版本 ``` curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash ``` (setup_16里16是版本号,可根据自己需要修改) ##### 2. yum方式安装 ``` sudo yum -y install nodejs ``` ##### 3. 测试查看版本 ``` [root@localhost 1]# node -v v16.13.2 [root@localhost 1]# npm -v 8.1.2 ``` ### 安装Redis #### 1.安装gcc ``` yum -y install gcc tcl ``` #### 2.查看 gcc 版本是否在 5.3 以上,centos7.6 默认安装 4.8.5 ``` gcc -v ``` #### 3.升级到 gcc 9.3 ``` yum -y install centos-release-scl yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils ``` #### 4.临时启用gcc 9.3(重启会失效) ``` scl enable devtoolset-9 bash ``` ###### 永久使用gcc 9.3 (不推荐) ``` echo -e "\nsource /opt/rh/devtoolset-9/enable" >>/etc/profile ``` #### 5.开始安装 ##### 1.进入指定目录并下载Redis6 ``` cd /usr/local/ wget http://download.redis.io/releases/redis-6.0.9.tar.gz tar -zxvf redis-6.0.9.tar.gz cd redis-6.0.9 make ``` ##### 2.编译安装到指定目录下 ``` make PREFIX=/usr/local/redis install ``` #### 6.启动rdis(重启系统后需按此步骤重启redis) ``` cd /usr/local/redis/bin ./redis-server --save 900 1 --save 300 10 --daemonize yes ``` ### 安装git v2 #### 1.添加 End Point Package Repository ``` sudo yum install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm ``` #### 2.使用yum安装git ``` sudo yum install git ``` ##### 至此环境搭建完成 ### 搭建由TRSS-Yunzai #### 推荐使用[TRSS脚本](https://trss.me)一键安装 ##### 这里是Centos7,其他linux理论通用,自测 ``` bash <(curl -L gitee.com/TimeRainStarSky/TRSS_AllBot/raw/main/Install-Docker.sh) ``` ### 搭建由kokomi大佬维护的[喵崽](https://gitee.com/yoimiya-kokomi/Miao-Yunzai) #### 1.克隆并安装miao-plugin ``` # 使用 Github git clone --depth=1 https://github.com/yoimiya-kokomi/Miao-Yunzai.git cd Miao-Yunzai git clone --depth=1 https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ # 使用Gitee git clone --depth=1 https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git cd Miao-Yunzai git clone --depth=1 https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ ``` #### 2.安装[pnpm](https://pnpm.io/zh/installation),已安装可跳过 ``` # 使用npmjs.org安装 npm install pnpm -g # 指定国内源npmmirror.com安装 npm --registry=https://registry.npmmirror.com install pnpm -g ``` #### 3.安装依赖 ``` # 直接安装 pnpm install -P # 如依赖安装缓慢或失败,可尝试更换国内npm源后再执行install命令 pnpm config set registry https://registry.npmmirror.com pnpm install -P ``` #### 4.启动 ``` #直接启动 node app # 后台启动 pnpm start # 后台停止运行 pnpm stop # 查看日志 pnpm run log ``` ## 常见问题 ### puppeteer 相关问题 #### linux环境 ``` puppeteer Chromium 启动中... Error: Failed to launch the browser process! ``` #### 检查nodejs版本是否 ≥ V16 ``` node -v ``` #### 大于v14可能缺库,安装这些 ``` yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y ``` ### 字体乱码 ``` yum groupinstall fonts -y ``` ## Qsign签名服务器 暂无,推荐使用公共签名服务 ## 云崽推荐 ### 乐神的[Yunzai-Bot](https://gitee.com/le-niao/Yunzai-Bot) ### kokomi的[Miao-Yunzai](https://gitee.com/yoimiya-kokomi/Miao-Yunzai) ### 时雨的[TRSS-Yunzai](https://gitee.com/TimeRainStarSky/Yunzai) ## 教程到此结束