azure云配置ubuntu虚拟机及部署scrapy
来源:互联网 发布:2016淘宝活动报名入口 编辑:程序博客网 时间:2024/06/05 02:55
基本环境配置:
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip
安装相关数据库mongo和redis:
mongo的安装可以参考http://blog.csdn.net/like_a_fool/article/details/14105871 关于mongo权限问题建议这篇文章http://blog.csdn.net/lxpbs8851/article/details/7569852 还有个问题需要注意一下mongo dbpath配置
redis的安装可以参考http://redis.io/download 其中需要把redis-server改为后台进程一直运行,方法是修改配置文件redis.conf,daemonize改为yes
然后src/redis-server redis.conf
部署scrapy:
1.安装mongo和redis的python api
sudo pip install pymongo redis
2.scrapy安装参考https://pypi.python.org/pypi/Scrapy
sudo pip install scrapy 这个命令运行时可能会产生这个错误:error: command 'gcc' failed with exit status 1
解决方法参考http://stackoverflow.com/questions/10927492/getting-gcc-failed-error-while-installing-scrapy sudo apt-get install libxml2-dev libxslt-dev
接下来针对具体scrapy相关项目其他配置进行说明:
sudo apt-get install git
utils4scrapy: https://github.com/linhaobuaa/utils4scrapy.git
weibopy: https://github.com/linhaobuaa/weibopy.git
scrapy-redis: https://github.com/darkrho/scrapy-redis
三个依赖包clone下来进行安装
具体项目https://github.com/linhaobuaa/scrapy_weibo_v1.git
相关配置主要为导入mongodb token,apikey,apisecret信息
1.将60上dump的mongo数据scp到云虚拟机导入本地mongo 可以参考http://www.cnblogs.com/jiangzhichao/archive/2011/08/12/2135899.html
2.运行utils4scrapy中的tk_maintain.py将授权信息导入redis 可能要sudo pip install logbook
3.https://github.com/linhaobuaa/utils4scrapy/blob/master/utils4scrapy/auto_reset_ip_req_count.py
https://github.com/linhaobuaa/utils4scrapy/blob/master/utils4scrapy/auto_calibration.py 放入后台任务/etc/crontab
0 * * * * root cd /home/azureuser/taolei/utils4scrapy/utils4scrapy;python auto_reset_ip_req_count.py
*/2 * * * * root cd /home/azureuser/taolei/utils4scrapy/utils4scrapy;python auto_calibration.py
关于后台运行scrapy说明:
nohup command > myout.file 2>&1 &
在上面的例子中,0 – stdin (standard input),1 – stdout (standard output),2 – stderr (standard error) ;
2>&1是将标准错误(2)重定向到标准输出(&1),标准输出(&1)再被重定向输入到myout.file文件中。
- azure云配置ubuntu虚拟机及部署scrapy
- powershell部署Azure云虚拟机的命令流程
- Azure虚拟机监控警报配置
- [Azure]使用Azure Powershell重新部署ASM虚拟机
- 在Windows Azure上部署Linux虚拟机
- 虚拟机ubuntu上安装JDK,及配置
- ubuntu 虚拟机上网方式及相关配置
- 远程桌面连接Windows Azure中的Ubuntu虚拟机
- 远程桌面连接Windows Azure中的Ubuntu虚拟机
- [Azure]Azure Powershell导出虚拟机及对应磁盘
- 【Azure】CentOs虚拟机创建及NGUNX安装
- scrapy安装及PyCharm的scrapy配置
- Scrapy在Ubuntu中的配置
- 在 Azure 虚拟机上部署反恶意软件解决方案
- Azure ARM虚拟机部署反恶意软件-安全扩展
- VMwave虚拟机安装linux,ubuntu系统及配置
- 如何将同一云服务下的虚拟机从经典部署模型迁移到 Azure Resource Manager
- 如何将同一云服务下的虚拟机从经典部署模型迁移到 Azure Resource Manager
- 《Head First 设计模式》学习笔记——迭代器模式 + 组合模式
- 渊子赛马
- 深入Mysql字符集设置
- codeforces 06/01/B The Child and Set
- #250 div.2 A. The Child and Homework
- azure云配置ubuntu虚拟机及部署scrapy
- linux 学习之路(学linux必看)
- Permutation Sequence
- 黑马程序员-JAVA面向对象封装、继承和多态
- Android中Preference的使用以及监听事件分析
- 网络虚拟化技术
- Light OJ 1334 Genes in DNA KMP+DP
- POJ训练计划3687_Labeling Balls(拓扑排序)
- 如何将Win8的默认窗口背景设为护眼色(彻底)