zoukankan      html  css  js  c++  java
  • ubuntu配置 测试环境 记录

    1  更新源

    进入 /etc/apt/sources.list

    sudo vim进入,

    更改为如下源

    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## universe WILL NOT receive any review or updates from the Ubuntu security
    ## team.
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
    # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse


    deb http://security.ubuntu.com/ubuntu xenial-security main restricted
    # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
    deb http://security.ubuntu.com/ubuntu xenial-security universe
    # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
    deb http://security.ubuntu.com/ubuntu xenial-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

    更新源后,sudo-apt-get update

    2 安装chrome

      安装谷歌浏览器,只需要三行代码: 

    打开终端,输入 
    cd /tmp 
    对于谷歌Chrome32位版本,使用如下链接:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

    对于64位版本可以使用如下链接下载:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 
    下载完后,运行如下命令安装。

    sudo dpkg -i google-chrome*; sudo apt-get -f install 

    3 下载对应浏览器版本的chromedriver,并拷贝到/usr/bin目录下

       ubuntu上传下载:

       http://www.linuxidc.com/Linux/2017-06/145191.htm

        1.第一种方法是最常用的 :如果下载了Xshell和Xftp,Ctrl+Alt+F就可以选择文件的互传了!(虚拟机/云服务器通用)--只要相互间能ping得通。

         2 

      第二种方法 :ubuntu环境下安装lrzsz,具体命令是--->      sudo apt-get install lrzsz      (如果是root权限就不用加sudo) 

      安装完毕后,具体操作命令是:   sz 【file】 --->可将服务器的文件下载到本地,

    (1)比如要把ubuntu上的urls.txt下载到本地, 

    那么我只要输入sz urls.txt回车,就能选择下载到本地哪个路径下。

    (2)比如要把本地文件上传到ubuntu上,只需输入 rz 命令回车就会弹出本地路径窗口:

    4 安装pip 

    sudo apt-get install python-pip

    5 安装 virtualenv

    用virtualenv建立虚拟环境 py3env

    6激活虚拟环境

    source py3env/bin/activate

    7在虚拟环境中安装必备python包,

    configparser,selenium

    pip install -r requirements.txt

    8将测试代码 拷贝至code目录下

    9 安装tmux  sudo apt-get install tmux 

     10 启动新的tmux窗口,开启py3env虚拟环境,注意chromedriver中options要添加正确,不然chrome启动失败

  • 相关阅读:
    利用crontab每天定时备份MySQL数据库
    MySQL基本SQL语句之数据插入、删除数据和更新数据
    Vim命令合集
    ubuntu下手动安装php-amqp模块教程
    变量作用域(总结篇)
    变量作用域(示例篇)
    定义一个函数
    正则表达式
    re模块中常用功能函数
    python内置函数
  • 原文地址:https://www.cnblogs.com/xqnq2007/p/8119600.html
Copyright © 2011-2022 走看看