Centos7搭建Multicraft我的世界服務器控制面板教程


暑假快到了,有一些MC的玩家想搭建國際版服務器,但是不會搭建.今天我寫了一個網頁服務器控制面板的搭建教程,PE,PC服務器都可以開哦~

介四面板登錄頁面 (還沒漢化,背景這個版本暫時改不了,想要美化現在只能選2.2.0,介個版本是2.2.1)


Home頁
這個面板接觸過服務器的應該都用過這個面板,很好用,大部分人都不知道它的原名‘Multicraft’,因為這些原本的內容都被改了,就連版權都可以改的.我見過一些萌新搭建面板,老是出問題,然后花錢找人搭建,搭建一次大概30-50元.說白了無知被騙,那么簡單的東西也要花錢代搭?所以我寫了一個傻瓜式教程.

我們選用Centos7來搭建服務器控制面板,因為Centos系統的效率高,當然Windows系統也可以,但推薦用Centos,如果一定要Windows的話,Windows Server系統最好不過.Windows安裝教程還要教?不必了吧!

准備工作
能上網的電腦/(安卓)手機,電腦上需要裝 Xshell6 Xftp6 Notepad++ 這三個工具;手機上需要裝 JuiceSSH ES文件瀏覽器 這兩個工具.

一台Centos7的服務器,最低2G內存,服務器可以去阿里雲/騰訊雲等正規的租,或者自己砸點錢買台服務器放到機房托管.

工具基本使用教程
用Xshell6 SSH功能遠程連接服務器

打開Xshell6>>新建


Xshell6使用教程1
名稱隨便填 例如: 'B站幻作解說' ;主機填寫你服務器的IP地址或者綁定的域名 例如: '127.0.0.1'&‘cometmc.cn’,填完后點擊'確定'


Xshell6使用教程2
點擊'連接'>>輸入用戶名'root'>>輸入密碼(在你購買服務器的時候應該設置過密碼了)


Xshell6使用教程3
顯示如下內容表示連接成功:

Host 'cometmc.cn' resolved to 123.249.29.144.

Connecting to xxx.xxx.xx.xxx:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

Last failed login: Thu Jun 21 23:45:06 CST 2018 from 183.131.116.86 on ssh:notty

There was 1 failed login attempt since the last successful login.

Last login: Thu Jun 21 23:44:28 2018 from 183.131.116.82

[root@MyCloudServer ~]#

Xftp6 SFTP功能連接遠程服務器

新建>>名稱隨意 主機(IP/域名) 例如: '127.0.0.1' 'cometmc.cn'>>點擊‘確定’>>連接


Xftp6使用教程1

Xftp6使用教程2
成功連接如下:


Xshell6使用教程3
JuiceSSH連接服務器

連接>>認證>>右下角‘+’>>昵稱隨便 用戶名'root' 密碼'自己知道'>>右上角‘✓’>>連接>>右下角'+'>>地址(IP/域名)>>右上角'✓'>>連接服務器

顯示如下內容表示連接成功:

Last failed login: Thu Jun 21 23:45:06 CST 2018 from 183.131.116.86 on ssh:notty

There was 1 failed login attempt since the last successful login.

Last login: Thu Jun 21 23:44:28 2018 from 183.131.116.82

[root@MyCloudServer ~]#

ES文件瀏覽器連接SFTP服務器

左上角菜單>>網絡>>FTP>>新建>>sftp>>server(IP/域名) Username: root Password: 自己知道>>確定>>連接SFTP服務器

如果可以顯示文件夾/文件表示連接成功

服務器環境搭建
更換阿里雲的yum源 (可選)

cd /etc/yum.repos.d/

yum -y install weget

wget http://mirrors.aliyun.com/repo/Centos-7.repo

mv Centos-7.repo CentOs-Base.repo

yum clean all

yum makecache

更新系統

yum -y update

關閉並禁止開機啟動防火牆&selinux

systemctl stop firewalld

systemctl disable firewalld

