How to install Swift on CentOS 7

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Swift on CentOS 7.

Swift is a programming language developed by Apple. Swift is open source and cross platform, meaning you can code with Swift on any linux distro but not only. Swift is also supported by Mac and Windows.

With Swift you can code IOS and MacOS apps, so you can write and develop from mobile apps for IOS to desktop apps for MacOS.

Installing Swift on CentOS is very easy, and it can be done by adding Swift repository on the machine where you want to install it.

Step 1 - Download Swift Repository

Swift repository can be used to download and install Swift on your CentOS 7 machine. To download Swift repository you can use curl.

The command below will download Swift repository and create a new repository on your system under the /yum.repos.d directory.

curl https://download.swift.org/experimental-use-only/repo/centos/releases/7/swiftlang.repo > /etc/yum.repos.d/swiftlang.repo

Step 2 - Update your system

Now that Swift repository is added and enabled on your system, in order to be able to use this repository, you must update your system first.

To update your CentOS 7 machine, run the command below

sudo yum update

While CentOS is checking for updates, on your terminal you should be able to see the new repository that you added, once repository database is updated you can proceed to the next step to install Swift.

Step 3 - Install Swift

Now you can install Swift on your machine. To do this, simply run the command below

yum install swiftlang

Conclusion

In this tutorial, you learned how to install Swift programming language on CentOS 7.

You can now use Swift on your machine, and be able to create Swift apps.