Since Apple released Swift to open source last year, there's been a grass roots movement to begin building a server-side ecosystem around Swift.
Before doing any server-side development with Swift, though, it needs to be installed first!
Below are the steps I took to install Swift 3.0 on my AWS EC2-based Ubuntu 16 LTS development server:
Swift has a couple base dependencies needed for it to run on Linux.
sudo apt-get install clang libicu-dev
Download pre-compiled binaries
As of this writing, apt-get on Ubuntu 16 didn't catalog Swift 3.0, so I downloaded the precompiled binary. Also, the Ubuntu 16.04 binary available was from the 3.0.1 Preview distribution. So don't use the links I have here directly -- go to the Swift Download Page and check for the latest Release distribution (if available) for your Ubuntu version.
$ wget https://swift.org/builds/swift-3.0.1-preview-1/ubuntu1604/swift-3.0.1-PREVIEW-1/swift-3.0.1-PREVIEW-1-ubuntu16.04.tar.gz
Extract the tar file
$ tar -xvf swift-3.0.1-PREVIEW-1-ubuntu16.04.tar.gz
Move swift into a production folder
$ sudo mkdir /opt/swift/swift-3.0 $ mv swift-3.0.1-PREVIEW-1-ubuntu16.04/usr /opt/swift/swift-3.0
For a discussion of why swift is placed under /opt, refer to this discussion thread.
Add swift to the ~/.profile path
Add the following to the tail of ~/.profile
Either logout/login, or refresh the profile:
Check that swift is available on the path and will run
$ cd ~ $ swift --version Swift version 3.0 (swift-3.0.1-PREVIEW-1) Target: x86_64-unknown-linux-gnu
With that, the basic install of Swift is ready to go for utility scripts or server-side development.