CentOS 7.3 sets up the Minecraft server, centosmin.pdf
Build a Minecraft server on CentOS 7: 3
Mojang is not available recently, so Realms cannot buy it. At the instigation of a friend, I tried to manage a server, so I rented an ECS instance. Record the process.
Note:,How to purchase and use ECs and Minecraft server configurations is not covered in this article
This article only focuses on how to configure the CentOS7.3 system to run the Minecraft server.
It is for reference only. Please operate according to the actual situation
If any error occurs, please correct it. Thank you.
Install basic software for Minecraft server on CentOS change software required for yum source installation Server Java Screen add user and group configuration SSH start Minecraft server others
If CentOS7.3 is pre-installed on the server, I will save some troubles such as partitioning.
Visual Testing is the minimal installation and does not even have Vim.
Install some software first.
Install basic software
Because the system is pre-installed, the network has been configured and is much easier.
First install someI thinkRequired software:
Yum install [software name]
Yum_untils wget vim
The rest will be used later.
The download speed is quite fast.
Change yum Source
This item is not required and can be skipped.
I changed the original source to Alibaba's.
Mkdir ~ /Bk # create Backup Directory mv/etc/yum. repos. d/CentOS-Base.repo ~ /Bk/CentOS-Base.repo.bak # backup file wget-O CentOS-Base.repo clean all # Clear cache yum makecache # Build package local cache
Install software required for the server
These are what Minecraft needs to get started.
Java
The version I selected is Java1.8.
Yum list java * | grep java-1.8.0-openjdk # search java
Yum install java-1.8.0-openjdk.x86_64 # select the appropriate version
There are a lot of downloads.
After the installation is complete, test:
Java-version
The installation is successful.
Screen
This is a virtual terminal that allows commands to run in the background.
Yum install screen
It has many usage methods, which I usually use:
Screen-S screenname # create a screen session named screenname screen-ls # list all current screen sessions screen-r # restore the last offline session screen-x [session id] # resume the session with the specified id, you can use screen-ls to view the screen-d # offline (not closed) current session # offline sessions can also be completed through the shortcut key C-a d (press the combination key Ctrl + a first, then press d)
For more information, search by yourself or refer
Add users and groups
Because the system is pre-installed, the system administrator only has root.
For security, I have created two new users, one for the management system and the other for starting the mc server.
Create a user group (not required), create a user, and specify the initial user group.
Then set the password for this user.
Groupadd hadmin # create user group useradd-g hadmin yangdeng # create a user and specify its initial user group as hadminpasswd yangdeng # set a password for yangdeng
However, this is only a common user and has no administrator permission.
There are many methods for elevation of permission. Here I only write one method.
Add a user to the wheel group
1. usermod-a-G wheel yangdeng # Add yangdeng to the wheel group
Id yangdeng # view user information
2. Change/etc/sudoers so that yangdeng can use sudo to run the root permission command.
Visudo # modify sudo configuration information
Find the following line and remove the annotator #
3. OK
Now add a common user and set the password
Groupadd minecraft # useradd-g minecraft mcadmin # create a user and specify the initial user group passwd mcadmin # Set the password for mcadmin
Configure SSH
The above operations are completed on the console on the web page. It is time to use ssh to connect.
Windows is used locally, so the operation is a little effort-consuming.
The ssh client is PuTTY. If you connect to the ssh client, no key pair is generated.
To configure Public Key login, You need to upload the public key to the server.CorrespondingUser's ~ /. Ssh/authorized_keys.
But the sshd strict mode is ~ /. Ssh and ~ /. Ssh/authorized_keys has the required permissions. I can't find a client that can run ssh-copy-id. I can only create one by myself.
~ /. The ssh permission is 700 ,~ /. The ssh/authorized_keys permission is 600.
# First log on to mkdir ~ with the yangdeng account ~ /. Ssh # create the directory chmod 700 ~ /. Ssh # Set the permission touch ~ /. Ssh/authorized_keys # create a file chmod 600 ~ /Authorized_keys
After creating a directory, You can import the public key. The public key is very long, but it can only occupy the position of one row in authorized_keys (that is, a long row ).
This is also true for another account.
After the public key is imported, configure the ssh server, that is, sshd:
Sudo vim/etc/ssh/sshd_config
Find and modify or add:
PubkeyAuthentication yes # Allow Public Key login # The following are some security options: LoginGraceTime 25 # authentication time. If the logon time is not completed, the connection is closed, the Unit is second PermitRootLogin no # Do not allow root to log on to StrictModes yes on ssh # strict mode MaxAuthTries 4 # maximum number of login authentication errors MaxSessions 5 # maximum number of ssh sessions