GNU/Linux >> Linux の 問題 >  >> Linux

Ubuntu20.0にFiveMゲームサーバーをインストールする方法

FiveMは、カスタマイズされた専用サーバーでマルチプレイヤーをプレイできるマルチプレイヤーゲームサーバーです。それは創造性のために特別に設計されました。独自のサーバーを作成して、夢をかなえることができます。サーバーのゲームプレイ体験をパーソナライズするための一連のツールを提供します。 FiveMを使用すると、ロールプレイ、ドリフト、レース、デスマッチなど、完全にオリジナルなものを作成できます。

このチュートリアルでは、Ubuntu20.04にFiveMをインストールする方法を紹介します。

前提条件

  • Atlantic.Netクラウドプラットフォーム上の新しいUbuntu20.04VPS
  • サーバーIPを指す有効なドメイン名
  • サーバーで構成されているrootパスワード

ステップ1-Atlantic.Netクラウドサーバーを作成する

まず、Atlantic.Netクラウドサーバーにログインします。オペレーティングシステムとしてUbuntu20.04を選択し、少なくとも2GBのRAMを搭載した新しいサーバーを作成します。 SSH経由でクラウドサーバーに接続し、ページの上部で強調表示されているクレデンシャルを使用してログインします。

Ubuntu 20.04サーバーにログインしたら、次のコマンドを実行して、ベースシステムを最新の利用可能なパッケージで更新します。

apt-get update -y

ステップ2–必要な依存関係をインストールする

開始する前に、サーバーにいくつかの依存関係をインストールする必要があります。次のコマンドですべてをインストールできます:

apt-get install screen wget git -y

すべてのパッケージがインストールされたら、次のステップに進むことができます。

ステップ3–FiveMのインストールと構成

まず、FiveMのディレクトリを作成し、そのディレクトリ内に最新バージョンのFiveMをダウンロードします。

mkdir ~/fivem_server
cd ~/fivem_server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/3074-
0c5d71ad77873c159d7542a7e8314d9696c1b55b/fx.tar.xz

ダウンロードが完了したら、次のコマンドを使用してダウンロードしたファイルを抽出します。

tar -xvf fx.tar.xz

次に、CFXサーバーデータをシステムにダウンロードする必要があります。次のコマンドでダウンロードできます:

git clone https://github.com/citizenfx/cfx-server-data ~/fivem_resources

次に、FiveM構成ファイルを作成する必要があります。

次のコマンドで作成できます:

nano ~/fivem_resources/server.cfg

FiveMライセンスを含む次の行を追加します。

# Only change the IP if you’re using a server with multiple network interfaces, otherwise 
change the port only.
endpoint_add_tcp "0.0.0.0:30120”
endpoint_add_udp "0.0.0.0:30120”

# These resources will start by default.
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure rconlog
ensure scoreboard

# This allows players to use scripthook-based plugins such as the legacy Lambda Menu.
# Set this to 1 to allow scripthook. Do note that this does _not_ guarantee players won’t be 
able to use external plugins.
sv_scriptHookAllowed 0

# Uncomment this and set a password to enable RCON. Make sure to change the password - it 
should look like rcon_password "YOURPASSWORD”
#rcon_password "”

# A comma-separated list of tags for your server.
# For example:
# - sets tags "drifting, cars, racing”
# Or:
# - sets tags "roleplay, military, tanks”
sets tags "default”

# Set an optional server info and connecting banner image url.
# Size doesn’t matter, any banner sized image will be fine.
#sets banner_detail "https://url.to/image.png”
#sets banner_connecting "https://url.to/image.png”

# Set your server’s hostname
sv_hostname "FXServer, but unconfigured”

# Nested configs!
#exec server_internal.cfg

# Loading a server icon (96×96 PNG file)
#load_server_icon myLogo.png

# convars which can be used in scripts
set temp_convar "hey world!”

# Uncomment this line if you do not want your server to be listed in the server browser.
# Do not edit it if you *do* want your server listed.
#sv_master1 "”

# Add system admins
add_ace group.admin command allow # allow all commands
add_ace group.admin command.quit deny # but don’t allow quit
add_principal identifier.steam:110000100000000 group.admin # add the admin to the group

# Hide player endpoints in external log output.
sv_endpointprivacy true

# Server player slot limit (must be between 1 and 32, unless using OneSync)
sv_maxclients 32

# License key for your server (https://keymaster.fivem.net)
sv_licenseKey i1mqzvi2eukui85p8cb0uddanqsru2lk

終了したら、ファイルを保存して閉じます。

次に、次のコマンドを使用してFiveMサーバーを起動できます。

cd ~/fivem_resources && bash ~/fivem_server/run.sh +exec server.cfg

サーバーが正常に起動すると、次の出力が表示されます。

注:このプロセスの開始には数分かかります

[------------------------------------------------------------------------------------------------------
--------------------------------] 0/315Server license key authentication succeeded. Welcome!
Authenticating with Nucleus...
[#####-------------------------------------------------------------------------------------------------
-------------------------------] 11/315 fff
cccc ff xx xx rr rr eee
cc ffff xx rrr r ee e
cc ff xx ... rr eeeee
ccccc ff xx xx ... rr eeeee

Authenticated with cfx.re Nucleus: https://hitj-e8q3pd.users.cfx.re/
[###############################-----------------------------------------------------------------------------
-------------------------] 74/315-- [server notice: tebex_not_set]
================
Monetize your server using Tebex! Visit https://tebex.io/fivem for more info.
================

CTRL + Cを押します サーバーを停止します。

ステップ4–FiveMのSystemdサービスファイルを作成する

FiveMサービスを管理するためのsystemdサービスファイルを作成することをお勧めします。次のコマンドで作成できます:

nano /lib/systemd/system/fivem.service

次の行を追加します:

[Unit]
Description=FiveM server

[Service]
Type=forking
User=root
ExecStart=/usr/bin/fivem_start.sh

[Install]
WantedBy=multi-user.target

ファイルを保存して閉じてから、FiveM開始スクリプトを作成します。

nano /usr/bin/fivem_start.sh
Add the following lines:


#!/bin/bash
screen -dm bash -c 'cd /root/fivem_resources && bash /root/fivem_server/run.sh +exec 
server.cfg'

ファイルを保存して閉じ、適切な権限を設定します:

chmod +x /usr/bin/fivem_start.sh

次に、次のコマンドを使用してsystemdデーモンをリロードします。

systemctl daemon-reload

次に、FiveMを起動し、システムの再起動時に起動できるようにします。

systemctl start fivem
systemctl enable fivem

次のコマンドを使用して、FiveMのステータスを確認できます。

systemctl status fivem

次の出力が得られるはずです:

  • fivem.service - FiveM server
Loaded: loaded (/lib/systemd/system/fivem.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-13 15:09:13 UTC; 6s ago
Process: 24132 ExecStart=/usr/bin/fivem_start.sh (code=exited, status=0/SUCCESS)
Main PID: 24136 (screen)
Tasks: 67 (limit: 4691)
Memory: 48.1M
CGroup: /system.slice/fivem.service
├─24136 SCREEN -dm bash -c cd /root/fivem_resources && bash /root/fivem_server/run.sh +exec server.cfg
├─24148 /root/fivem_server/alpine/opt/cfx-server/ld-musl-x86_64.so.1 --
library-path /root/fivem_server/alpine/usr/lib/v8/:/root/f>
└─24151 /root/fivem_server/alpine/opt/cfx-server/ld-musl-x86_64.so.1 --
library-path /root/fivem_server/alpine/usr/lib/v8/:/root/f>

Jan 13 15:09:13 ubuntu2004 systemd[1]: Starting FiveM server...
Jan 13 15:09:13 ubuntu2004 systemd[1]: Started FiveM server.
ss -antpl | grep 30120

次の出力が得られるはずです:

LISTEN 0 128 0.0.0.0:30120 0.0.0.0:* users:(("ld-musl-x86_64.",pid=24148,fd=57))

結論

おめでとう!これで、Ubuntu20.04にFiveMゲームサーバーが正常にインストールおよび構成されました。これで、デスクトップシステムにFiveMクライアントをダウンロードし、Atlantic.Netから仮想プライベートサーバーでFiveMを使用してプレイを開始できます。

VPSホスティングサービスと仮想プライベートサーバーの詳細をご覧ください。


Linux
  1. Ubuntuサーバーにロケートをインストールする方法

  2. Ubuntu 22.04 に MariaDB をインストールする方法

  3. Hyper-v に Ubuntu Server 15.10 をインストールする方法

  1. Ubuntu18.04にMySQLをインストールする方法

  2. Ubuntu18.04にMinecraftサーバーをインストールする方法

  3. Ubuntu20.04にNginxをインストールする方法

  1. Ubuntu20.04にMariaDBをインストールする方法

  2. Ubuntu14.04にVNCサーバーをインストールする方法

  3. UbuntuServer22.04にOpenLDAPをインストールする方法