压缩文件夹:
tar -czvf proxy_pool.tgz proxy_pool/
解压:
tar -xzvf proxy_pool.tgz
跳板机rz上传稍大文 rz -e和sz -e
安装pip:
yum install python-pip -y
pip install --upgrade pip
安装screen:
yum install screen -y
安装MySQL-python:
yum install MySQL-python -y
安装PIL:
yum -y install python-imaging
安装git:
yum -y install git
查看版本号 git --version
ssh免密登录:
需要通过spider1向其他爬虫机发送爬虫文件,所以需要spider1可以免密登陆其他爬虫机,操作过程:
在spider1中输入: ssh-keygen -t rsa 然后3次回车即可,此时会在~/.ssh目录下生成“id_rsa id_rsa.pub”两个文件,其中id_rsa.pub为spider1的公钥文件
在其他爬虫机~/.ssh文件夹中,创建authorized_keys文件,将spider1 id_rsa.pub中的内容复制到authorized_keys文件中即可(也有肯能涉及到修改权限问题)
然后就spider1就可以免密登陆其他爬虫机了
参考:https://blog.csdn.net/wangzhkai/article/details/80288894
centos7安装chrome和chromedriver:
参考:https://blog.csdn.net/ForeverLyu/article/details/89262036
在linux上需要安装执行js的环境:
yum install nodejs
安装cv2:
pip install opencv-python
运行import cv2可能会报错 如果没错误则不用管:
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
解决办法:https://blog.csdn.net/a1368783069/article/details/80254257
1 错误:
ImportError: libXext.so.6: cannot open shared object file: No such file or directory
安装
yum install libXext.x86_64
2 错误
ImportError: libSM.so.6: cannot open shared object file: No such file or directory
安装:
yum install libSM.x86_64
3 错误
libXrender.so.1: cannot open shared object file: No such file or directory
安装:
yum install libXrender.x86_64
安装ffmpeg-python:
可以先升级setuptools: pip install --upgrade setuptools
pip install ffmpeg-python
使用前机器需要安装ffmpeg,参考:https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/
安装execjs:
pip install PyExecJS
安装phantomjs:
参考:https://www.jianshu.com/p/43bcf0a4195c
安装python3.8
不能卸载自带的python2,因为yum使用的是python2
centos7下安装python3.8:https://www.jianshu.com/p/15f40edefb13
其中下载python3.8:wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
解压:tar -zxvf Python-3.8.1.tgz
升级pip3:
/usr/local/python3/bin/python3.8 -m pip install --upgrade pip
导出本地包:
pip3 freeze >requirements.txt
在爬虫机安装需要的python包:
pip3 install -r requirements.txt
安装redis:
https://www.cnblogs.com/heqiuyong/p/10463334.html
当前已将redis-server设置为后台启动;而且已经设置了软连接,所以可以在任意位置通过redis命令启动redis-cli
后台启动:./redis-server redis.conf
ps -ef|grep cworker_main.py|grep -v grep|awk '{print $2}'|xargs kill -9