Reformat prettier
This commit is contained in:
parent
ed8f7fad1f
commit
9aef4110fd
@ -1,41 +1,45 @@
|
|||||||
---
|
---
|
||||||
title: 'Minecraft Server'
|
title: "Minecraft Server"
|
||||||
visible: true
|
visible: true
|
||||||
---
|
---
|
||||||
|
|
||||||
[toc]
|
[toc]
|
||||||
Make sure to allow port `25565/tcp` to your server
|
|
||||||
|
Make sure to allow port `25565/tcp` to your server
|
||||||
|
|
||||||
## Vanilla
|
## Vanilla
|
||||||
|
|
||||||
## PaperMC
|
## PaperMC
|
||||||
|
|
||||||
## Forge Server
|
## Forge Server
|
||||||
|
|
||||||
Download the forge installer from their website and install the server to a directory of your choosing.
|
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.
|
On the server, create a directory for the server.
|
||||||
`# mkdir /etc/minecraft`
|
`# mkdir /etc/minecraft`
|
||||||
Put your folder here
|
Put your folder here
|
||||||
|
|
||||||
Install java
|
Install java
|
||||||
`# apt install openjdk-17-jre`
|
`# apt install openjdk-17-jre`
|
||||||
|
|
||||||
Add a `minecraft` user.
|
Add a `minecraft` user.
|
||||||
`# useradd minecraft`
|
`# useradd minecraft`
|
||||||
`# chown minecraft:minecraft -R /etc/minecraft/`
|
`# chown minecraft:minecraft -R /etc/minecraft/`
|
||||||
|
|
||||||
Start the server a first time.
|
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
|
## Fabric Server
|
||||||
|
|
||||||
## Systemd Service
|
## 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]
|
[Unit]
|
||||||
Description=Minecraft Server
|
Description=Minecraft Server
|
||||||
@ -64,9 +68,11 @@ WantedBy=multi-user.target
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Systemd Service with STDIN available
|
## 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]
|
[Unit]
|
||||||
PartOf=minecraft.service
|
PartOf=minecraft.service
|
||||||
@ -75,7 +81,8 @@ PartOf=minecraft.service
|
|||||||
ListenFIFO=%t/minecraft.stdin
|
ListenFIFO=%t/minecraft.stdin
|
||||||
```
|
```
|
||||||
|
|
||||||
`/etc/systemd/system/minecraft.service`
|
`/etc/systemd/system/minecraft.service`
|
||||||
|
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Minecraft Server
|
Description=Minecraft Server
|
||||||
@ -104,7 +111,9 @@ To run commands, redirect commands into your socket.
|
|||||||
`echo "command" > /run/minecraft.stdin`
|
`echo "command" > /run/minecraft.stdin`
|
||||||
|
|
||||||
### Pipe commands script
|
### Pipe commands script
|
||||||
**No safety at all!!**
|
|
||||||
|
**No safety at all!!**
|
||||||
|
|
||||||
```
|
```
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "$@" > /run/minecraft.stdin
|
echo "$@" > /run/minecraft.stdin
|
||||||
|
Loading…
Reference in New Issue
Block a user