Windows 10预览版14316开启Linux Bash命令行

Windows 10预览版14316开启Linux Bash命令行

-- 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:~#

查看版本信息和分区映射:

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:~#

如果不幸删除了lxss或者其他原因 bash 启动失败。可以在CMD里用下面两条命令卸载再重新安装:

echo y|lxrun /uninstall
echo y|lxrun /install

更新linux子系统,在CMD里运行:

lxrun /update                    // 更新linux子系统
// - 或者 -
lxrun /update /critical          // 只更新关键更新,更新完成后会强制关闭linux进程
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编辑:

vi /etc/apt/sources.list

安装 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

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/*
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

猜你喜欢

转载自www.linuxidc.com/Linux/2016-04/130163.htm
今日推荐