Zimri

Zimri - xlog

生活就像海洋 🌊
github

Setting up a Factorio server on Centos

"Factorio" is a simulation and management game developed and published by slpwnd. In the game, players' spaceship crashes on an alien planet, and they need to survive and establish a factory using the resources on the planet.

Collect resources, upgrade your equipment, build infrastructure, automate production, and defeat your enemies.

Environment Preparation: Centos7.x
System Update, Change Aliyun Source for Domestic Servers, Update System Directly for Overseas Servers

1. System Update and Source Replacement#

First, backup the original source in case of unpredictable errors.

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

Import Aliyun Centos7 source.

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

or

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

Add EPEL.

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Clear YUM cache.

yum clean all

Cache Aliyun source.

yum makecache

At this point, the source has been successfully replaced, and you can update the system (not necessary, takes a long time).

yum -y update

Remember to restart if the system is updated.

2. Centos glibc-2.18 Environment Compilation#

Install gcc and wget.

Download glibc-2.18.tar.gz.

Private acceleration address (China).

Unzip and enter glibc-2.18.

Create a build folder.

Compile.

3. Install screen#

Screen is a full-screen window manager that allows multiplexing of a physical terminal between multiple processes.

Users can create multiple screen sessions in one screen session (or sub-session), and each screen session (or sub-session) operates like a real telnet/SSH connection window.

4. Firewall Exception#

By default, CentOS7 uses the firewalld firewall.

Check the firewall status.

If "success" is returned, it means it is enabled.
If the status is "closed", the following steps can be skipped. You can choose whether to continue or not. By default, we open the firewall for security.

If the status is closed, start the firewall.

Enable on startup.

Open the specified port for Factorio.

Also add the SSH port just in case.

  1. Reload to make the configuration effective.
    Reload the firewall.

5. Factorio Server Preparation#

1. Download the program (latest version or as needed).#

2. Private acceleration address (China).#

3. Unzip the compressed package.#

5. Edit the configuration file.#

Go to the /opt/factorio/data folder and edit the server-settings.example.json file.

Some necessary settings.

6. Generate the map*#

When setting up the server for the first time, regardless of whether there is a map or not, you need to execute the command to generate the map to load it correctly.

7. Start the server#

Because Factorio SSH commands are exclusive, use the screen command installed earlier to run it in the background.

Start the server with the specified map command.

Start the server with the latest map in the saves folder.

Then simply exit the SSH window.

8. Management commands#

Log in to the server#

After connecting via SSH, display the SSH command line for the background execution.

Output

Connect to the screen session using the process ID displayed in front (the ID is dynamic).

Save immediately#

After logging in to the screen session, simply enter:

to save the game.

Exit the Factorio server#

After logging in to the screen session, simply press Ctrl + C to shut down the server.

6. Auto Start on Boot#

Because Factorio SSH commands are exclusive, use the screen command with the latest map in the saves folder as the startup command.

Create a startup script.

Insert the following content:

Save by typing

Insert the following content:

Save by typing

Grant execution permissions.

Edit rc.local and add the script created above to the last line.

Grant execution permissions.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.