Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Install Swift and Vapor on an Ubuntu VPS

A complete Ubuntu VPS walkthrough for Swift and Vapor: secure the server, install Swiftly, optionally add the Toolbox, test an app, configure systemd, and plan an Nginx reverse proxy.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run Vapor on an Ubuntu VPS, use an Ubuntu release supported by Swift.org, create a non-root sudo user, install Swift 5.9 or newer with Swiftly, optionally install the Vapor Toolbox, build your application in release mode, and run it as a systemd service. You can expose Vapor directly for testing or place it behind Nginx for a production-facing deployment.

What you need before starting

This procedure assumes a new Ubuntu VPS and an application that uses Vapor. You need an SSH client, the server’s public IP address, and an account that can become root for the initial bootstrap. Use SSH keys rather than password-only access whenever your VPS provider allows it.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Supported operating system: Swift.org currently lists Ubuntu 22.04, 24.04, and 26.04 installation targets. Availability can change with Swift toolchain releases, so verify the target shown by Swift.org when you provision the server.
  • Swift: Vapor requires Swift 5.9 or newer.
  • Privileges: You need temporary root access to create the application user, configure UFW, and install the systemd unit.
  • Resources: Choose CPU, memory, and storage based on your application and traffic. The supplied deployment material does not establish a universal minimum VPS size.

The commands below use a user named vapor, an example project named HelloWorld, and a service named hello.service. Substitute your own names consistently.

Choose an Ubuntu release and connect securely

Pick one of the Ubuntu releases currently presented as supported by Swift.org. Ubuntu 22.04 LTS is used in the documented VPS example, while 24.04 and 26.04 are also shown as installation targets. “Supported” here means the Swift installation path has a corresponding target; it does not guarantee that every third-party package or your application dependency has identical support.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Log in for the initial bootstrap

ssh root@your_server_ip

Replace your_server_ip with the VPS address. Keep this root session open until you have tested a new SSH connection as the non-root user.

Allow SSH before enabling UFW

UFW blocks incoming traffic once enabled unless a rule exists. Add the OpenSSH rule first, then enable the firewall:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ufw allow OpenSSH
ufw enable

Confirm the prompt when UFW warns that enabling it may interrupt existing connections. Because OpenSSH is allowed first, the current SSH session should remain reachable.

Create a dedicated administrator

adduser vapor
usermod -aG sudo vapor
rsync --archive --chown=vapor:vapor ~/.ssh /home/vapor

The first command creates the account and asks for a password and optional profile information. The second grants sudo access. The rsync command copies the root account’s SSH configuration and changes ownership so the new user can authenticate with the same authorized keys. If your provider uses a different key-delivery mechanism, copy the authorized key into /home/vapor/.ssh/authorized_keys and set ownership and permissions appropriately.

Reconnect as the application user

exit
ssh vapor@your_server_ip

After this connection succeeds, use sudo for administrative operations and keep application files owned by vapor. Avoid running the Vapor process as root.

Install Swift with Swiftly

Vapor’s Linux documentation recommends Swiftly, Swift’s toolchain manager, rather than manually downloading and switching archives. Follow Swiftly’s current Linux installation instructions for your Ubuntu release; the installer details can change as Swiftly evolves. Once Swiftly is available in the shell, install the latest stable toolchain:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
swiftly install latest
swift --version

The version output should identify a Swift release and a Linux target. Confirm that the major/minor release is at least 5.9 before creating or compiling a Vapor project. If the shell says swift is not found immediately after installation, start a new SSH session or load the shell configuration that Swiftly added, then repeat the version check.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Why the toolchain choice matters

Vapor’s stated floor is Swift 5.9. A newer Swift release can be appropriate, but your project’s package dependencies may impose a narrower range. Check the project’s Package.swift and lock the toolchain used for deployment if repeatable builds are important. Installing “latest” is convenient for a fresh server; a production team may instead select a tested Swiftly toolchain after confirming compatibility.

Install the Vapor Toolbox only if you need it

The Toolbox is optional for running an existing project. You need Swift and the project’s Swift Package Manager dependencies either way. Toolbox commands are useful when you want to generate a new application, inspect help, or use Vapor’s project workflows.

Install with Homebrew

brew install vapor
vapor --help

This is the shortest documented route when Homebrew is already present on the VPS. Homebrew itself is not required by Vapor, so do not add it solely to run an existing application unless you want the Toolbox commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a pinned Toolbox release from source

On a server without Homebrew, the documented DigitalOcean example builds the Toolbox from source and checks out version 18.6.0:

