GTA RPサーバをさくっと立てる QBCore FiveM Linux

2人用の検証用で1日当たりのお支払いができる Kagoya VPS で1日95円でサーバーを立てる

サーバー

サーバーの選択

Ubuntu 20.04

4コア メモリ4GB ハードディスク600GB

セキュリティグループ

tcp自分の接続用IP22管理用SSH
tcp*30110FiveM用
tcp*30120FiveM用
tcp*40120FiveM用
udp*30110FiveM用
udp*30120FiveM用
udp*40120FiveM用

メモリが足りないのでswapメモリを追加する

メモリが少ないときにHDDから10GBメモリ分を追加する

fallocate -l 10G /swapfile2
chmod 600 /swapfile2
mkswap /swapfile2
swapon /swapfile2
sed -i '$ a /swapfile2 swap swap defaults 0 0' /etc/fstab

確認

free -m

アップデート

apt update && apt upgrade -y

MariaDBのインストール

apt install mariadb-server -y

mysql_secure_installation
rootユーザー用のパスワード入力

change root password をn
remove annonymouse users? Y
Disallow root login remotely Y
Remove test database and access to it? Y
Reload privillege tables now? Y

FiveMディレクトリ作成

mkdir fivem_server && cd $_

サーバーから最新版をダウンロードする

https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/

ここからLATEST RECOMMENDEDのボタンを右クリックでURLをコピー

wget の右側につける

wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/6683-9729577be50de537692c3a19e86365a5e0f99a54/fx.tar.xz

解凍する

tar --no-same-owner -xvf fx.tar.xz && rm fx.tar.xz

MariaDB (mysql)のユーザーを作成

usernameにユーザー名 、passwordを入力する(英字のみ)

mysql

create user 'username'@'%' identified by 'password';
grant all privileges on *.* to 'username'@'%' identified by 'password';
flush privileges;
exit

サーバーアプリを起動する

screen -S fivem bash ./run.sh

接続は閉じずにブラウザから操作する

FiveMのライセンスキーを発行する

https://keymaster.fivem.net/

(アカウントの作成は省略します)

Register a new serverを押す

Display name サーバ名適当

Initial server IP addresss サーバーのIPアドレスを入れる

Server type VPS

which server provider are you using? kagoya

Generateを押して、 ライセンスキー をコピーする

ブラウザで、http://サーバのIP:40120 に接続する

先ほどのSSH接続画面のPINを入力してLinkAccount

パスワードを2回いれて Licenseにチェックをつけて、 Create Master Account

Nextを押して

Server Name にサーバー名を入力

Popular Recipes[RECOMMENDED]を選択

QBCore Frameworkを選択

サーバーのFiveMインストール場所を選択

Go to Recipe Deployerを押す

Step1. RecipeをNextを押す

Step2 先ほどコピーしたライセンスキーを貼付ける

Show/Hide Database options(Advanced)

Database UserNameを先ほどMariaDBで作ったユーザー

Database Password にパスワード

Run Recipeを押す

100%になったら Doneを押して Save & Run Serverを押して開始する

クライアント

ここからDownload Clientを押して ダウンロードをする

https://fivem.net/

Playを押して 検索にサーバー名をいれるか

>IPアドレスを入れる

※↑かっこも重要

MOD

MODは有料と無料がある

QBCoreのをダウンロードする

https://forum.cfx.re/c/development/releases/7

https://fivem-mods.net/

https://okok.tebex.io/

https://buy.quasar-store.com/

https://github.com/AvarianKnight/pma-voice

https://github.com/TayMcKenzieNZ/rpemotes

rpemotesのgitがアクセスできなくなった
→ 変わりにここから取得した https://github.com/djontop/rpemotes

https://lbphone.com/

modはインストールした場所のresourceに入れる

/home/fivem_server/txData/QBCore***********/resources

Txadminの日本語化

https://github.com/Yagami-Huki/txAdminJP

サーバーのコマンドとかはこことか参考になりました

https://gamesv.mcpoteton.com/game-server/qbcore-setting

txadminのDLC設定

Settings > FXServer > Additional Arguments

+set sv_enforceGameBuild DLC番号

DLC番号は下記から

https://zap-hosting.com/guides/docs/fivem-gamebuild/

旗を日本に変える server.cfg

sets locale "ja-JP"

サーバーの説明欄にTwitterのURLを載せる server.cfg

sets Twitter "https://twitter.com/Misaki_Vanilla"

FiveMのキャッシュフォルダ

C:\Users\ユーザー名\AppData\Local\FiveM\FiveM Application Data\data

FiveMとRockstargameのアカウント紐付けはこのファイル

C:\Users\ユーザー名\AppData\Local\DigitalEntitlements 

FiveMの設定ファイルの場所

C:\Users\ユーザー名\AppData\Roaming\CitizenFX

txadminの自動起動のサービス化について

/etc/systemd/system/fivem.service

[Unit]
Description=FiveM Server txadmin

[Service]
Type=simple
User=root
ExecStart=/bin/screen -DmS fivem /bin/bash ./run.sh
ExecStop=/bin/screen -DmS fivem -X quit
WorkingDirectory=/home/fivem_server

[Install]
WantedBy=multi-user.target
ステータス確認
systemctl status fivem

開始
systemctl start fivem

停止
systemctl stop fivem

再起動
systemctl restart fivem

自動起動登録
systemctl enable fivem

自動起動登録解除
systemctl disable fivem

最新のtxadminは txadminのDiscordで配布するようになった。

https://discord.gg/yWxjt9zPWR