Categories: CentOSLinuxShell

How to install Swift Programming Language on CentOS 8

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

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.

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:

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:

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

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

$ sudo systemctl enable --now snapd.socket

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.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago