Server-Side-Swift

by jono
7 deployments · 2 still active · last rev. 2 months ago

Creation of a ready-to-go server side Swift 3.0.2 deployment

Compatible with: Ubuntu 16.04 LTS
						#!/bin/bash

## https://www.linode.com/stackscripts/view/1-linode-StackScript+Bash+Library
source <ssinclude StackScriptID="1">

system_update
goodstuff


apt-get update
apt-get install unzip


WEBLOC=https://swift.org/builds/swift-3.0.2-release/ubuntu1604/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu16.04.tar.gz
SWIFTNAME=$(basename $WEBLOC)
MYDIR=$(dirname $0)
MYNAME=$(basename $0)
MYSUM=$(md5sum $MYDIR/$MYNAME)

apt-get -y update

apt-get install -y clang pkg-config libicu-dev libpython2.7 libxml2-dev wget git libssl-dev uuid-dev libsqlite3-dev libpq-dev libmysqlclient-dev libbson-dev libmongoc-dev libcurl4-openssl-dev

sed -i -e 's/-fabi-version=2 -fno-omit-frame-pointer//g' /usr/lib/x86_64-linux-gnu/pkgconfig/mysqlclient.pc

ln -s /usr/include/libmongoc-1.0 /usr/local/include/libmongoc-1.0

echo Downloading $WEBLOC ...
wget $WEBLOC

echo Installing Swift...
gunzip < $SWIFTNAME | tar -C / -xv --strip-components 1

echo Cleaning up download...
rm $SWIFTNAME

chmod -R 755 /usr/lib/swift/
# Add to avoid the dreaded "error while loading shared libraries: libswiftCore.so: cannot open shared object file: No such file or directory"
#echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/swift/linux:/swift-3.0.2-RELEASE-ubuntu16.04/usr/lib/swift/linux:' >> /etc/environment

touch /etc/ld.so.conf.d/swift.conf
echo "/usr/lib/swift/linux" >> /etc/ld.so.conf.d/swift.conf 
ldconfig

restartServices