1. 程式人生 > >ubuntu配置 測試環境 記錄

ubuntu配置 測試環境 記錄

ctrl ive 本地文件 version note some 虛擬環境 div provide

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

ubuntu配置 測試環境 記錄