1,系统环境
a,操作系统 CentOS Linux release 7.6.1810 (Core) 64位
2,安装npm环境:
# Node 官网已经把 linux 下载版本更改为已编译好的版本了,我们可以直接下载解压后使用:
wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz # 下载
tar xf node-v10.9.0-linux-x64.tar.xz # 解压
cd node-v10.9.0-linux-x64/ # 进入解压目录
./bin/node -v # 执行node命令 查看版本
# 创建软链接做环境变量
ln -s /usr/software/nodejs/bin/npm /usr/local/bin/
ln -s /usr/software/nodejs/bin/node /usr/local/bin/
最后安装完成,输入命令 “node -v”,得到正确的版本号
3,安装redis
执行以下命令完成安装
yum install -y gcc # 安装依赖包wget http://download.redis.io/releases/redis-5.0.5.tar.gz # 下载Redis安装包
tar -xzvf redis-5.0.5.tar.gzcd redis-5.0.5/deps
make hiredis jemalloc linenoise lua # 编译开4个组件
cd ..
make MALLOC=libc #编译rediscd ..
mv redis-5.0.5/ redis/vi redis/redis.conf
########## 将daemonize no改为yes #########redis/src/redis-server redis/redis.conf # 启动redis
出现如下配置,证明Redis后台启动成功
4,安装mysql 5.7.24,执行以下命令
mkdir -p /data/soft/
cd /data/soft/
yum -y install wget gcc gcc-c++ ncurses ncurses-devel cmake numactl.x86_64
wget http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.7/mysql-5.7.24-el7-x86_64.tar.gz
tar -zxvf /data/soft/mysql-5.7.24-el7-x86_64.tar.gz -C /data/soft
mv /data/soft/mysql-5.7.24-el7-x86_64/ /data/soft/mysql
cd /data/soft/mysql/
cp /data/soft/mysql/support-files/mysql.server /etc/init.d/mysql
cat >/etc/my.cnf <<EOF
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=/data/soft/mysql
datadir=/var/lib/mysql
EOF
mkdir -p /var/lib/mysql
chmod -R 777 /var/lib/mysql
mkdir /var/log/mariadb
chown -R 777 /var/log/mariadb/
touch /var/log/mariadb/mariadb.log
mkdir /var/run/mariadb
chown -R 777 /var/run/mariadb/
touch /var/run/mariadb/mariadb.pid
mv /var/lib/mysql/ /var/lib/mysql_bak/
cat >> /etc/profile << EOF
export PATH=\$PATH:/data/soft/mysql/bin:/data/soft/mysql/lib
EOF
source /etc/profile
useradd mysql
pkill -9 mysql
cd /data/soft/mysql/bin/
./mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize-insecure
/etc/init.d/mysql start
输入“mysql -u root -p”,回车可以进入数据库,不设置密码
5,确保redis和mysql后台运行,安装rap2后端
git clone https://github.com/thx/rap2-delos.git #克隆rap2后端代码
cd rap2-delos/ # 打开rap2后端
mysql -e 'CREATE DATABASE IF NOT EXISTS RAP2_DELOS_APP DEFAULT CHARSET utf8 COLLATE utf8_general_ci' # 创建rap2数据库
npm install
npm install -g typescript
npm run build #初始化数据库表
npm run create-db #执行mocha测试用例和js代码规范检查
npm run check #启动开发模式的服务器 监视并在发生代码变更时自动重启
# 1. 修改rap2-delos/dist/config/config.prod.js中的服务器配置
vi rap2-delos/dist/config/config.prod.js
# 2. 启动生产模式服务器
npm run dev #启动服务
6,安装rap2前端
git clone https://github.com/thx/rap2-dolores.git
cd rap2-dolores/
npm install
npm run build
npm install -g serve
serve -s ./build -p 80
7,访问:“http://ip地址”