Categories: Ubuntu 18.04

How to Install Swift on Ubuntu 18.04 LTS

Swift is a safe, fast, expressive general-purpose programming language build for the software design patterns. It is best for the systems programming, to mobile and desktop applications. Swift provides a large number of features that make programming easier while giving the developer the control needed in a true systems programming language.

This tutorial will help you to install swift programming language on your Ubuntu 18.04 LTS Bionic Linux system.

Step 1 – Prerequisites

Login to your Ubuntu 18.04 system using SSH (Shell) access. Now install the required dependencies for swift installation on your system.

sudo apt-get install clang

For the new Ubuntu 18.04 installation, I also needed to install following packages to work swift properly.

sudo

Sponsored
apt-get install libcurl3 libpython2.7 libpython2.7-dev

Step 2 – Install Swift Ubuntu 18.04

Now, you need to download the latest available swift release from its official site. You can use below command to download Swift 4.2.1 on the Ubuntu 18.04 Bionic system.

wget https://swift.org/builds/swift-4.2.1-release/ubuntu1804/swift-4.2.1-RELEASE/swift-4.2.1-RELEASE-ubuntu18.04.tar.gz

Then extract the downloaded archive

tar xzf swift-4.2.1-RELEASE-ubuntu18.04.tar.gz
sudo mv swift-4.2.1-RELEASE-ubuntu18.04 /usr/share/swift

Also, configure the swift binary to system’s PATH environment variable.

Sponsored
echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc
source  ~/.bashrc

Step 3 – Verify Swift Version

Use the following command to check the current installed Swift version on your system.

swift --version

Swift version 4.2.1 (swift-4.2.1-RELEASE)
Target: x86_64-unknown-linux-gnu

Step 4 – Swift REPL Examples

Just type swift on your system console and you will get Swift console. You can use this console for quick operations and for the learning purpose.

swift

Welcome to Swift version 4.2.1 (swift-4.2.1-RELEASE). Type :help for assistance.
  1>

Now, run some sample commands to test the console running properly.

The post How to Install Swift on Ubuntu 18.04 LTS appeared first on TecAdmin.

Go to Source
Author: Rahul

Ubuntu Server Admin

Recent Posts

Canonical announces 12 year Kubernetes LTS

Canonical’s Kubernetes LTS (Long Term Support) will support FedRAMP compliance and receive at least 12…

15 hours ago

Ubuntu Weekly Newsletter Issue 878

Welcome to the Ubuntu Weekly Newsletter, Issue 878 for the week of February 2 –…

1 day ago

How your feedback shapes the way we support open source software

At Canonical, we firmly believe that delivering an outstanding, customer-centric support experience is impossible without…

2 days ago

How To Install osTicket v1.14 On Ubuntu 20.04

I want to share how to install osTicket v1.14 for Ubuntu 20.04 server. osTicket written…

3 days ago

How To Install WordPress On Ubuntu 20.04

Now I want to share how to install WordPress on ubuntu 20.04 server. WordPress is…

3 days ago

How To Install DNS Server (Bind9) On Ubuntu 20.04

Now I want to share the DNS server installation process on your Ubuntu 20.04 server.…

3 days ago