git clone https://github.com/vapor/toolbox.git
cd toolbox
git checkout 18.6.0
swift build -c release --disable-sandbox --enable-test-discovery
sudo mv .build/release/vapor /usr/local/bin
vapor --help

Version 18.6.0 is an example from that guide, not a promise that it is the right release for your deployment. Review the Toolbox release list and choose the version you intend to operate. Building from source also means the VPS needs the tools required to clone and compile the repository.

Approach When it fits Trade-off
Homebrew installation Homebrew is already installed and you want the quickest Toolbox setup. Adds dependence on Homebrew’s package path and update process.
Source build You want a pinned Toolbox release or do not use Homebrew. Requires cloning, compiling, and choosing a release deliberately.
No Toolbox You are deploying an existing Vapor project. You must create, build, and operate the project without Toolbox helpers.

Create and smoke-test a Vapor application

Use the Toolbox to generate a bare project, or copy an existing project onto the VPS. The documented example creates HelloWorld:

vapor new HelloWorld -n
cd HelloWorld
sudo ufw allow 8080
swift run App serve --hostname 0.0.0.0 --port 8080

The -n option selects the non-interactive form of project creation. The firewall rule permits the example port. Binding to 0.0.0.0 makes the development server listen on all IPv4 interfaces, which allows a remote smoke test but also exposes the development listener directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

From another machine, test the sample endpoint:

curl http://your_server_ip:8080

The official example expects the response It works!. Stop the foreground process with Ctrl+C after the test. Do not treat swift run as your production supervisor: it is useful for development and verification, but it ends when the terminal session ends.

Do not expose the test port unnecessarily

If you will place the application behind a reverse proxy, the public firewall should ultimately expose only the ports required by that proxy and administration. The port-8080 rule is useful for the documented smoke test; remove it when direct public access is no longer needed:

sudo ufw delete allow 8080

Keep the application’s internal listening port consistent with the service configuration and any proxy configuration you later add.

Build a release executable

Before creating the service, compile the project in release mode from its root directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
swift build -c release

The resulting executable is placed under .build/release. In the documented project layout, the executable is named App, so the service will run .build/release/App. If your package defines a different executable product, use that actual filename in ExecStart. A frequent deployment error is copying the unit unchanged while the project or executable has a different name.

Run a release smoke test before registering systemd if you want to isolate build problems from service-manager problems:

.build/release/App serve --env production

Stop it with Ctrl+C after confirming that it starts. The production environment flag disables verbose logging according to Vapor’s systemd guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Keep Vapor running with systemd

Systemd is the default system and service manager on most Linux distributions. A separate unit per application gives you automatic restarts, boot-time startup, a stable working directory, and a standard place to inspect status and logs.

Create the unit file

Create /etc/systemd/system/hello.service with root privileges:

sudo nano /etc/systemd/system/hello.service

Paste the following and change the description, user, group, working directory, executable path, and service name to match your deployment:

[Unit]
Description=Hello
Requires=network.target
After=network.target

[Service]
Type=simple
User=vapor
Group=vapor
Restart=always
RestartSec=3
WorkingDirectory=/home/vapor/hello
ExecStart=/home/vapor/hello/.build/release/App serve --env production
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=vapor-hello

[Install]
WantedBy=multi-user.target

Check the paths carefully

  • WorkingDirectory must be the project root containing Package.swift.
  • ExecStart must point to the release executable, not the source tree’s debug binary.
  • User and Group should own or be able to read the project and its build output.
  • Restart=always and RestartSec=3 cause systemd to retry a process that exits, including one that exits because of a configuration error. Fix the underlying error rather than relying on repeated restarts.

Load, enable, and start the service

sudo systemctl daemon-reload
sudo systemctl enable hello
sudo systemctl start hello
sudo systemctl status hello

enable schedules the service for future boots; start launches it now. Read the status output for the active state and the most recent failure. If you edit the unit later, run daemon-reload again and restart the service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Supply configuration and secrets

The systemd guidance supports an environment file or inline variables. An environment file keeps deployment settings out of the unit’s command line:

[Service]
EnvironmentFile=/etc/hello/hello.env

Create the file with permissions that prevent untrusted users from reading secrets, and include only the variables your application expects. For a small, non-secret setting, an inline entry is also supported:

Environment="PORT=8123"

Vapor code can read these values with Environment.get. If your application uses a port variable, ensure the value agrees with the listener expected by your proxy or firewall. After changing an environment file, restart the service so the process receives the new values.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Inspect status and logs