用Xftp6/ES文件瀏覽器連接你的服務器

文件目錄:/etc/selinux/config

下載到本地打開,把SELINUX=enforcing 改成 SELINUX=disabled 上傳覆蓋 

重啟服務器

reboot

等待幾十秒就可以重新連接了

 

搭建mysql數據庫
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

yum localinstall mysql57-community-release-el7-8.noarch.rpm

yum -y install mysql-community-server

啟動MySQL服務&設置mysql開機啟動

systemctl start mysqld

systemctl enable mysqld

systemctl daemon-reload

配置默認編碼為utf8&修改密碼策略 [不需要復雜密碼可以禁用]

修改密碼策略-在/etc/my.cnf文件中添加validate_password_policy配置,指定密碼策略

# 選擇0(LOW),1(MEDIUM),2(STRONG)其中一種,選擇2需要提供密碼字典文件

validate_password_policy=0

如果不需要密碼策略,添加my.cnf文件中添加如下配置禁用即可,如下所示:

[mysqld]

validate_password = off

配置默認編碼為utf8-修改/etc/my.cnf配置文件,在[mysqld]下添加編碼配置,如下所示:

[mysqld]

character_set_server=utf8

init_connect='SET NAMES utf8'

重新啟動mysql服務使配置生效:

systemctl restart mysqld

修改root本地登錄密碼

查看默認密碼

grep "password" /var/log/mysqld.log

顯示:A temporary password is generated for root@localhost: hilX0U!9i3_6

root@localhost: 之后的字符串就是密碼

登錄數據庫

mysql -uroot -p

提示輸入密碼: hilX0U!9i3_6

修改密碼為‘2233’

set password for 'root'@'localhost'=password('2233');

創建名字為‘bilibilihuanzuo’數據庫

create database bilibilihuanzuo;

退出mysql數據庫

exit

Multicraft安裝環境搭建
安裝多個Multicraft需要的依賴項,如Apache、PHP和OpenJDK

yum -y install httpd php php-common php-gd php-mbstring php-ldap php-odbc php-pear php-xml php-xmlrpc php-bcmath php-mysql php-pdo wget vim tar zip curl java-1.8.0-openjdk

下載並安裝Multicraft面板

wget https://www.multicraft.org/files/multicraft-2.4.0-64.tar.gz -O multicraft.tar.gz

tar -zxvf multicraft.tar.gz

cd multicraft

./setup.sh

這個可以下載自己想要的版本,現在只提供2.2.0版本,Multicraft-2.2.0版本下載: http://share.weiyun.com/5PwEKvT

################################################################################

*** Welcome to Multicraft!

################################################################################

This installer will help you get Multicraft up and running.

No changes are made to the system until all of the required information has been collected.

NOTE: This script automates the installation as described on the Multicraft website. Use it at your own risk.

Run each Minecraft server under its own user? (Multicraft will create system users): [y]/n 回車

Run Multicraft under this user: [minecraft] 回車

User not found. Create user 'minecraft' on start of installation? [y]/n 回車

Install Multicraft in: [/home/minecraft/multicraft] 回車

If you have a license key you can enter it now: [no] 回車

If you control multiple machines from one web panel you need to assign each daemon a unique number (requires a Dynamic or custom license). Daemon number? [1] 回車

Will the web panel run on this machine? [y]/n 回車

User of the webserver: [apache] 回車

Location of the web panel files: [/var/www/html/multicraft] /var/www/html 回車

Please enter a new daemon password (use the same password in the last step of the panel installer) [none] 回車(bug:密碼無法輸入,該版本可以在web安裝環節中輸入密碼)

Enable builtin FTP server? [y]/n 回車

IP the FTP server will listen on (0.0.0.0 for all IPs): [123.xxx.xx.xxx] 0.0.0.0 回車

IP to use to connect to the FTP server (external IP): [123.xxx.xx.xxx] 回車

FTP server port: [21] 2121 回車(改端口是防止共享IP用戶端口被占用)

