How to Build a Minecraft Paper Server Using AWS Lightsail
Minecraft is a globally popular sandbox game. If you want to enjoy it with friends, setting up a private server is a great option. In this post, we'll explore in detail how to build a Minecraft Paper server using AWS Lightsail.
1. What is AWS Lightsail?
AWS Lightsail is a virtual private server (VPS) service provided by Amazon Web Services (AWS). It's suitable for hosting simple web applications and websites, easy to use, and cost-effective.
2. What is a Paper Server?
Paper is a high-performance Minecraft server software based on Spigot. It offers better performance and optimization than Spigot and supports various plugins.
3. Creating an AWS Lightsail Instance
- Log in to your AWS account.
- Navigate to the Lightsail dashboard.
- Click the "Create instance" button.
- Choose the instance location. If you're using it in Korea, selecting the "Seoul" region is recommended.
- Select "Linux/Unix" as the platform.
- Under blueprints, select "OS Only" and then choose "Ubuntu 20.04 LTS".
- Choose an instance plan. For a Minecraft server, you need at least 2GB RAM, so select a plan above that.
- Specify an instance name and click the "Create instance" button.
4. Configuring the Firewall
You need to configure the firewall to allow external access to the Minecraft server.
- Go to the management page of the created instance.
- Click on the "Networking" tab.
- In the "Firewall" section, click "Add rule".
- Select "Custom" for the application.
- Choose "TCP" as the protocol.
- Enter "25565" in the port range. (Default Minecraft port)
- Click the "Create" button.
5. Connecting to the Instance
- Select the created instance from the Lightsail dashboard.
- Click on the "Connect" tab.
- Click the "Connect using SSH" button to launch the browser-based SSH client.
6. Installing Java
Java is required to run the Paper server. Install Java using the following commands:
sudo apt update
sudo apt install openjdk-17-jre-headless -y
After installation, check the Java version with:
java -version
7. Downloading and Setting Up the Paper Server
- Create and move to a directory to store the server files.
mkdir minecraft_server
cd minecraft_server
- Download the Paper server file. (Check the Paper official website for the latest version link)
wget https://papermc.io/api/v2/projects/paper/versions/1.19.4/builds/550/downloads/paper-1.19.4-550.jar
- Create a server launch script.
nano start.sh
- Enter the following content into the script:
#!/bin/bash
java -Xms1G -Xmx2G -jar paper-1.19.4-550.jar nogui
Save and exit the script. (Ctrl+X, Y, Enter)
Give execution permission to the script.
chmod +x start.sh
8. First Server Launch and Setup
- Launch the server for the first time with the following command:
./start.sh
The server will create and immediately shut down. This is normal.
Open the eula.txt file to agree to the license.
nano eula.txt
Change
eula=false
toeula=true
and save.Restart the server.
./start.sh
9. Optimizing Server Settings
You can modify the server.properties file to optimize the server's performance.
nano server.properties
Key settings include:
view-distance
: Sets the server's rendering distance. The default is 10, but can be adjusted based on server performance.max-players
: Sets the maximum number of players that can connect simultaneously.spawn-protection
: Sets the protection range of the spawn area.difficulty
: Sets the game difficulty. (peaceful, easy, normal, hard)
10. Installing Plugins
One of the advantages of a Paper server is its support for various plugins. Here's how to install plugins:
- Stop the server. (Enter the
stop
command in the console) - Move to the
plugins
folder. - Download the .jar file of the desired plugin and place it in this folder.
- Restart the server.
11. Running the Server in the Background
To keep the server running even after the SSH session ends, you can use the screen
command.
- Install screen.
sudo apt install screen -y
- Create a new screen session and launch the server.
screen -S minecraft
./start.sh
After the server starts, press Ctrl+A, D to detach the session.
To reconnect later, use the following command:
screen -r minecraft
12. Backing Up the Server
Regular backups are crucial. Here's an example of a simple backup script:
#!/bin/bash
BACKUP_DIR="/home/ubuntu/backups"
SERVER_DIR="/home/ubuntu/minecraft_server"
BACKUP_NAME="minecraft_backup_$(date +%Y%m%d_%H%M%S).tar.gz"
# Create backup directory
mkdir -p $BACKUP_DIR
# Stop the server
screen -S minecraft -X stuff "say Server will stop for backup in 5 seconds.\n"
sleep 5
screen -S minecraft -X stuff "stop\n"
sleep 10
# Create backup
tar -czf $BACKUP_DIR/$BACKUP_NAME -C $SERVER_DIR .
# Restart the server
screen -S minecraft -X stuff "./start.sh\n"
echo "Backup completed: $BACKUP_NAME"
You can register this script as a cron job to run periodically.
Conclusion
You've now successfully built a Minecraft Paper server using AWS Lightsail! Through this server, you and your friends can explore and create in Minecraft's infinite world. Server management requires attention, so don't forget regular backups and updates.
Additionally, you can monitor the server's performance and upgrade the Lightsail instance specifications as needed. You can also connect a domain to make it easier to access.
Through operating a Minecraft server, you can learn a lot about Linux system management, network configuration, and game server optimization. Enjoy running your Minecraft server!