fix(post): hopefully finally fixed inline code

This commit is contained in:
Paul Fey 2024-12-25 12:16:02 +01:00
parent c9679d6b79
commit a04b0301df

View file

@ -2,11 +2,11 @@
layout: post layout: post
title: "Installing NixOS on a VPS" title: "Installing NixOS on a VPS"
date: 2024-12-24 22:34:23 +0100 date: 2024-12-24 22:34:23 +0100
categories: nixos, vps categories: nixos vps
--- ---
## Introduction ## Introduction
Hello everyone, Hello everyone,
I recently bought a new VPS. However the Provider I bought it at ([IONOS](https://ionos.com)) does not provide NixOS images. I recently bought a new VPS. However the provider I bought it at ([IONOS](https://ionos.com)) does not provide NixOS images.
At first I thought that Debian will be fine for me, but I quickly noticed, that NixOS is just way easier to maintain and reproduce. Especially on servers. At first I thought that Debian will be fine for me, but I quickly noticed, that NixOS is just way easier to maintain and reproduce. Especially on servers.
So I quickly looked into ways of installing NixOS and I discovered two Methods: So I quickly looked into ways of installing NixOS and I discovered two Methods:
@ -19,15 +19,22 @@ So I quickly looked into ways of installing NixOS and I discovered two Methods:
## Installing NixOS ## Installing NixOS
NixOS-Infect is pretty simple: NixOS-Infect is pretty simple:
First, add your public ssh key to the root user like this: First, add your public ssh key to the root user like this:
```echo "<your ssh key>" >> /root/.ssh/authorized_keys```. ```bash
echo "<your ssh key>" >> /root/.ssh/authorized_keys
```
After that just run the shell script by running the following: After that just run the shell script by running the following:
```curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-<nixos version> bash -x```. ```bash
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-<nixos version> bash -x
```
At the time of writing the latest NixOS version is 24.11, so I entered the following: At the time of writing the latest NixOS version is 24.11, so I entered the following:
```curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-24.11 bash -x```. ```bash
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-24.11 bash -x
```
The script will automatically reboot your server and after it finished startup, You can login as the root user using the SSH-key you set up before. The script will automatically reboot your server and after it finished startup, You can login as the root user using the SSH-key you set up before.
## Configuring afterwards ## Configuring afterwards
After installation you can use the VPS like a normal NixOS machine and deploy a new configuration using flakes or the /etc/nixos/configuration.nix file. I would highly recommend creating a new user and removing the SSH-key from the root user. Additionally I also installed things like docker and tailscale to make maintaining easier. After installation you can use the VPS like a normal NixOS machine and deploy a new configuration using flakes or the /etc/nixos/configuration.nix file. I would highly recommend creating a new user and removing the SSH-key from the root user. Additionally I also installed things like docker and tailscale to make maintaining easier.
#### Thank you for reading this blog post. I hope, that I helped you out and you learned something new. Stay tuned for the next blog post. It will come soon! #### Thank you for reading this blog post. I wish you Merry Christmas and I hope, that I helped you out. Hopefully we will see us soon