Yearning SQL 審計平臺 基於Vue.js與Django的整套mysql-sql審覈平臺解決方案。提供基於Inception的SQL檢測及執行。html
GitHub:https://github.com/cookieY/Yearningpython
文檔:https://cookiey.github.io/Yearning-document/mysql
一、Nginx安裝nginx
yum install nginx -y
二、MySQL Server安裝git
https://dev.mysql.com/downloads/repo/yum/ 下載yum庫mysql57-community-release-el6-11.noarch.rpmgithub
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum list|grep mysql57
yum install mysql-community-server -y
三、Python 3.6安裝web
tar -xvf Python-3.6.4.tar.xz
mkdir -p /usr/local/python/3.6.4/lib
cd Python-3.6.4 ./configure --enable-shared --prefix=/usr/local/python/3.6.4 LDFLAGS="-Wl,-rpath /usr/local/python/3.6.4/lib" make make install
cp /usr/bin/python /usr/bin/python2.6.6 ln -fs /usr/local/python/3.6.4/bin/python3.6 /usr/bin/python ln -fs /usr/local/python/3.6.4/bin/pip3 /usr/bin/pip
vi /usr/bin/yum 將頭部 #!/usr/bin/python 修改成 #!/usr/bin/python2.6.6
四、Inception安裝sql
參考:http://www.cnblogs.com/shhnwangjian/p/8464172.htmlshell
五、Yearning安裝數據庫
git clone https://github.com/cookieY/Yearning.git
create database Yearning DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
cd Yearning/src pip install -r requirements.txt
[mysql] db = 所建立的庫名 address = 數據庫地址 port = 數據庫端口 password = 數據庫密碼 username = 數據庫用戶 [host] ipaddress = 服務器ip地址:端口 (涉及跨域十分重要!!設置不正確將沒法登錄!!) 如 本機地址爲192.168.137.13 nginx設置端口爲80 則應填寫爲 192.168.137.13: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 [email] 郵箱推送相關設置 username = 郵箱發件帳號 如 xxxx@163.com password = 郵箱發件帳號密碼 smtp_server = 郵箱stmp地址, 具體地址請諮詢對應郵箱提供者
python manage.py makemigrations python manage.py migrate
echo "from core.models import Account;Account.objects.create_user(username='admin', password='admin123456', group='admin',is_staff=1)" | python manage.py shell
cd Yearning/webpage/dist cp -rf * /usr/share/nginx/html/ service nginx restart
cd Yearning/src python manage.py runserver 0.0.0.0:8000