Skip to content

Instantly share code, notes, and snippets.

@kasymovga
Last active January 26, 2024 20:49
Show Gist options
  • Save kasymovga/1f00181ff440eec577426e491b0b6f2c to your computer and use it in GitHub Desktop.
Save kasymovga/1f00181ff440eec577426e491b0b6f2c to your computer and use it in GitHub Desktop.
Rexuiz Server Setup

Requirements:

  • Any modern linux distribution with systemd (CentOS Stream, Oracle Linux 8, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04).
  • Public IP address
  • Basic skills of working with linux console

Step 0. Prepare your system

Disable or setup firewall. For CentOS:

sudo systemctl stop firewalld
sudo systemctl disable firewalld

For Ubuntu:

sudo systemctl stop ufw
sudo systemctl disable ufw

In case of other linux distros check their documentation.

For CentOS you will need disable SELinux:

sudo setenforce 0
sudo sed -i s/SELINUX=enforcing/SELINUX=disabled/ /etc/selinux/config

Also for CentOS you will need enable EPEL repository:

sudo yum install epel-release

Step 1. Install screen and curl

For CentOS-like systems:

sudo yum install screen curl

For Debian-like systems:

sudo apt-get install screen curl

Step 2. Create user

sudo useradd -s /bin/bash -U -m rexuiz

Step 3. Install rexuiz

sudo -u rexuiz curl https://raw.githubusercontent.com/kasymovga/rexuiz/master/scripts/update.sh --output /home/rexuiz/rexuiz_install.sh
sudo -u rexuiz bash /home/rexuiz/rexuiz_install.sh /home/rexuiz/Rexuiz/
sudo -u rexuiz chmod 755 /home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64

Step 4. Create systemd unit

Open /etc/systemd/system/rexuiz.service with you preferred text editor (nano in example):

sudo nano /etc/systemd/system/rexuiz.service

Write this content in file:

[Unit]

Description=rexuiz
After=network.target
[Service]
#Environment=REXUIZ_NOUPDATE=1
#Environment=REXUIZ_LOGDIR=/home/rexuiz/.rexuiz/
#Environment=REXUIZ_SYSLOG=1
User=rexuiz
Group=rexuiz
ExecStart=/usr/bin/screen -DmS rexuiz /bin/sh /home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64
ExecStop=/usr/bin/screen -p 0 -S rexuiz -X eval 'stuff "quit"\015'
Restart=always
[Install]
WantedBy=multi-user.target

Save file and close editor (ctrl-o and ctrl-x in nano, look man nano for details).

Step 5. Create server.cfg

Copy and edit example config file:

sudo -u rexuiz mkdir -p /home/rexuiz/.rexuiz/data
sudo -u rexuiz cp /home/rexuiz/Rexuiz/data/server-example.cfg /home/rexuiz/.rexuiz/data/server.cfg
sudo -u rexuiz nano /home/rexuiz/.rexuiz/data/server.cfg

Step 6. Run your server

Start systemd service:

sudo systemctl enable rexuiz
sudo systemctl start rexuiz

Use this command if you need access to server console:

sudo -u rexuiz script -q -c 'screen -r rexuiz' /dev/null

If you login as rexuiz user, you can use just:

sudo -u rexuiz screen -r rexuiz

Press CTRL-A and when d to leave server console.

Look man screen for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment