Reformat prettier

This commit is contained in:
RealStickman 2022-12-23 08:44:17 +01:00
parent ed8f7fad1f
commit 9aef4110fd

View File

@ -1,41 +1,45 @@
---
title: 'Minecraft Server'
title: "Minecraft Server"
visible: true
---
[toc]
Make sure to allow port `25565/tcp` to your server
Make sure to allow port `25565/tcp` to your server
## Vanilla
## PaperMC
## Forge Server
Download the forge installer from their website and install the server to a directory of your choosing.
Copy that folder to your server
Copy that folder to your server
On the server, create a directory for the server.
`# mkdir /etc/minecraft`
Put your folder here
Put your folder here
Install java
`# apt install openjdk-17-jre`
`# apt install openjdk-17-jre`
Add a `minecraft` user.
`# useradd minecraft`
`# chown minecraft:minecraft -R /etc/minecraft/`
`# chown minecraft:minecraft -R /etc/minecraft/`
Start the server a first time.
`sudo -u minecraft /etc/minecraft/forge-(version)/run.sh`
`sudo -u minecraft /etc/minecraft/forge-(version)/run.sh`
Accept the EULA by editing `/etc/minecraft/forge-(version)/eula.txt`
Accept the EULA by editing `/etc/minecraft/forge-(version)/eula.txt`
## Fabric Server
## Systemd Service
> Adapted from [this gist](https://gist.github.com/dotStart/ea0455714a0942474635)
`/etc/systemd/system/minecraft.service`
> Adapted from [this gist](https://gist.github.com/dotStart/ea0455714a0942474635)
`/etc/systemd/system/minecraft.service`
```
[Unit]
Description=Minecraft Server
@ -64,9 +68,11 @@ WantedBy=multi-user.target
```
## Systemd Service with STDIN available
> Based on [this stackexchange answer](https://unix.stackexchange.com/questions/598221/how-to-control-systemd-service-using-screen/612118#612118)
`/etc/systemd/system/minecraft.socket`
> Based on [this stackexchange answer](https://unix.stackexchange.com/questions/598221/how-to-control-systemd-service-using-screen/612118#612118)
`/etc/systemd/system/minecraft.socket`
```
[Unit]
PartOf=minecraft.service
@ -75,7 +81,8 @@ PartOf=minecraft.service
ListenFIFO=%t/minecraft.stdin
```
`/etc/systemd/system/minecraft.service`
`/etc/systemd/system/minecraft.service`
```
[Unit]
Description=Minecraft Server
@ -104,7 +111,9 @@ To run commands, redirect commands into your socket.
`echo "command" > /run/minecraft.stdin`
### Pipe commands script
**No safety at all!!**
**No safety at all!!**
```
#!/usr/bin/env bash
echo "$@" > /run/minecraft.stdin