Block FTP upload of .jar files and other executables (potentially dangerous plugins)? [n]/y y 回車

MySQL is the recommended database type but it requires you to have a MySQL server available.

SQLite is more light weight and it will work fine for small installations up to 10 servers.

For multiple daemons on a single panel MySQL is required.

What kind of database do you want to use? [sqlite]/mysql mysql 回車

NOTE: This is for the daemon config, the front end has an installation routine for database configuration and initialization.

Database host: [127.0.0.1] 回車

Database name: [multicraft_daemon] bilibilihuanzuo 回車

Database user: [root] (勿改)  回車

Database password: [] 2233 回車 密碼看不見,但非之前那個bug

***

*** Please use the web panel to initialize the database.

***

which: no unzip in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

Path to unzip program: [/usr/bin/unzip] 回車

NOTE: Any running daemon will be stopped!

Ready to install Multicraft. Start installation? [y]/n 回車

################################################################################

*** INSTALLING

################################################################################

Creating user 'minecraft'... done

Creating directory '/home/minecraft/multicraft'... done

Ensuring the home directory exists and is owned and writable by the user... done

Installing 'bin/' to '/home/minecraft/multicraft/'... done

Installing 'jar/' to '/home/minecraft/multicraft/'... done

Installing 'launcher/' to '/home/minecraft/multicraft/'... done

Installing 'scripts/' to '/home/minecraft/multicraft/'... done

Installing 'ssl/' to '/home/minecraft/multicraft/'... done

Installing 'templates/' to '/home/minecraft/multicraft/'... done

Installing 'eula.txt' to '/home/minecraft/multicraft/'... done

Installing 'multicraft.conf.dist' to '/home/minecraft/multicraft/'... done

Installing 'default_server.conf.dist' to '/home/minecraft/multicraft/'... done

Installing 'server_configs.conf.dist' to '/home/minecraft/multicraft/'... done

Cleaning up files... done

Installing license key... done

Generating 'multicraft.conf'... done

Setting owner of '/home/minecraft/multicraft' to 'minecraft'... done

Setting special daemon permissions... done

Creating directory '/var/www/html'... done

Installing web panel files from 'panel/' to '/var/www/html'... done

Setting owner of '/var/www/html' to 'apache'... done

Setting permissions of '/var/www/html'... done

Applying SELinux contexts... done

Temporarily starting daemon to set DB permissions:

Multicraft 2.2.1 - Minecraft Server Manager Daemon

Loading configuration from /home/minecraft/multicraft/multicraft.conf

Starting daemon

Permissions set, exiting.

################################################################################

*** Installation complete!

################################################################################

PLEASE READ:

1) Before starting the daemon you need to run the web panel installer to initialize your database. (example: http://your.address/multicraft/install.php)

2) After running the web panel installer you can start the daemon using the following command:

   /home/minecraft/multicraft/bin/multicraft start

For troubleshooting please see:

- Daemon log file:    /home/minecraft/multicraft/multicraft.log

- Panel log file:     /var/www/html/protected/runtime/application.log

- Multicraft Website: http://www.multicraft.org/site/docs/troubleshooting

Press [Enter] to continue. 回車

In case you want to rerun this script you can save the entered settings.

Save entered settings? ([y]/n) 回車

Saving settings to 'setup.config'... done

IMPORTANT: Make sure this file is not accessible by unauthorized users.

正如你所看到的,我們可以使用默認設置,最后一行確認將在您的Centos7服務器上啟動Multicraft的安裝.所以前面如果設置錯了用Ctrl+z斷開安裝配置,再啟動./setup.sh重新配置安裝

Apache環境配置

現在安裝腳本並不能完成我們所需要訪問的Multicraft面板的網頁,下面的附加步驟是必需的.

啟動httpd

systemctl start httpd

設置訪問權限

chown -R apache.apache /var/www/html

調整Apache默認的設置為允許.htaccess重寫

