sudo apt update
    sudo apt upgrade -y

    安装git
    sudo apt install git -y

    安装mysql
    sudo apt install mysql-server -y
    开机自启动
    systemctl enable mysql

    use mysql;
    UPDATE user SET plugin=’mysql_native_password’ WHERE User=’root’;
    UPDATE mysql.user SET authentication_string=PASSWORD(‘Better@2018’) WHERE USER=’root’;
    FLUSH PRIVILEGES;
    设置密码:
    mysql 5.7之前的版本:
    UPDATE mysql.user SET Password = PASSWORD(‘password’) WHERE User = ‘root’;
    mysql 5.7之后:
    UPDATE mysql.user SET authentication_string = PASSWORD(‘Better@2018’) WHERE User = ‘root’;
    FLUSH PRIVILEGES;

    sudo apt install libmysqlclient-dev
    updatedb
    locate mysql_config

    配置 默认字符集:
    locate my.cnf
    cd /etc/mysql/mysql.conf.d/
    vim mysqld.cnf
    拉倒最后
    collation-server = utf8mb4_general_ci
    init-connect=’SET NAMES utf8mb4’
    character-set-server = utf8mb4

    重启 mysql
    service mysql restart

    创建项目数据库

    安装 nginx:
    sudo apt install nginx
    安装 opencv
    sudo apt install tk-dev python-tk

    安装 python-dev
    sudo apt install python-dev

    安装 supervisor
    sudo apt install supervisor

    安装 redis
    sudo apt install make gcc libc6-dev tcl
    wget http://download.redis.io/redis-stable.tar.gz
    tar xvzf redis-stable.tar.gz
    cd redis-stable
    sudo make install
    开启:redis-server
    测试:redis-cli ping
    结果:PONG


    安装配置 virtualenv
    进入虚拟环境:
    安装 gunicorn
    pip install gunicorn gevent
    修改pip源:

    1. pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

    git clone 项目
    pip install -r req.txt
    ln -s 关联 supervisor nginx 配置文件
    检查重启 nginx

    • nginx -tc /etc/nginx/nginx.conf
    • systemctl reload nginx.service

    export IMAGE_REC_ENV=PRODUCT