ubuntu搭建scapy环境
一、安装scrapy
1、sudo apt-get update
2、sudo apt-get install python-pip python-lxml python-crypto python-cssselect python-openssl python-w3lib python-twisted python-dev libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
3、sudo pip install scrapy
二、安装virtualbox
1、wget https://download.virtualbox.org/virtualbox/6.0.4/virtualbox-6.0_6.0.4-128413~Ubuntu~xenial_amd64.deb
2、sudo dpkg -i virtualbox-6.0_6.0.4-128413~Ubuntu~xenial_amd64.deb
(出现问题:sudo apt-get install libsdl1.2debian)
三、安装vagrant(虚拟机virtualbox管理工具)
1、wget https://releases.hashicorp.com/vagrant/2.2.3/vagrant_2.2.3_x86_64.deb
2、sudo dpkg -i vagrant_2.2.3_x86_64.deb
四、安装git
1、sudo apt-get update
2、sduo apt-get install git
五、安装Docker
1、sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
2、echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main"|sudo tee /etc/apt/sources.list.d/docker.list
3、sudo apt-get update
4、sudo apt-get install docker-engine
5、sudo usermod -aG docker $(whoami)
六、克隆scrapy示例项目
git clone https://github.com/scalingexcellence/scrapybook.git
七、进入目录、启动、登录
cd scrapybook
// 启动镜像(启动之前,先添加box: vagrant box add myfirstbox https://vagrantcloud.com/lookfwd/boxes/scrapybook/versions/1.0.0/providers/virtualbox.box; myfirstbox是命名,随意取名;一般网速很慢,box有的几百M,有的2-3G,建议先在windows中下载,然后拖到ubuntu的scrapybook目录下--就是vagrant up的目录)
vagrant up --no-parallel
// 登录镜像
vagrant ssh
六、七为《精通python 爬虫框架scrapy 人民邮电出版社》示例步骤
若添加box:
vagrant box add myfirstscrapy https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
参见:https://www.jianshu.com/p/ff523e7bf2f6
https://www.cnblogs.com/vikings-blog/p/3953810.html