Article directory
- 1. Java environment setup
- 2. Install the Minecraft service
- 3. Start the Minecraft service
- 4. LAN test connection to Minecraft server
- 5. Install cpolar intranet penetration
- 6. Create a tunnel to map the intranet port
- 7. Test public network remote connection
- 8. Configure fixed TCP port address
- 9. Use a fixed public address to connect remotely
Today I would like to share with you how you can set up a Minecraft server on the Windows system in just a few simple steps, and use the cpolar intranet penetration tool to expose local services to the public network connection, so that you can play online games with your friends.
1. Java environment setup
Take the Windows 10 system as an example, configure the Java environment, build a Minecraft server, and download the latest Java version.
https://www.oracle.com/java/technologies/downloads/#jdk17-windows
Select exe
the file, and after the download is complete, double-click the installation package to install it by default.
After the java installation is completed, open the folder, find java, and copy the jdk installation path. In this example, it isC:\Program Files\Java\jdk-17.0.5
高级系统设置
Search and open System Properties in the Start menu bar and click环境变量
Click新建一个系统环境变量
- Variable name: JAVA_HOME
- Variable value: JDK installation path, in this example
C:\Program Files\Java\jdk-17.0.5
In the system variables list, double-clickPath变量
Click New on the right, add in front of the variable name and value %JAVA_HOME%\bin
, and click OK
Verify whether it is successful: Search cmd in the Start menu bar, open the command prompt, and enter java -version
. If the version information appears, the configuration is successful.
2. Install the Minecraft service
Download the MC server. The latest version of the server can be downloaded from the official website.
https://www.minecraft.net/zh-hans/download/server/
3. Start the Minecraft service
Enter the Minecraft service jar package download directory and click on the file in the upper left corner
Open powershell and open it as administrator
Execute the java run command to run the jar package service
java -jar server.jar --nogui
After running, an error is prompted. The error means that it is subject to EULA. One is automatically generated when you run the server for the first time eula.txt
. Open it with a text editor (such as Notepad) eula.txt
and change the file eula=false
to eula=true
. This means that you have read and understood the EULA and will abide by it when using the server. If you don't do this, the server will shut down as soon as you try to start it.
We can see this eula.txt file under the directory of the jar package
Open the file, change eula的值
it true
to
Then we use the above command again to start and run the jar package service, and we can see that the port is25565
4. LAN test connection to Minecraft server
Open the Minecraft launcher, click to enter the game, and select多人游戏
Click添加服务器
- name of server
- Server address: fill in the local ip address + mc port number (default is 25565), such as
127.0.0.1:25565
Click完成
After selecting the server you just created, click加入服务器
Then there will be a connection failure, because the genuine verification requires verification of the genuine account, we need to turn off the verification.
Looking at powershell, I also saw related errors. Next, I need to modify the relevant configuration files. First, close powershell.
Find the server.properties file in the installation directory and edit it
Then make the following changes: online-mode=false (turn off genuine verification), and save after making the changes.
Then start the server.jar service again. You can see the following prompt, indicating that the modification is successful.
Then we connected again and successfully entered the game
5. Install cpolar intranet penetration
cpolar official website: https://www.cpolar.com/
For Windows systems, you can directly download the zip package suitable for the Windows platform from the official website. After decompression, you will get the cpolar installation package, and then double-click the installation package to install it by default.
6. Create a tunnel to map the intranet port
After the successful installation of cpolar intranet penetration, access the cpolar web UI management interface on the browser (default is local port 9200), access it in the form of [http://local ip address:9200], such as http://127.0.0.1 :9200/, and log in using cpolar account
After successfully logging in, click Tunnel Management on the left - Create Tunnel:
隧道名称
: The name can be customized. Be careful not to duplicate the existing tunnel name.协议
:Select tcp protocol本地地址
:25565 (Minecraft default port number)端口类型
: Random temporary TCP port地区
:China vip
Click创建
After the tunnel is successfully created, the page automatically jumps to the tunnel list page. You can see that the status is normally displayed as active
, which is the normal online status.
状态
Click - on the left dashboard 在线隧道列表
, you can see that the tunnel just created successfully has generated the corresponding public network address. We will copy it. Note that tcp://
there is no need to copy it. In this example, it is3.tcp.vip.cpolar.cn:10786
7. Test public network remote connection
Start Minecraft, you can add a new server directly, or edit the local server you just added
In the server address bar, enter the public network address generated by cpolar 3.tcp.vip.cpolar.cn:10786
and click Finish.
Join the server and the public network remote connection is successful.
8. Configure fixed TCP port address
It should be noted that the above steps use a random temporary TCP port address, and the generated public network address is a random temporary address, which will change randomly within 24 hours. In order to facilitate our friends to connect remotely, we will configure a fixed TCP port address for them. This address will not change, making it easier for our friends to connect remotely without having to repeatedly modify the server address every day.
Configuring a fixed TCP port address requires upgrading cpolar to the Professional Edition package or above.
8.1 Reserve a fixed tcp address
Log in to the cpolar official website, click Reserve on the left, and find the reserved TCP address. Let’s reserve a fixed TCP address for Minecraft:
地区
:Select China vip描述
:Remarks, can be customized
Click保留
After the address is successfully reserved, the system will generate the corresponding fixed public network address. In this case 5.tcp.vip.cpolar.cn:12637
, copy it.
8.2 Configure fixed tcp address
Access port 9200 on the browser, http://127.0.0.1:9200/, log in to the cpolar web ui management interface, click Tunnel Management - Tunnel List on the left dashboard, find the Minecraft Tunnel, and click on the right编辑
Modify the tunnel information and configure the successfully reserved fixed tcp address into the tunnel.
端口类型
: Modify to fixed tcp port预留的tcp地址
: Fill in the successfully reserved address, in this example:5.tcp.vip.cpolar.cn:12637
Click更新
After the tunnel is successfully updated, click the status on the left dashboard - Online Tunnel List, find the Minecraft Tunnel, and you can see that the public network address has been updated to a fixed TCP address.
9. Use a fixed public address to connect remotely
Next, we test the remote connection using a fixed public network TCP port address.
Public network remote connection successful!
Now, the public address no longer changes randomly.
Reprinted from cpolar pole cloud article: Build a Minecraft Java version server, public network remote connection [intranet penetration]