# Minecraft server on AWS EC2 instance

## Installing

Assuming user is `ubuntu`. Extract in `/home/ubuntu/control`

# Setup partition on second volume
```
mkdir /home/ubuntu/minecraft
sudo gdisk /dev/nvme1n1
> n
> Enter
> Enter
> Enter
> w
sudo mkfs.ext4 /dev/nvme1n1p1
sudo echo "/dev/nvme1n1p1 		/home/ubuntu/minecraft ext4 defaults,nofail 0 0" >> /etc/fstab
```

# Install systemd services
```
mkdir -p /home/ubuntu/.config/systemd/user
ln -s /home/ubuntu/control/services/set_initial_ttl.service /home/ubuntu/.config/systemd/user/set_initial_ttl.service
ln -s /home/ubuntu/control/services/ensure_running.service /home/ubuntu/.config/systemd/user/ensure_running.service

systemctl --user enable set_initial_ttl
systemctl --user enable ensure_running
loginctl show-user ubuntu --property Linger
```

# Setup user linger and crontab
```
loginctl enable-linger ubuntu
crontab /home/ubuntu/control/crontab
```

# Install pip dependencies
sudo pip install -r /home/ubuntu/control/requirements.txt
