Many thanks to the zhihu User: Amserphere
Find product in google cloud/ alicloud. Here I am using google cloud might be a little bit different from alicloud. Select VM engine, create a new instance and select ubuntu 18.04, I only gave it a g1-micro core, but you can add more if you want.
open vm engine, click ssh to access to the server
Gain operation right
sudo su root
Update apt
sudo apt update
Next, check if Java is already installed:
java -version
If not, follow the suggestion
apt install default-jre
RMB to click yes for the installation
Get the foooking package
sudo wget https://launcher.mojang.com/v1/objects/e9f105b3c5c7e85c7b445249a93362a22f62442d/server.jar
Find path
pwd
Skip the firewall setting if u r lazy. But this will greatly reduce your server’s security so think twice.
systemctl stop firewalld.service
OR else: Add a port (25565 default)
firewall-cmd --zone=public --add-port=25565/tcp --permanent
If firewall not installed, then follow the suggested command to install firewall utils
Go to Fire wall settings:
Start server!
sudo java -Xms512m -Xmx1024m -jar /home/admin/server.jar nogui
512 is the min rom, 1024 is the max.. /home/admin might need to change to your own home root, nogui means no graphics os
It might takes sometime, and
/stop
to stop the server
Let’s change a few more settings to begin!
Agree the agreement:
vi eula.txt
Go in by enter i
Move to the eula=false and change it to eula=true
Press esc, and key in :wq
Press enter to save
IF you are using non-official version
vi server.properties
change online-mode:true
to online-mode:false
re-enter
sudo java -Xms512m -Xmx1024m -jar /home/admin/server.jar nogui
And ur server is ready!!!
Go to mc and add ur own server address
Example:
And enjoy your game!