To start developing with Nakama, you first need to install it on your development machine. It’s simple and it only takes a few minutes. In this guide, we will focus on installing Nakama development instances using binary executables.
“Recommended Method” : Docker is the fastest way to download and start developing with Nakama. For production environment Settings, we recommend that you install Nakama in binary form to ensure that all system resources are available to Nakama.
demand
Before installing Nakama, you need to know, or must know, the following:
- Operating system: Windows 7 64-bit or above, MacOS 10.9 or above, or modern Linux.
- Architecture: X86_64(64-bit) processor architecture
- Software dependency: Nakama relies on CockroachDB.
Install CockroachDB
Nakama relies on CockroachDB as its primary and only database. Nakama uses CockroachDB to store server configuration, user data, chat messages, and more persistent data.
First you need to install the CockroachDB. Follow this guide to install CockroachDB on your machine before installing Nakama.
“CockroachDB Alternative “: For environments without CockroachDB, Nakama has unofficial support for PostgreSQL.
For production Settings, Nakama should be used with CockroachDB because queries have been optimized for how data is stored on disk.Copy the code
Install Nakama on MacOS
You need to run MacOS 10.9 (Mavericks) or higher to run Nakama.
There is no Homebrew
Installing binaries directly rather than through Homebrew gives you the flexibility to place your server in your preferred workspace. However, installing via Homebrew is the simplest and easiest — including updates — because everything is handled using the Homebrew workflow.
1. Download the latest Nakama Tarball for MacOS.
2. Then extract the binary:
# replace the X.X.X with the version number you have downloaded
tar xfz nakama-X.X.X-darwin-amd64.tar.gz
Copy the code
3. Add the directory containing the binary files to the PATH. This makes it easy to execute Nakama commands from the terminal.
cp -i nakama /usr/local/bin
Copy the code
You may experience permission errors. If you prefer to operate as root, prefix the command with sudo.
4. Migrate the database schema and start Nakama
# migrate schema
nakama migrate up
# start the server
nakama
Copy the code
Install Nakama on Windows
Nakama can also be used as a Windows binary. However, it is recommended to install CockroachDB and Nakama on Windows using Docker.
- Download the binary file and unzip the downloaded file.
- Open the Powershell terminal and navigate to the folder where you downloaded Nakama.
- Migrate the database schema, then start Nakama
# migrate schema
nakama.exe migrate up
# start the server
nakama.exe
Copy the code
Install Nakama on Linux
Use Docker – this is the recommended method. We will soon have packages available for various Linux package managers to simplify the installation process. Let us know if you need a specific package manager.
First, you need to create an appropriate directory to install Nakama. To some extent, its location depends on your particular preference for Linux and your own preference.
1. Download the binary file and decompress the downloaded file.
2. Then extract the binary:
# replace the X.X.X with the version number you have downloaded
tar xfz nakama-X.X.X-linux-amd64.tar.gz
Copy the code
3. Add the directory containing the binaries to your PATH. This makes it easy to execute Nakama commands from the terminal.
cp -i nakama /usr/local/bin
Copy the code
4. Migrate the database schema and start Nakama
# migrate schema
nakama migrate up
# start the server
nakama
Copy the code
You may experience permission errors. If you prefer to operate as root, precede the command with sudo.
systemd
If you prefer to run Nakama as a service and you are running a distribution that uses Systemd, you may choose to use the following script.
You need to update the path in the Systemd configuration.
1. Create a service file: / usr/lib/systemd/system/nakama. Service
“nakama.service”
[Unit]
Description=Nakama server
[Service]
ExecStart=/path/to/nakama --config /path/to/nakama/config.yml
KillMode=process
[Install]
WantedBy=multi-user.target
Copy the code
2. Update file permissions so that they can be read by the Systemd daemon
sudo chmod 644 /usr/lib/systemd/system/nakama.service
Copy the code
3. Enable and run the service
sudo systemctl enable nakama
sudo systemctl start nakama
Copy the code
Chinese Online Documentation
Nakama Server 中文 版