在Ubuntu上安装Swift

我尝试在Ubuntu 16.04上安装Swift 3.1.1。

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
$ sudo apt-get install -y clang libicu-dev
$ curl -OR https://swift.org/builds/swift-3.1.1-release/ubuntu1604/swift-3.1.1-RELEASE/swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
$ curl -OR https://swift.org/builds/swift-3.1.1-release/ubuntu1604/swift-3.1.1-RELEASE/swift-3.1.1-RELEASE-ubuntu16.04.tar.gz.sig
$ ls -l swift-3.1.1-RELEASE-ubuntu16.04.tar.gz*
-rw-rw-r-- 1 glire glire 122709317 Apr 22 10:50 swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
-rw-rw-r-- 1 glire glire       819 Apr 22 10:50 swift-3.1.1-RELEASE-ubuntu16.04.tar.gz.sig
$ wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
$ gpg --keyserver hkp://pool.sks-keyservers.net --refresh-keys Swift
$ gpg --verify swift-3.1.1-RELEASE-ubuntu16.04.tar.gz.sig
$ sudo chmod o+rwx /opt
$ mv -i swift-3.1.1-RELEASE-ubuntu16.04.tar.gz /opt/
$ cd /opt/
$ tar xvfz swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
$ ls -l
total 119840
drwxrwxr-x 3 glire glire      4096 May 30 11:22 swift-3.1.1-RELEASE-ubuntu16.04
-rw-rw-r-- 1 glire glire 122709317 Apr 22 10:50 swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
$ rm -f swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
$ sudo chmod o-w /opt 
$ export PATH=/opt/swift-3.1.1-RELEASE-ubuntu16.04/usr/bin:$PATH
$ which swift
/opt/swift-3.1.1-RELEASE-ubuntu16.04/usr/bin/swift
$ swift --version
Swift version 3.1.1 (swift-3.1.1-RELEASE)
Target: x86_64-unknown-linux-gnu
$ swift
Welcome to Swift version 3.1.1 (swift-3.1.1-RELEASE). Type :help for assistance.
  1> ^D
广告
将在 10 秒后关闭
bannerAds