很简单,用VMware安装就行了。
为了方便远程管理,需要安装SSH服务。
sudo apt update sudo apt install -y openssh-serverubuntu自带的firefox是51版本的,selenium需要53以上的版本的版本,需要升级一下。
sudo apt -y install firefox查看firefox版本
firefox --version Mozilla Firefox 57.0selenium只能通过pip安装,所以需要先安装pip
sudo apt -y install python3-pip从清华镜像安装selenium
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple selenium验证是否安装成功并查看版本
python3 import selenium help(selenium) Help on package selenium: NAME selenium DESCRIPTION # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. PACKAGE CONTENTS common (package) webdriver (package) VERSION 3.7.0 FILE /home/selenium/.local/lib/python3.5/site-packages/selenium/__init__.pyselenium安装成功后还要安装firefox驱动
驱动下载地址:https://github.com/mozilla/geckodriver/releases 下载完成后将驱动解压到/usr/bin
wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz tar -xzf ./geckodriver-v0.19.1-linux64.tar.gz sudo mv ./geckodriver /usr/bin/测试selenium能否正常启动firefox
python3 from selenium import webdriver test = webdriver.Firefox()同样需要使用pip安装
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter配置jupyter notebook远程访问
生成配置文件
jupyter notebook --generate-config设置密码
ipython from notebook.auth import passwd passwd()把生成的密文‘sha:ce…’复制下来
Out[2]: 'sha1:e71cc9a18431:f65****eccd3****84***********'修改默认配置文件
vi ./.jupyter/jupyter_notebook_config.py c.NotebookApp.ip='*' c.NotebookApp.password = u'sha:ce...刚才复制的那个密文' c.NotebookApp.open_browser = False c.NotebookApp.port =6789便指定一个端口启动jupyter notebook
jupyter notebook --allow-root后台启动
nohup sudo jupyter notebook --allow-root至此,ubuntu+firefox+jupyter+python3+selenium的环境搭建完成。在浏览器中输入http://ip:6789,即可访问jupyter notebook。