Last active
April 10, 2020 17:03
-
-
Save linuxbiekaisar/58eebb2c7ed6ac0b2e009ab102387e1c to your computer and use it in GitHub Desktop.
How to install swift and create vapor app after install vapor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Youtube: | |
# !/bin/sh | |
# Installation of Swift and Vapor on Ubuntu 18.04 : | |
# Swift Installation | |
# ================== | |
# Update System repository | |
sudo apt-get update | |
# Install clang and libicu-dev | |
sudo apt-get install clang libicu-dev libpython2.7 | |
# Download the Swift files | |
wget https://swift.org/builds/swift-5.1.2-release/ubuntu1804/swift-5.1.2-RELEASE/swift-5.1.2-RELEASE-ubuntu18.04.tar.gz | |
# Verify key | |
gpg --keyserver hkp://pool.sks-keyservers.net \ | |
--recv-keys \ | |
'7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD' \ | |
'1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F' \ | |
'A3BA FD35 56A5 9079 C068 94BD 63BC 1CFE 91D3 06C6' \ | |
'5E4D F843 FB06 5D7F 7E24 FBA2 EF54 30F0 71E1 B235' \ | |
'8513 444E 2DA3 6B7C 1659 AF4D 7638 F1FB 2B2B 08C4' \ | |
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561' \ | |
'8A74 9566 2C3C D4AE 18D9 5637 FAF6 989E 1BC1 6FEA' | |
# Download swift .sig file | |
wget https://swift.org/builds/swift-5.1.2-release/ubuntu1804/swift-5.1.2-RELEASE/swift-5.1.2-RELEASE-ubuntu18.04.tar.gz.sig | |
# Now extact downloaded swift file | |
tar xzf swift-5.1.2-RELEASE-ubuntu18.04.tar.gz | |
# Move swift folder to /usr/share/swift | |
sudo mv swift-5.1.2-RELEASE-ubuntu18.04 /usr/share/swift | |
# Add absolute path for extracting binary files | |
echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc | |
# Run this command or restart the terminal after closing it | |
source ~/.bashrc | |
# Check swift version | |
swift --version | |
# Enter and exit into the swift enviroment. | |
swift | |
:exit | |
# Vapor Installation | |
# ================== | |
# Install Swift’s prerequisites | |
sudo apt-get install software-properties-common python-software-properties | |
# If problem persist on "gzip: stdin: unexpected end of file tar: Unexpected EOF in archive tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now" then run the command and then run the previous command | |
sudo apt --fix-broken install python-pycurl python-apt | |
# Download the latest vapor PGP key into keyring | |
wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | sudo apt-key add - | |
echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vapor.list | |
# Update system repository | |
sudo apt-get update | |
# Now install vapor | |
sudo apt-get install swift vapor | |
# Vapor App creation | |
# ================== | |
# Create vapor app | |
vapor new demo --template=web | |
# Enter into the demo app folder | |
cd demo | |
# Now build and run the vapor app | |
vapor build | |
vapor run serve | |
# Now open browser and check http://localhost:8080 and enojoy your app is run on localhost. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment