Установка forge server linux

Installing Sponge and Minecraft Forge on Debian 9

This article is outdated and may not work correctly for current operating systems or software.

Using a Different System?

Sponge is an open-source project that expands the capabilities of Minecraft servers through plugins. Combined with the modding API Forge, server hosts can create a highly unique experience for their players. In this tutorial, you will learn to setup a Minecraft server with both Forge and Sponge on a Vultr instance.

Note: While Sponge plugins only need to be installed on the server, Forge mods will often require any players on your server to also have the mod installed. If you choose to install any mods like that, be sure to give your players a heads-up.

Requirements

  • A 1GB RAM VPS or higher with Debian 9 x64
  • An SSH client and optionally an SFTP client (Refer here for instructions)

Installing Java and Screen

In order for the Minecraft server to run, we’re going to need Java. We also need a tool called screen that we’ll be using later. To install both of these at once, we’ll use Debian’s apt command. While we’re at it, we’ll also update the whole system.

Note: The # and $ symbols at the beginning of these lines are not meant to be typed, they are visual indicators of the command prompt.

# apt update && apt upgrade && apt install default-jre screen 

When asked if you want to continue, type » y » and press » Enter «.

Creating a new user (Optional)

It’s generally a good idea to create a non-privileged user when running servers. While this isn’t required, it’s recommended to mitigate damage in the event of a security exploit.

First, we will create our new user named minecraft .

Create a password and work your way through the prompts.

After that’s been done, logout of the SSH client and reconnect using your new username and password. Your prompt will now look something like this.

Downloading Sponge

Create a new folder for the server files with the mkdir command and cd into it.

$ mkdir minecraft && cd minecraft 

Create another folder called mods and cd into that.

Читайте также:  Canon lbp 3010 linux driver

Visit the SpongeForge download page and find a build that matches the version of Minecraft you’ll be using for your server. For this tutorial, we’ll be using version 1.10.2 .

Instead of downloading the file, right click on the download link and click » Copy Link Location «. Go back to your SSH session and paste the URL in a wget command.

$ wget https://repo.spongepowered.org/maven/org/spongepowered/spongeforge/1.10.2-2477-5.2.0-BETA-2731/spongeforge-1.10.2-2477-5.2.0-BETA-2731.jar 

Take note of the number after the Minecraft version in the URL. This is the Forge build number. In this case, it’s 2477 . We’ll need this in the next step.

Once you’ve finished that, return to the previous folder.

Installing Forge

Go to the Forge download page, select your version of Minecraft, and hunt down the build number found in the last step. It will be after the last » . » in Forge’s full version numbers. For example, 12.18.3. 2477 in our case. » Click Installer «.

Once again, right click on the » Skip » button after the timer runs out and use » Copy Link Location «. Paste this into a wget command.

$ wget http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.10.2-12.18.3.2477/forge-1.10.2-12.18.3.2477-installer.jar 

We’ll need to run this file in Java. Type java -jar forge and press the » Tab » key to automatically complete the the filename. Type —installServer to complete the command.

$ java -jar forge-1.10.2-12.18.3.2477-installer.jar --installServer 

Take note of the Forge installer’s filename as we’ll use part of it in the next step.

Writing a script to start the server

Next, we’re going to write a script that can start up the server. We’ll use nano to do this.

From here, write the follow lines.

#!/bin/bash java -Xmx[memory]M -jar [filename] 

Replace [memory] with the amount of heap memory in megabytes you’d like the Minecraft server to use. Remember to leave some for the OS. On a 1GB server, use something around 768MB.

Replace [filename] with the filename from earlier but substitute -installer.jar for -universal.jar .

Here is an example of what it should look like.

#!/bin/bash java -Xmx768M -jar forge-1.10.2-12.18.3.2477-universal.jar 

Use » Control+X «, press » y «, and press » Enter » to save and exit.

Next, you need to mark the file as executable.

Agreeing to the EULA

You will now be able to run the script.

Читайте также:  Debian linux with lxde

The server will run for a little while and exit with an error. This is because Minecraft requires server owners to agree to its End User License Agreement. You can accept these terms by opening the newly created eula.txt and changing false to true .

After making your changes, once again use » Control+X «, press » y «, and press » Enter » to save them.

Keeping the server up with Screen

In order to keep the server running after closing the SSH window, we’ll use a utility called screen .

Press » Spacebar » to move past the information screen and then run the script file again.

The Minecraft server will now successfully start.

Lastly, use » Control+A » and press » D » to suspend screen and then logout of your SSH client. You will now be able to connect through Minecraft using the Vultr server’s IP address.

Should you need access the Minecraft server again (e.g. restarting it after installing mods/plugins or running Minecraft commands such as op ), log back into the SSH client and use the command screen -r to resume the screen session.

Conclusion

In this tutorial you learned how to setup a Minecraft server with Minecraft Forge and Sponge. At this moment, however, it’s still a mostly vanilla Minecraft experience. To start extending Minecraft’s functionality, check out Forge mods at CurseForge and Sponge plugins at Ore.

Use an SFTP client or the wget technique described earlier to add these to the server. To install Forge mods, just place them in the mods folder. Sponge plugins belong in the plugins subfolder of mods . You might have to make this folder, however.

$ mkdir ~/minecraft/mods/plugins 

Want to contribute?

You could earn up to $600 by adding new articles.

Источник

Сервер Forge майнкрафта на линуксе через консоль

Есть ноутбук с неработающей графической картой, который я хочу использовать в качестве сервера для майнкрафта (Forge с модулями). На компьютер я установил линукс (Debian 10) без графического интерфейса, но с SSH-сервером, через который и буду управлять системой.

Выключать компьютер я буду командой: «sudo shutdown -h now».

Установка Java

Для установки java в терминал вводим команду «sudo apt install openjdk-11-jdk».

Когда установка закончится, можно проверить введя команду «java —version» в терминале.

Загрузка файлов сервера

В домашней папке создаём новую папку «minecraft» командой «mkdir minecraft».

Читайте также:  Локальная сеть через wifi роутер linux

Чтобы скачать файлы сервера, вначале надо узнать адрес этих файлов. Для этого переходим на сайт forge minecraft. На данный момент актуальная версия 1.16.5. Там я узнаю ссылку на «Installer«.

Теперь приступим к загрузке файлам сервера:

cd ~/minecraft wget https://maven.minecraftforge.net/net/minecraftforge/forge/1.16.5-36.1.0/forge-1.16.5-36.1.0-installer.jar chmod +x forge-1.16.5-36.1.0-installer.jar

Распаковка и настройка сервера

Переходим в новую папку «minecraft»: cd ~/minecraft/

Распаковываем файлы для сервера: «java -jar forge-1.16.5-36.1.0-installer.jar —installServer»

Запускаем сервер в первый раз: «java -Xms1024M -Xmx3000M -jar forge-1.16.5-36.1.0.jar nogui»

Редактируем файл “eula.txt”, там меняем “eula=false” на “eula=true”. (nano eula.txt)

После этого запускаем сервер во второй раз: «java -Xms1024M -Xmx3000M -jar forge-1.16.5-36.1.0.jar nogui«

Во время второго запуска будет создана папка «world» и конфигурационный файл server.properties.

Сервер останавливается командой «stop».

А папку «world» можно удалять командой «rm -r world».

Настало очередь поправить файл «server.properties» (nano server.properties).

Там подправил следующие параметры:

snooper-enabled=false server-port=25500 online-mode=false motd=Server by Me

Добавление модов

На другом компьютере уже собрал интересные мне моды и упаковал их в zip-архив. Первая попытка перенести файлы через флешку у меня не получилась. Поэтому я их выложил на свой локальный виртуальный сервер, от куда и буду их переносить на сервер.

Для начала установим пакет для распаковки zip-архивов: «sudo apt install unzip».

А теперь загружаем архив и распаковываем его:

cd ~/minecraft/mods/ wget http://192.168.1.2/mods.zip unzip mods.zip mv mods/* . rm -r mods

Иконка сервера

Иконка для сервера является картинка размером 64х64 пикселя, сохранённая в формате PNG, при этом она должна называться «server-icon.png». Создаю на своём компьютере эту картинку и переношу её на свой локальный виртуальный сервер. Дальше делаю по вышеописанной схеме:

cd ~/minecraft/ wget http://192.168.1.2/server-icon.png

Автоматическое сохранение мира

Убеждаемся, что мы находимся в папке “minecraft”. (cd ~/minecraft)

Создаём файл “mcbackup.sh” (nano mcbackup.sh) и пишем внутрь:

# What to backup. Name of minecraft folder
backup_files=»minecraft»

# Specify which directory to backup to.
# Make sure you have enough space to hold 7 days of backups. This
# can be on the server itself, to an external hard drive or mounted network share.
# Warning: minecraft worlds can get fairly large so choose your backup destination accordingly.
dest=»/home/user/minecraftbackups»

# Create backup archive filename.
day=$(date +%A)
archive_file=»$day-$backup_files-.tar.gz»

# Backup the files using tar.
cd /home/user && tar zcvf $dest/$archive_file $backup_files

Проверяем работает ли этот скрипт….

Вписываем команду в кронджоб (crontab -e):

05 3 * * * /home/user/minecraft/mcbackup.sh &> /dev/null

Источник

Оцените статью
Adblock
detector