1、mongodb脚本,把下面的代码复制粘贴到test.sh ,赋予运行权限即可(sudo chmod +x test.sh)
#!/bin/bash#mongodb数据库安装#安装依赖包sudo yum install -y wget vim lrzsz subversion#休眠5秒sleep 5#下载mongodb安装包sudo wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.0.tgz -P /usr/local/src#解压安装包到指定位置sudo tar -xvf /usr/local/src/mongodb-linux-x86_64-rhel70-4.2.0.tgz -C /usr/local/#修改目录的名字sudo mv /usr/local/mongodb-linux-x86_64-rhel70-4.2.0/ /usr/local/mongodb#创建数据库启动必须目录sudo mkdir /usr/local/mongodb/{data,logs,pid}#写入配置文件cat >>/usr/local/mongodb/mongodb.conf<
2、node脚本,与1同理
#!/bin/bash#node命令安装 #安装依赖包 (root) wget:远程下载工具sudo yum install -y wget sysstat vim subversion git openssl-devel make cmake pcre-devel gcc gcc-c++ lrzsz#下载node安装包sudo wget https://nodejs.org/dist/v8.16.2/node-v8.16.2-linux-x64.tar.gz -P /usr/local/src/#解压安装包到指定位置sudo tar -xvf /usr/local/src/node-v8.16.2-linux-x64.tar.gz -C /usr/local/#修改目录的名字sudo mv /usr/local/node-v8.16.2-linux-x64/ /usr/local/node#上面有报错退出if["$?"-eq 0 ];thensudo ln -s /usr/local/node/bin/node /usr/local/bin/ sudo ln -s /usr/local/node/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm sudo ln -s /usr/local/node/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npxfi#安装tsc命令 npm install -g typescript@3.7.x#安装pinus命令npm install -g pinusif["$?"-eq 0 ];then#设置软链接到/usr/local/bin目录下并且修改名字,不推荐写入~/.bashrc文件中sudo ln -s /usr/local/node/lib/node_modules/typescript/bin/tsc /usr/local/bin/ sudo ln -s /usr/local/node/lib/node_modules/pinus/dist/bin/pinus.js /usr/local/bin/pinusfiecho-e"\033[32m node安装完成!\033[0m"exit0
软件安装路径都在在/usr/local/下