inception官方文档: http://mysql-inception.github.io/inception-document/install/
Yearning官方文档: https://cookiey.github.io/Yearning-document/
inception部署流程:
- 环境准备
centos7.3, python2.x(建议用python2.x,因为inception相关脚本基于python2.x) - 开始安装
#yum
install
cmake ncurses-devel gcc gcc-c++ openssl-devel
(依赖库安装)#cd
/usr/local/src/
#wget http:
//ftp
.
gnu.org
/gnu/m4/m4-1
.4.18.
tar
.gz
#tar
-zxvf m4-1.4.18.
tar
.gz
#cd
m4-1.4.18
#.
/configure
&&
make
&&
make
install
#wget http:
//ftp
.gnu.org
/gnu/bison/bison-2
.4.
tar
.gz
#tar
-zxvf bison-2.4.
tar
.gz
#cd
bison-2.4/
#.
/configure
&&
make
&&
make
install
#cd
/usr/local/
#wget https:
//github
.com
/mysql-inception/inception/archive/master
.zip
#unzip master.zip
#mvinception-master/ inception
#mvmaster.zip inception.zip
#mvinception.zip
/usr/local/src/
#sh inception_build.sh builddir linux - 配置文件添加
#vim /etc/inc.cnf[inception] general_log=1 general_log_file=/usr/local/inception/log/inception.log port=6669 socket=/usr/local/inception/inc.socket character-set-client-handshake=0 character-set-server=utf8inception_remote_system_user=xxxx inception_remote_system_password=xxxx inception_remote_backup_port=xxxx inception_remote_backup_host=xxxxinception_support_charset=utf8mb4 inception_enable_nullable=0 inception_check_primary_key=1 inception_check_column_comment=1 inception_check_table_comment=1 inception_osc_min_table_size=1 inception_osc_bin_dir=/usr/local/inception/data inception_osc_chunk_time=0.1 inception_enable_blob_type=1 inception_check_column_default_value=1
注:参数相关信息参考官方文档配置修改
- 启动测试
#nohup/usr/local/inception/builddir/mysql/bin/Inception
--defaults-
file
=inc.cnf >
/dev/null
2>&1 &
#mysql -uroot -h127.0.0.1 -P6669
>inception get variables;
输出变量信息说明配置成功 - Yearning部署
- 依赖环境:
centos7.3, python3.6, nginx, mysql >= 5.6 - 源码安装python3.6
#yum install xz gcc zlib zlib-devel #安装依赖
#wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
#xz -d Python-3.6.1.tar.xz
#tar -xvf Python-3.6.1.tar
#cd Python-3.6.1
#./
configure
-
-
prefix
=
/
usr
/local/python --with-ssl (必须加上--with-ssl, 否则用python3的pip安装软件会出错)
#make && make install
- 让ceont7默认使用python3
#cd/
usr
/
bin
/
#mv python python.bak
#ln-
s
/
usr
/local/
python
/
bin
/
python3.
6
/
usr
/
bin
/
python
因为yum使用的是python2,替换python3之后可能导致无法正常工作,因此修改yum配置文件(vim /usr/bin/yum)。 把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7保存退出即可
vim /usr/libexec/urlgrabber-ext-down
将/usr/bin/python改为/usr/bin/python2.7。
- Yearning安装
#安装 nginx mysql python3.6(yum即可) - 建立数据库 (库字符集为UTF8 )
- 下载软件包
#git clone https://github.com/cookieY/Yearning.git
编辑 Yearning/src/deploy.conf
[mysql]
db = 所创建的库名
address = 数据库地址
port = 数据库端口
password = 数据库密码
username = 数据库用户[host]
ipaddress = 服务器ip地址:端口 (涉及跨域十分重要!!设置不正确将无法登陆!!)
如 本机地址为192.168.1.2 nginx设置端口为80
则应填写为 192.168.1.2:80 之后通过该地址访问平台。[Inception]
ip = Inception地址
port = Inception端口
user = Inception用户名
password = Inception密码
backupdb = 备份数据库地址
backupport = 备份数据库端口
backupuser = 备份数据库用户名
backuppassword = 备份数据库密码[LDAP] LDAP相关设置
LDAP_SERVER = LDAP服务地址
LDAP_SCBASE = LDAP dc 设置 如 dc=xxx,dc=com
LDAP_DOMAIN = LDAP域名 如 xxx.com
LDAP_TYPE = 1 1 通过域名进行ldap认证 0 通过uid进行ldap认证[email] 邮箱推送相关设置
username = 邮箱发件账号 如 [email protected]163.com
password = 邮箱发件账号密码
smtp_server = 邮箱stmp地址, 具体地址请咨询对应邮箱提供者 - pip3 install -r requirements.txt 安装相应python依赖库
- python3 manage.py makemigrations && python3 manage.py migrate 初始化数据库
- echo "from core.models import Account;Account.objects.create_user(username='admin', password='Yearning_admin', group='admin',is_staff=1)" | python3 manage.py shell 添加初始化用户
echo "from core.models import grained;grained.objects.get_or_create(username='admin', permissions={'ddl': '1', 'ddlcon': [], 'dml': '1', 'dmlcon': [], 'dic': '1', 'diccon': [], 'dicedit': '0', 'query': '1', 'querycon': [], 'user': '1', 'base': '1', 'dicexport': '0'})" | python3 manage.py shell 初始化权限
cp -rf Yearning/webpage/dist/* $NGINX_HOME/html/ 复制编译好的静态文件到nginx html目录下(如自行更改Nginx静态路径地址则将静态文件复制到对应静态文件目录下)
systemctl start nginx 启动nginx
python3 manage.py runserver 0.0.0.0:8000 启动django
访问deploy.conf 配置文件中ipaddress 填写的地址
默认账号: admin 密码:Yearning_admin
注:按照以上官方文档可能回遇到CORS跨域问题,导致登录不了系统,需要修改django框架配置文件
#vim settings
INSTALLED_APPS = (
...
'corsheaders',
...
)
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware', # cors
'django.middleware.common.CommonMiddleware',
...
]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
原文地址:http://blog.51cto.com/haoyonghui/2084154