sudo systemctl status hello
sudo journalctl -u hello -e
sudo journalctl -u hello -f

The unit sends standard output and standard error to syslog and labels entries with vapor-hello. On systems that route syslog into the journal, journalctl -u hello is the most direct way to follow startup failures, crashes, and application messages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Decide whether to put Nginx in front of Vapor

Vapor can serve HTTP requests directly, but the documented deployment guidance says proxying behind Nginx can improve performance, security, and ease of use. Nginx is optional; systemd supervision works whether Vapor is reached directly or through a proxy.

Deployment shape Useful for What you must manage
Client → Vapor Internal services, temporary testing, or a simple controlled deployment. Vapor’s listener, public port rules, HTTP behavior, and any TLS or request-handling concerns you add yourself.
Client → Nginx → Vapor Public applications where a dedicated reverse proxy should handle the edge connection. Nginx proxy settings, domain routing, certificate configuration, public ports, and the private Vapor listener.

The retrieved deployment material does not provide a complete Nginx server block or TLS recipe. Use Nginx’s official documentation for the exact proxy and certificate configuration required by your domain rather than copying an incomplete example. Keep the Vapor service under systemd independently, so restarting Nginx does not remove process supervision for the application.

Network implications

During the smoke test, port 8080 is opened explicitly. If Nginx becomes the public entry point, design the firewall and listener arrangement so clients reach the proxy while Vapor is not unnecessarily exposed on a public interface. The precise ports and certificate steps depend on your domain and proxy design; do not assume the development rule is the final production policy.

Deploy updates without losing supervision

A repeatable update sequence prevents systemd from launching an old binary or a process with mismatched dependencies:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Connect as vapor and move to the project root.
  2. Update the source using your normal deployment method.
  3. Compile the new release with swift build -c release.
  4. Check that the release executable exists at the path in ExecStart.
  5. Restart the unit: sudo systemctl restart hello.
  6. Confirm health with sudo systemctl status hello and inspect recent logs.

If the build fails, the old service remains separate from the failed compilation. Do not delete the existing release binary until the replacement has built successfully. When changing the service file itself, run sudo systemctl daemon-reload before restarting.

Troubleshoot the common failure points

Symptom Likely cause Check or fix
swift: command not found Swiftly’s shell setup was not loaded. Start a new SSH session, load the shell configuration created by Swiftly, and run swift --version.
Swift version is below 5.9 An older toolchain is selected. Use Swiftly to install a supported toolchain, then verify the active version before building.
SSH disconnects after UFW is enabled OpenSSH was not allowed first. Use the provider console or existing access to run ufw allow OpenSSH, then reconnect.
Remote curl cannot reach port 8080 The process is stopped, bound only to localhost, or blocked by UFW or a provider firewall. Confirm the foreground command uses --hostname 0.0.0.0 --port 8080, check the process output, and verify the firewall rule.
Systemd reports “No such file or directory” The project path or release executable name differs from the unit. Check WorkingDirectory, run swift build -c release, and update ExecStart to the real binary.
Service starts and immediately restarts The application exits because of a missing environment value, dependency, permissions problem, or port conflict. Read journalctl -u hello -e; fix the first application error, then restart.
Configuration changes have no effect The process still has the old environment. Restart the service after editing the environment file; use systemctl status and logs to confirm the new process started.
Toolbox command is unavailable The Toolbox was not installed or its binary is not on PATH. Install with Homebrew or build the intended release from source, then run vapor --help.

Production readiness checklist

  • Ubuntu is one of the Swift.org targets you verified at provisioning time.
  • Swift reports version 5.9 or newer and the project builds successfully.
  • SSH works for the non-root vapor user, which has sudo only where needed.
  • UFW allows SSH and only the application or proxy ports you deliberately expose.
  • The release executable starts manually with --env production.
  • The systemd unit uses the correct project root, executable path, user, and group.
  • The unit is enabled, active, and readable through systemctl status and journalctl.
  • Secrets and settings are supplied through a protected environment file or deliberate environment entries.
  • You have decided whether direct Vapor access is appropriate or Nginx should handle the public edge.
  • A restart and reboot test confirms the application returns without an SSH session remaining open.

Which installation choices should you use?

For a new server, the most maintainable baseline is a supported Ubuntu release, a dedicated sudo user, Swiftly for the Swift toolchain, no Toolbox unless you need its commands, a release build, and one systemd unit per Vapor application. Use the direct listener only for controlled testing or a deliberately simple internal service. For a public application, evaluate Nginx as the edge proxy and keep the Vapor process supervised privately by systemd.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.