更新前端
WSL ~~~ 如今添加刪除組件中勾選 Windows Subsystem for Linux 而後運行bash,會提示一個連接,瀏覽器打開後會出現App Store安裝Ubuntu 再次運行bash,等待安裝完成。(或者:lxrun /install) 用zsh代替bash $ sudo apt install zsh -y $ zsh 選擇2 $ vim ~/.bashrc 在開頭輸入: if [ -t 1 ]; then exec zsh fi $ exit 之後運行bash會自動打開zsh
14316測試版中已經提供bash組件,默認關閉的,啓用的方法是先選中「開始->設置->更新和安全->針對開發人員->開發人員模式」,而後按 Win+X,F 打開「程序和功能」,點擊左側的「啓用或關閉Windows功能」,而後找到並勾選 Windows Subsystem for Linux (Beta) ,肯定後會提示重啓啓動系統。python
系統重啓完成後,按 Win+X,A 打開命令提示符(或者按 Win+R 打開運行對話框),輸入 bash 回車,第一次運行會從網上下載Ubuntu linux組件,按提示輸入y。linux
-- Beta feature -- This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here: https://aka.ms/uowterms Type "y" to continue: y Downloading from the Windows Store... 100% Extracting filesystem, this will take a few minutes... ????! ???????... root@localhost:~#
查看版本信息和分區映射:git
root@localhost:~# uname -a Linux localhost 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux root@localhost:~# cat /etc/issue Ubuntu 14.04.4 LTS \n \l root@localhost:~# ls -al /mnt total 24 drwxrwxr-x 2 root 1000 0 Apr 7 07:22 . drwxrwxr-x 2 root root 0 Apr 7 07:22 .. drwxrwxrwx 2 root root 0 Apr 7 06:58 c drwxrwxrwx 2 root root 0 Apr 7 04:59 d root@localhost:~# sudo ls /dev adss fb0 kmsg ptmx random tty urandom block input null pts shm tty0 zero root@localhost:~#
注意是root用戶,/dev 下也沒有不少的設備,輸入 exit 可退出bash。ubuntu
/root 目錄對應Windows系統的 %localappdata%\lxss\root 文件夾(注意,不要刪除lxss目錄,bash會失敗)。swift
若是不幸刪除了lxss或者其餘緣由 bash 啓動失敗。能夠在CMD裏用下面兩條命令卸載再從新安裝:vim
echo y|lxrun /uninstall echo y|lxrun /install更新linux子系統,在CMD裏運行:瀏覽器
lxrun /update // 更新linux子系統 // - 或者 - lxrun /update /critical // 只更新關鍵更新,更新完成後會強制關閉linux進程
使用命令 apt-get 安裝軟件前建議先在 /etc/apt/sources.list 文件前端添加國內的鏡像服務器, http://mirrors.163.com/ubuntu 是163的鏡像源:安全
deb http://mirrors.163.com/ubuntu trusty main restricted universe multiverse deb http://mirrors.163.com/ubuntu trusty-upadates main restricted universe multi verse deb http://mirrors.163.com/ubuntu trusty-security main restricted universe multiverse
可用vi編輯:bash
vi /etc/apt/sources.list
按3yy複製原來的3行,按Shift+G到結尾,按p粘貼。輸入 :1,3s/\w*\.ubuntu/mirrors.163/ 替換前3行爲163的鏡像,Shift+ZZ保存退出。
而後用 apt-get update 命令更新源(163的更新源最後會出現一些校驗警告,能夠忽略)。
安裝 git:
apt-get --assume-yes install git
--assume-yes可選:安裝交互所有yes。
刪除用remove替換install。
自動移除:
apt-get autoremove
查詢7z軟件:
apt-cache search 7z
----
下面是安裝swift編譯環境的例子(未成功):
1. 安裝 CLang 和 libicu-dev
apt-get install clang libicu-dev
2. 下載swift發行包(到swift.org裏找ubuntu14.04平臺的版本,目前DEV快照是Swift 3.0預覽版本)
curl -O https://swift.org/builds/development/ubuntu1404/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz
注:能夠先在Windows系統中用下載工具下載好,而後用touch命令在linux文件系統裏先建立個同名的文件
root@localhost:~# touch swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz
而後再用Windows進行文件複製,覆蓋到 %localappdata%\lxss\root 文件夾裏。
3. 解壓tar.gz包。
tar xzf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz
若是產生了以下錯誤:
root@localhost:~# tar zxf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.ta r.gz tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/swift-autolink-extract: Cannot create symlink to ‘swift’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/swiftc: Cannot create symlink to ‘swift’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb-server: Cannot create symlink to ‘lldb-server-3.9.0’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb: Cannot create symlink to ‘lldb-3.9.0’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb-mi: Cannot create symlink to ‘lldb-mi-3.9.0’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/liblldb.so: Cannot create symlink to ‘liblldb.so.3.9.0’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/python2.7/site-packages/lldb/_lldb.so: Cannot create symlink to ‘../../../../lib/liblldb.so’: Invalid argument tar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/python2.7/site-packages/lldb/lldb-argdumper: Cannot create symlink to ‘../../../../bin/lldb-argdumper’: Invalid argument tar: Exiting with failure status due to previous errors
改用7z來解壓,設置可執行權限。
rm -rf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04 apt-get install p7zip-full 7z x swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz 7z x swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar rm swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar chmod +x /root/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/*
4. 配置環境變量,編輯 ~/.bashrc 文件,結尾加入
export PATH=/root/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin:"${PATH}"
5. 從新載入配置,查看結果:
root@localhost:~# source ~/.bashrc root@localhost:~# swift --version Swift version 3.0-dev (LLVM b010debd0e, Clang 3e4d01d89b, Swift 7182c58cb2) Target: x86_64-unknown-linux-gnu root@localhost:~#
6. 目前仍不能進入REPL環境或者編譯swift文件。
編譯錯誤:
<unknown>:0: error: could not load the swift standard library