How To Install Swift Programming Language on CentOS 8

Install Swift Programming Language on CentOS 8

In this tutorial, we will show you how to install Swift Programming Language on CentOS 8. For those of you who didn’t know, Swift is a modern open-source high-performing programming language. Mainly it is used for iOS app development but, you can use it for systems programming, cloud services, and design other applications. It was developed by Apple and released in 2014. Swift was designed as a replacement for the older Objective-C language.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step install of the Swift Programming Language on CentOS 8.

Install Swift Programming Language on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf clean all
sudo dnf update
sudo yum install epel-release
sudo dnf install clang libcu-devel

Step 2. Installing Swift Programming Language on CentOS 8.

  • Install Swift from the official website.

Now we download the Swift packages installer from the official website:

https://swift.org/builds/swift-5.3.3-release/centos8/swift-5.3.3-RELEASE/swift-5.3.3-RELEASE-centos8.tar.gz

Then, extract the downloaded file:

tar xzf swift-5.3.3-RELEASE-centos8.tar.gz
sudo mv swift-5.3.3-RELEASE-centos8 /opt/swift/usr/bin

Next, configure the swift binary to the system’s PATH environment variable:

echo 'export PATH=/opt/swift/usr/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

To make sure that swift has been installed properly, open the terminal and run the following command to check the swift version:

swift --version
  • Install Swift via Snap.

Now run the following command to install Snap packages:

sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

To install swift-lang, simply use the following command:

sudo snap install swift-lang --edge

Congratulations! You have successfully installed Swift. Thanks for using this tutorial for installing the Swift Programming Language on CentOS 8 systems. For additional help or useful information, we recommend you check the official Swift website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!