> ## Content Index
> Fetch the complete content index at: https://blog.k3s.9zf.net/llms.txt
> Use this file to discover other available public pages before exploring further.

# wechat-admin安装手记
- URL: https://blog.k3s.9zf.net/wechat-admin-e5-ae-89-e8-a3-85-e6-89-8b-e8-ae-b0/
- Published: 2018-04-21T20:59:47.000Z
- Updated: 2018-04-21T20:59:47.000Z
- Author: liu
- Tags: Linux, #wordpress, #Import 2026-10-29 06:11

虚拟机安装centos7 mini  
快照下，更新，快照下  
安装docker  
yum install docker  
安装yum -y install epel-release  
安装yum install python-pip  
升级 pip install –upgrade pip  
启动service docker start  
开机启动chkconfig docker on  
git 安装yum install git  
安装wechat-admin  
pip install docker-compose  
git clone https://github.com/dongweiming/wechat-admin.git //移动宽带可能会出现github连不上，修改hosts换个ip解决  
git clone –recursive https://github.com/dongweiming/wechat-plugins  
cd wechat-admin  
docker-compose build //可能出现cf连不上，按错误提示的域名修改hosts解决。安装依赖时网络不好导致失败，重新安装试试（移动宽带真心不会适合搞这些，奇奇怪怪的乱墙）。

————————————————————————-分割线—————————————————————–

常规安装

先yum update 更新下

安装

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

wget [https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz](https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz?ref=blog.k3s.9zf.net)

解压

tar -xvJf Python-3.6.2.tar.xz

切换进入

cd Python-3.6.2

编译安装

./configure prefix=/usr/local/python3

make && make install

安装完毕，/usr/local/目录下就会有python3了

因此我们可以添加软链到执行目录下/usr/bin

ln -s /usr/local/python3/bin/python3 /usr/bin/python

python -V 看看输出的是不是python3的版本

因为执行yum需要python2版本，所以我们还要修改yum的配置，执行：

vi /usr/bin/yum

把#! /usr/bin/python修改为#! /usr/bin/python2

同理 vi /usr/libexec/urlgrabber-ext-down 文件里面的#! /usr/bin/python 也要修改为#! /usr/bin/python2

这样python3版本就安装完成；同时python2也存在

python -V 版本3

python2 -V 版本2

### 3.配置pip

Python3装完后，默认已经安装了pip，此时只要配置下软链接即可使用pip工具：

```
ln -s /usr/local/python3/bin/pip3  /usr/bin/pip
安装个git看看正常不
安装lnmp和redis
进入lnmp解压后的目录，执行：./addons.sh install redis 
创建个数据库 test 用户test 密码test123 

```

git clone https://github.com/dongweiming/wechat-admin

cd wechat-admin

virtualenv venv //提示没有virtualenv
pip install virtualenv
升级下pip install --upgrade pip

`/usr/local/python3/bin/virtualenv `venv

source venv/bin/activate  # 推荐使用autoenv
venv/bin/pip install -r requirements.txt  # 如果已经激活虚拟环境，`venv/bin/`这样的前缀可不加，下同
修改local_settings.py 
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:11111@localhost/test?charset=utf8mb4'
REDIS_URL = 'redis://localhost:6379' （这个默认配置坑，改成localhost就行了）
[config/index.js ](https://github.com/dongweiming/wechat-admin/blob/18c64c1a76ea8ddc75512e5dc0fd4e818a861e5d/config/index.js?ref=blog.k3s.9zf.net "config/index.js") [build/dev-server.js ](https://github.com/dongweiming/wechat-admin/blob/029799d9ced007b410487f7bb5ac93d02fd270ee/build/dev-server.js?ref=blog.k3s.9zf.net "build/dev-server.js")localhost改成ip，不知道不改行不行

初始化数据库：

❯ export FLASK_APP=manager.py
❯ venv/bin/flask initdb

启动服务：

❯ venv/bin/gunicorn app:app --bind 0.0.0.0:8100 -w 6 -t 0

登录成功后，启动Celery Beat和Worker：

❯ venv/bin/celery -A wechat worker -l info -B
如果不行就

npm run build下

 ```

```