1、环境配置
[root@localhost ~]# python -V //执行python -V即可获取当前版本
Python 2.7.5
[root@localhost ~]# systemctl stop firewalld.service //关闭firewall防火墙
[root@localhost ~]# systemctl disable firewalld.service //禁止firewall防火墙开机启动
[root@localhost ~]# systemctl stop iptables.service //关闭iptables防火墙
[root@localhost ~]# systemctl disable iptables.service //禁止iptables防火墙开机启动
使用lnmp一键安装包安装Web及数据库环境并给ssbc创建一个数据库
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
[root@localhost ~]# wget https://github.com/78/ssbc/archive/master.zip
[root@localhost~]# yum -y install unzip
[root@localhost~]# unzip master.zip
[root@localhost ~]# cd ssbc-master
[root@localhost ssbc-master]# wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
[root@localhost ssbc-master]# python get-pip.py
[root@localhost ssbc-master]# pip install -r requirements.txt
yum -y install gcc gcc-c++ python-devel mysql-server
建立文件夹
[root@localhost ssbc-master]# mkdir -p /data/bt/index/db /data/bt/index/binlog /tem/downloads
[root@localhost ssbc-master]# chmod 755 -R /data
[root@localhost ssbc-master]# chmod 755 -R /tem
2、安装Spinx并生成索引
[root@localhost ssbc-master]# yum -y install unixODBC unixODBC-devel postgresql-libs
[root@localhost ssbc-master]# wget http://sphinxsearch.com/files/sphinx-2.2.9-1.rhel7.x86_64.rpm
[root@localhost ssbc-master]# rpm -ivh sphinx-2.2.9-1.rhel7.x86_64.rpm
[root@localhost ssbc-master]# systemctl restart sphnix.service
[root@localhost ssbc-master]# indexer -c sphinx.conf --all //(all 前面是空格减号减号)
[root@localhost ssbc-master]# searchd --config ./sphinx.conf //(config前是空格减号减号)
3、Django初始化并启动
[root@localhost ssbc-master]# python manage.py makemigrations
[root@localhost ssbc-master]# python manage.py migrate
[root@localhost ssbc-master]# nohup python manage.py runserver 0.0.0.0:87 >/dev/zero &
4、爬虫运行及入库
执行:[root@localhost ssbc-master]# python simdht_worker.py 等2分钟出现数据之后CTRL+C停止
执行:[root@localhost ssbc-master]# python index_worker.py 等待10分钟没有出现数据后CTRL+C停止
错误汇总
ln -sf /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
sphinx安装错误
yum install mysql-devel
Ubuntu 安装事项
apt-get update
apt-get install -y –force-yes build-essential autoconf libtool libssl-dev curl
apt-get install python-pip git python-m2crypto
apt-get install python2.7 python2.7-dev python3.2 python3.2-dev
去除搜索页 右下角广告
[root@localhost ssbc-master]# cd web/static/js
[root@localhost ssbc-master]# vi ssbc.js 找到如下3行,在前面添加//进行注释,保存
// document.write(‘");
// document.writeln("");
中文搜索乱码解决办法:
搜索中文报UnicodeEncodeError错误,
修改python下的site.py centos7 是/usr/lib64/python2.7/site.py
在import sys下添加2行:
reload(sys)
sys.setdefaultencoding('utf8')
修改/etc/my.cnf (mysql错误2006)
wait_timeout=3000
interactive_timeout=3000
max_allowed_packet=64M