当前位置: 首页 > news >正文

利用 docker 配置 pinbot-crawl 环境

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

pinbot-crawl 是我在开发的一个爬虫项目,它应用到的东西相对较多,oursql, python3-memcached, gearman, python3。

docker 挺好玩的我就用了一下配置了运行环境,如下

$ # start a container

$ docker run -i -t ubuntu:12.04 /bin/bash
# # update the source
# apt-get update
# # install python3 and python3-dev
# apt-get install python3 python3-dev
# # install the setuptools
# apt-get install python3-setuptools
# # oh fuck forget to mount the source dirctory
# exit
$ # use docker ps -a to find the above container_id
$ docker ps -a
$ # my container_id is 4823a1bfd668 commit it
$ docker commit 4823a1bfd668 lmj/pinbot-crawl
$ # mount the soure dirctory and enter the continer
$ docker run -v /home/lmj/project/mygithub/crawl:/root/crawl -i -t lmj/pinbot-crawl /bin/bash
# # install the packages crawl
# cd /root/crawl
# python3 setup.py build
# python3 setup.py install
# # the dependencies requests is install error


# create a new terminal then download the requests packages into /home/lmj/project/mygithub/crawl
$ cd /home/lmj/project/mygithub/crawl
$ wget https://github.com/kennethreitz/requests/archive/master.zip
$ unzip master.zip 
$ now change to the container


# # install the requests
# cd requests-master
# python3 setup.py install
# cd ..


# # reinstall crawl
# python3 setup.py install
# # that is install success


# # now exit the container and commit it
# exit 
$ docker ps -a 
$ docker commit  f417f9219cd3 lmj/pinbot-crawl


$ # now we are install the base packages crawl


$ # install the mysql support
$ # prepare
$ cd /tmp
$ wget https://launchpad.net/oursql/py3k/py3k-0.9.3/+download/oursql-0.9.3.zip
$ unzip oursql-0.9.3.zip
$ # mount the /tmp for container
$ docker run -v /tmp:tmp -i -t lmj/pinbot-crawl /bin/bash
# apt-get install libmysqlclient-dev
# cd /tmp 
# cd oursql-0.9.3
# python3 setup.py build
# python3 setup.py install
# exit
$ docker ps -a
$ docker commit 73e82505f0b4 lmj/pinbot-crawl


$ # install python3-memcached
$ docker run -i -t lmj/pinbot-crawl /bin/bash
# easy_install3 python3-memcached
# exit
$ docker ps -a
$ docker commit d3b0f503a8fe lmj/pinbot-crawl


$ # gearman client
$ cd /tmp
$ wget http://cython.org/release/Cython-0.19.1.tar.gz
$ tar xvf  Cython-0.19.1.tar.gz
$ wget https://github.com/Lupino/py3k-gearman/archive/master.zip
$ unzip master.zip
$ docker run -v /tmp:tmp -i -t lmj/pinbot-crawl /bin/bash
# cd /tmp
# cd Cython-0.91.1
# python3 setup.py build
# python3 setup.py install
# cd ../py3k-gearman-master
# python3 setup.py build
# python3 setup.py install
# apt-get clean
# exit
$ docker ps -a
$ docker commit c25330ffe62c lmj/pinbot-crawl

转载于:https://my.oschina.net/lmjubuntu/blog/151754

相关文章:

  • Express简介
  • Spring源码剖析依赖注入实现
  • Linux中关机命令详解
  • 迷茫的时候就看看这100句,希望对你有所启发
  • 洛谷 P1855 榨取kkksc03 (二维费用背包)
  • 我的前端工具集(一)日期时间转换工具
  • Html5之Web存储
  • linux用户与权限
  • Java I/O
  • python大佬养成计划----difflib模块
  • 都别说工资低了,我们来一起写简单的dom选择器吧!
  • grandstack graphql 工具基本试用
  • wamp配置多域名虚拟目录
  • html的进一步了解(更新中···)
  • 在Win7上安装MySql5.2遇到Write configuration file的解决
  • 【399天】跃迁之路——程序员高效学习方法论探索系列(实验阶段156-2018.03.11)...
  • Akka系列(七):Actor持久化之Akka persistence
  • - C#编程大幅提高OUTLOOK的邮件搜索能力!
  • ES学习笔记(10)--ES6中的函数和数组补漏
  • If…else
  • Java的Interrupt与线程中断
  • Laravel 中的一个后期静态绑定
  • Python中eval与exec的使用及区别
  • React-flux杂记
  • Redis的resp协议
  • Shadow DOM 内部构造及如何构建独立组件
  • Windows Containers 大冒险: 容器网络
  • 对象管理器(defineProperty)学习笔记
  • 设计模式走一遍---观察者模式
  • 小试R空间处理新库sf
  • ​TypeScript都不会用,也敢说会前端?
  • #每天一道面试题# 什么是MySQL的回表查询
  • (1)(1.13) SiK无线电高级配置(五)
  • (1)Map集合 (2)异常机制 (3)File类 (4)I/O流
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第5节(封闭类和Final方法)
  • (Redis使用系列) SpirngBoot中关于Redis的值的各种方式的存储与取出 三
  • (solr系列:一)使用tomcat部署solr服务
  • (附源码)springboot码头作业管理系统 毕业设计 341654
  • (十六)串口UART
  • ... 是什么 ?... 有什么用处?
  • .NET 3.0 Framework已经被添加到WindowUpdate
  • .Net Redis的秒杀Dome和异步执行
  • .NET 除了用 Task 之外,如何自己写一个可以 await 的对象?
  • .NET 使用配置文件
  • .net连接MySQL的方法
  • @SuppressWarnings(unchecked)代码的作用
  • @Transaction注解失效的几种场景(附有示例代码)
  • @基于大模型的旅游路线推荐方案
  • [《百万宝贝》观后]To be or not to be?
  • [ARC066F]Contest with Drinks Hard
  • [C# 网络编程系列]专题六:UDP编程
  • [c++] 什么是平凡类型,标准布局类型,POD类型,聚合体
  • [C++数据结构](31)哈夫曼树,哈夫曼编码与解码
  • [CQOI 2010]扑克牌
  • [C语言]——函数递归