awk '/AllowOverride None/{c++;if(c==2){sub("AllowOverride None","AllowOverride All");c=0}}1' /etc/httpd/conf/httpd.conf > /tmp/httpd.conf; mv -f /tmp/httpd.conf /etc/httpd/conf/httpd.conf

設置開機啟動httpd並重啟

systemctl enable httpd

systemctl restart httpd

現在困難的部分已經過去了,我們只需要從web界面完成Multicraft的安裝,然后啟動腳本

訪問web界面,我們只需在瀏覽器欄中輸入服務器的IP地址 例如:‘http://192.168.10.43’,從這里我置們將完成Multicraft最后的配置

這里我已經解析一個備案域名在這個IP上了,則我應該訪問的網址是‘http://cometmc.cn’

在Web頁面你會看到Multicraft的設置,點擊‘Start Installation’開始安裝來開始最后的安裝過程


配置1
如果這里全是綠色,表示你的Apache已經設置好了,然后點擊‘Continue’進入下一個設置,如果有紅色,請返回Apache環境配置——調整Apache默認的設置為允許.htaccess重寫,重新輸入該欄命令


配置2
繼續點擊‘Continue’


配置3
點擊‘Initialize Database’


配置4
輸入我們之前創建的數據庫名字&修改的數據庫密碼


配置5
輸入好后點擊‘Save’保存,然后會刷新頁面,點擊‘Continue’


配置6
之后就會顯示默認的面板賬號: root和密碼: root,點擊上方黑色菜單欄的‘Login’登錄


配置7
登錄好后直接點擊‘Continue’,進入下一頁再次輸入數據庫名字賬號和密碼


配置8
點擊’Save‘保存


配置9
點擊‘Initialize Database’初始化數據庫,刷新頁面后點擊‘Continue’


配置10
這里要解決之前Bug留下的密碼問題,詳細請看下載並安裝Multicraft面板的安裝內容注釋,在‘Password for Deamon connections’一行寫入密碼‘2233’后,點擊‘Save’保存,進入最后一步.


配置11
終於到最后一步了 是不是很開森?

啟動Deamon

/home/minecraft/multicraft/bin/multicraft start


配置12
成功啟動會顯示如下內容:

Multicraft 2.2.1 - Minecraft Server Manager Daemon

Loading configuration from /home/minecraft/multicraft/multicraft.conf

Starting daemon

再點擊‘Refresh’刷新Deamon狀態后點擊‘Continue’,進入下頁,會提示為了安全起見,刪除‘install.php’,該文件路徑:/var/www/html/install.php

我們只需要輸命令刪除就可以了

rm -rf /var/www/html/install.php

最后點擊‘Continue to Multicraft’進入主頁

自己搭建注意事項
Database name: [multicraft_daemon] 所填的名字要與創建的數據庫名字相同

Database user: [root] root千萬別改勿改

Database password: [] 密碼要與數據庫密碼一致

共享IP/net2ftp內置FTP服務器連接不了的童鞋們看這里
共享IP會導致端口占用,並且Multicraft內置的net2ftp需要的隨機連接端口更是多到天際,共享IP分配不到那么多端口怎么辦呢?難道就這樣廢了?

答案是否定的,我們可以設置net2ftp的隨機端口數的大小

下載到本地/home/minecraft/multicraft/multicraft.conf

修改找到FTP服務器設置 [launcher] 一欄

## Format: 2100-2120

## default: 2100-2120

#ftpPasvPorts = 2100-2120

## default: 2121

ftpPort = 2121

保存 上傳覆蓋

重啟Deamon

/home/minecraft/multicraft/bin/multicraft restart

本片教程結束,謝謝觀看,下一期我會教你們如何用conf模板寫PC服務器核心的conf配置和發放已經配置好的conf&配套的PC服務器核心.

如果搭建出現問題可以私信我,想第一時間收到我的最新教程文章,請點擊‘訂閱’ 謝謝~

覺得我寫的教程不錯可以點個‘收藏’,說不定以后能用到呢!
作者:幻作碎片
https://www.bilibili.com/read/cv619933/
出處: bilibili


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM