Skip to content

Instantly share code, notes, and snippets.

@PilchardFriendly
Last active January 1, 2021 11:31
Show Gist options
  • Save PilchardFriendly/d907b82f5b065c41af7d4e2e46216414 to your computer and use it in GitHub Desktop.
Save PilchardFriendly/d907b82f5b065c41af7d4e2e46216414 to your computer and use it in GitHub Desktop.
sudo apt update -y
sudo apt install wget screen default-jdk nmap
sudo useradd -m -r -d /opt/minecraft minecraft
sudo mkdir /opt/minecraft/eva-and-co
#### The URL here is specific to a version of minecraft - I know for a fact it's outdated now - use the latest.
sudo wget -O /opt/minecraft/eva-and-co/minecraft_server.jar https://launcher.mojang.com/v1/objects/f02f4473dbf152c23d7d484952121db0b36698cb/server.jar
sudo bash -c "echo eula=true > /opt/minecraft/eva-and-co/eula.txt"
sudo chown -R minecraft /opt/minecraft/eva-and-co/
#### See the service.txt
sudo vi /etc/systemd/system/minecraft@.service
### See server.properties
sudo nano /opt/minecraft/eva-and-co/server.properties
sudo systemctl enable minecraft@eva-and-co
sudo systemctl start minecraft@eva-and-co
sudo systemctl status minecraft@eva-and-co
A server:
On Amazon lightsail:
Provision a box with:
4 GB RAM, 2 vCPUs, 80 GB SSD – Sydney, all zones (ap-southeast-2
Mine was ubuntu 20 - basically $20 a month, but we're not going to use that.
Give your instance a name (e.g. "cranky-pants")
Select your instance, choose networking, and make sure it has a rule:
Custom/TCP/25565
SSh into your server:
Look at install.txt
Start up minecraft client:
Choose Multiplayer (I think)
max-tick-time=60000
generator-settings=
allow-nether=true
force-gamemode=false
gamemode=1
enable-query=false
player-idle-timeout=0
difficulty=1
spawn-monsters=true
op-permission-level=4
pvp=true
snooper-enabled=true
level-type=DEFAULT
hardcore=false
enable-command-block=false
max-players=20
network-compression-threshold=256
resource-pack-sha1=
max-world-size=29999984
server-port=25565
server-ip=
spawn-npcs=true
allow-flight=true
level-name=world
view-distance=10
resource-pack=
spawn-animals=true
white-list=false
generate-structures=true
online-mode=true
max-build-height=256
level-seed=
prevent-proxy-connections=false
use-native-transport=true
motd=A Minecraft Server
enable-rcon=false
[Unit]
Description=Minecraft Server: %i
After=network.target
[Service]
WorkingDirectory=/opt/minecraft/%i
User=minecraft
Group=minecraft
Restart=always
ExecStart=/usr/bin/screen -DmS mc-%i /usr/bin/java -Xmx2G -jar minecraft_server.jar nogui
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECOND
S. SAVING ALL MAPS..."5'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"5'
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"5'
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment