Centos 7下安装百度云爬虫

爬虫运行于MySQL、Python 2.7、Mysql-python下,所以先安装MySQL和MySQL-python。

1、安装MySQL安装依赖

yum install libaio

安装MySQL

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yum localinstall mysql-community-release-el7-5.noarch.rpm yum install mysql-community-server

启动MySQL

systemctl start mysqld

设置MySQL密码

mysql_secure_installation;

2、防火墙设置安装iptables

yum install iptables-services

开放3306端口

vi /etc/sysconfig/iptables

添加

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT -A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 3306 -j ACCEPT

重启iptables

service iptables restart

3、安装MySQL-python

yum install MySQL-python

4、设置程序

wget https://github.com/x-spiders/baiduyun-spider/archive/master.zip unzip master.zip cd baiduyun-spider-master

设置连接数据库的账号密码

打开 bin/spider.py ,修改 DB_HOST、DB_PORT、DB_USER、DB_PASS

首次运行爬虫

python bin/spider.py --seed-user

运行爬虫

python bin/spider.py

源码来源:https://geekspider.org/senior/215.html

推荐站内搜索:免费国际域名、国内免备案服务器、美国主机代购、备案网站、cn域名个人注册、阿里云服务器、备案查询 工信部、韩国高防服务器域名查询工具、备案域名查询、