Skip to content

Compiling on Ubuntu 22.04

João Paulo edited this page Jul 31, 2025 · 4 revisions

Crystal Server

Supported OS

  • Ubuntu 22.04

1. Install the required software

The following command will install Git, CMake, a compiler and the libraries used by Crystal Server

Git will be used to download the source code, and CMake will be used to generate the build files.

sudo apt update && sudo apt dist-upgrade -y
sudo apt install git cmake build-essential autoconf libtool ca-certificates curl zip unzip tar pkg-config ninja-build ccache linux-headers-$(uname -r) -y

Update cmake

sudo apt remove --purge cmake -y
hash -r
sudo apt install snapd -y
sudo snap install cmake --classic
cmake --version

Update gcc

sudo apt update
sudo apt install gcc-12 g++-12 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives --set gcc /usr/bin/gcc-12
gcc-12 --version
g++-12 --version

Install vcpkg

sudo apt install acl
cd ~
git clone https://github.com/microsoft/vcpkg
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg install --triplet x64-linux-release 
cd ~

2. Download the source code

git clone --depth 1 https://github.com/zimbadev/crystalserver.git
sudo setfacl -R -m g:www-data:rx /home/$USER/
sudo setfacl -R -m g:www-data:rx /home/$USER/crystalserver
sudo chmod -R 775 crystalserver
cd crystalserver
mv config.lua.dist config.lua

3. Folder structure

.
├── crystalserver
└── vcpkg

5. Configure and build

mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake .. --preset linux-release
cmake --build linux-release
cd ~
cd crystalserver
cp -r build/linux-release/bin/crystalserver.
sudo chmod +x crystalserver
Clone this wiki locally