Swift is a modern general-purpose, open-source, and high-performing compiled programming language. It was developed by Apple for iOS application development and released in 2014. However, it can also be used for cloud service, systems programming, and design more other applications. Swift language is used as a replacement for the older language such as Objective-C. As compared to python, users can easily learn and understand Swift programming language. It provides more security, is easier to use, provides good performance, and allows users to write safe but strict code. We will show you 2 methods to install Swift programming language on CentOS 8 in this article.

If you want to install Swift language on Ubuntu 20.04 distribution, you can install it using this link install Swift on Ubuntu 20.04.

Prerequisites

Use sudo privileges or administrative root account to install swift programming language on CentOS 8.

Installation of Swift programming Language on CentOS 8

Using the following two different methods, a swift computer programming language can install on CentOS 8 system:

Method 1: Install Swift Programming Language using yum repository

Before installing swift, several dependencies must be installed on the CentOS 8 system. As a result, by running the command below, these needed packages will be installed automatically on your system:

$ sudo yum install swift-lang

How to install Swift Programming Language on CentOS 8 centos linux shell

After running the above-given command, all required dependent packages will install automatically on the system. Press ‘y’ and then hit ‘Enter’ to install all required dependencies.

How to install Swift Programming Language on CentOS 8 centos linux shell

The installation of swift will complete in several minutes on the system.

Check Installed Swift Version

Once the installation of Swift is completed, check the installed version by using the below-given command:

$ sudo swift -version

The installed swift version display on the terminal window is as follows:

How to install Swift Programming Language on CentOS 8 centos linux shell

Use Swift on CentOS 8

Start the swift programming language by displaying a message on the terminal window. Execute the below-mentioned command:

$ swift

Check if the swift is installed and properly works on your system, display the following message on the terminal screen using the print statement as follows:
> print(“Welcome to the LinuxWays: How to install swift on CentOS 8”)

The following output should display on the terminal:

How to install Swift Programming Language on CentOS 8 centos linux shell

Method 2: Install Swift Programming Language Using Snap 

An alternative method is also available for the Swift language installation on CentOS 8. Using a snap application, you can install swift on your system. So, install the snapd by executing the command, which is mentioned below:

$ sudo yum install snapd

How to install Swift Programming Language on CentOS 8 centos linux shell

Now, enable the snapd by executing the below-mentioned command:

$ sudo systemctl enable --now snapd.socket

How to install Swift Programming Language on CentOS 8 centos linux shell

Create symbolic link of snap by using the following command:

$ sudo ln -s /var/lib/snapd/snap /snap

Now, install swift-lang via snap by executing the below-mentioned command:

$ sudo snap install swift-lang --edge

Conclusion

The installation of Swift programming language on CentOS 8 is demonstrated in this article. We have discussed two different methods: installing swift via the yum repository and installing swift using the snap application. Thanks! For installing Swift on your system. If you want to get more details about the Swift programming language then, visit its official swift website.