windows下安裝虛擬機(jī)

放棄了收費(fèi)的vmware,使用開源的VirtualBox

1. 下載VirtualBox和ubuntu鏡像

  • VirtualBox下載地址,選擇windows版本安裝,安裝完成后如下圖所示
  • 從騰訊云下載ubuntu鏡像下載地址, 在ubuntu-release中選擇20.01版本的iso文件,系統(tǒng)鏡像分為server和desktop版本,如果不需要GUI可以下載server版本。

2. 新建ubuntu虛擬機(jī)

  • 在virtualbox頁面點(diǎn)擊 新建 ,設(shè)置虛擬機(jī)的操作系統(tǒng)和名稱,文件夾選擇默認(rèn)路徑
  • 點(diǎn)擊下一步給虛擬機(jī)分配內(nèi)存大小,這個(gè)值可以創(chuàng)建后修改
  • 默認(rèn)現(xiàn)在創(chuàng)建虛擬硬盤,選擇VDI和動(dòng)態(tài)分配
  • 這里給虛擬機(jī)分配20G的硬盤,點(diǎn)擊創(chuàng)建。

3. 添加iso文件

  • 創(chuàng)建完虛擬機(jī)后需要將下載的ubuntu系統(tǒng)裝在虛擬機(jī)上,點(diǎn)擊設(shè)置,選擇存儲(chǔ)準(zhǔn)備添加ubuntu鏡像
  • 點(diǎn)擊右上角藍(lán)色按鈕,選擇虛擬盤, 選中下載好的iso文件,OK后啟動(dòng)虛擬機(jī)。

4. 安裝操作系統(tǒng)

  • 進(jìn)入虛擬機(jī)選擇 install ubuntu,不然每次啟動(dòng)都會(huì)從iso文件重新讀取,系統(tǒng)內(nèi)的文件會(huì)清除,然后根據(jù)自定義安裝,設(shè)置用戶名和密碼即可。

5. 開放端口

  • 在設(shè)置-網(wǎng)絡(luò)中點(diǎn)擊端口轉(zhuǎn)發(fā)
  • 在這里開放了es、neo4j 和django服務(wù)的端口

3. 安裝Conda環(huán)境

  • 1. 需要安裝wget和下載Miniconda安裝包,如果下載過慢百度云地址
sudo apt update
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
  • 2. 一直回車并'yes'即可,添加配置信息到隱藏文件bashrc并運(yùn)行或者重啟,就可以使用conda了
source ~/.bashrc
conda --version
conda create -n test python=3.6
conda activate test
conda deactivate test
conda env list
  • 3. 更換apt源和conda源

在安裝系統(tǒng)應(yīng)用的時(shí)候,從國(guó)外下載速度會(huì)很慢,需要更換國(guó)內(nèi)源。

# 首先備份配置文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 編輯文件
sudo vim /etc/apt/sources.list 
# 將阿里云地址放在文件頭部
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
# 更新和升級(jí)
sudo apt update
sudo apt upgrade

在利用conda創(chuàng)建虛擬環(huán)境的時(shí)候速度特別慢,更換成清華源遇到了一些坑,如果更換清華源還是慢可以使用pip 安裝

conda config --show-sources # 查看conda源
# ~/.condarc 文件位置
# 恢復(fù)默認(rèn)的conda源
conda config --remove-key channels

更換成清華源,執(zhí)行一下命令,如果創(chuàng)建虛擬環(huán)境失敗,可以進(jìn)入鏡像地址,在路徑上加入linux-64(win-64)。打開condarc文件可以看到清華源的配置,如果有-default,那么必須刪除它,并將網(wǎng)址改成http,現(xiàn)在就可以創(chuàng)建虛擬環(huán)境了。

conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

# 最終的condarc文件
ssl_verify: true
show_channel_urls: true

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
  • 在安裝postgresql數(shù)據(jù)庫的時(shí)候,報(bào)錯(cuò):
sh: 1: lsb_release: not found
# 解決方法:
apt-get update && apt-get install -y lsb-release && apt-get clean all
# 如果顯示:
E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)
E: The list of sources could not be read.
# 依次執(zhí)行:
rm /etc/apt/sources.list.d/ros-latest.list 
apt-get update && apt-get install -y lsb-release && apt-get clean all
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容