DebianDebian Based

How To Install Swift Programming Language on Debian 12

Install Swift Programming Language on Debian 12

In this tutorial, we will show you how to install Swift Programming Language on Debian 12.  Swift is a powerful and intuitive programming language developed by Apple for iOS, macOS, watchOS, and beyond. It’s designed to give developers more freedom than ever before. Swift is easy to use and open source, so anyone with an idea can create something incredible.

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 the step-by-step installation of the Swift Programming Language on a Debian 12 (Bookworm).

Prerequisites

  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • You will need an active internet connection to download the Swift Programming Language package.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Swift Programming Language on Debian 12 Bookworm

Step 1. Before installing any new software, it’s a good practice to update the system packages. Keeping your system packages up-to-date ensures that you have the latest updates, security patches, and bug fixes. This not only enhances the performance of your system but also ensures its security:

sudo apt update
sudo apt upgrade

Next, install a few prerequisite packages that let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Step 2. Installing Docker on Debian 12.

With the environment prepared, let’s move on to the installation process. Now we import the Docker repository’s GPG key:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the Docker repository to the package manager:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Now that the repository is added and the signing key is imported, we can proceed with the installation of Docker. Execute the following command:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

After Docker installation, ensure that it has been successfully set up by running a check on the Docker version:

docker version

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

Step 3. Installing Swift Programming Language on Debian 12.

Docker images are lightweight, standalone, and executable software packages that include everything needed to run a piece of software. Docker Hub is a cloud-based registry service that allows you to link to code repositories, build your images, and test them, store manually pushed images, and link to Docker Cloud. To pull the Swift Docker image from Docker Hub, use the following command:

docker pull swift

After the command completes, you can verify that the Swift Docker image has been pulled successfully by listing the Docker images:

docker images

To create a Docker container using the Swift image, use the following command:

docker run -it --name swift-container swift /bin/bash

This command creates and starts a Docker container named “swift-container” using the “swift” image. The “-it” option tells Docker to allocate a pseudo-TTY connected to the container’s stdin; creating an interactive bash shell in the container.

Now that you have a Docker container with Swift, you can verify the Swift installation by running Swift in the Docker container. Use the following command to start the Swift REPL (Read-Eval-Print-Loop):

swift

You can also verify the Swift version and successful installation by using the following command:

swift --version

Congratulations! You have successfully installed Swift. Thanks for using this tutorial to install the latest version of Swift Programming Language on Debian 12 Bookworm. 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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button