|
| 1 | +--- |
| 2 | +title: Headless Linux Server |
| 3 | +sidebar_label: Headless Linux Server |
| 4 | +sidebar_position: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +:::note |
| 8 | +This has been written and tested on Ubuntu 24.04, but should be translatable to other ubuntu/debian based distributions with little effort. |
| 9 | +It require CasparCG 2.5.0 or later, earlier versions do not support running without a x11 server. |
| 10 | +::: |
| 11 | + |
| 12 | +The aim of this, is to setup a server to run CasparCG on startup, without needing any manual intervention or login or user session. |
| 13 | + |
| 14 | +:::info |
| 15 | +This is quite barebones, and does not attempt to harden the setup in any way. |
| 16 | +Please contribute any tips or improvements you may have |
| 17 | +::: |
| 18 | + |
| 19 | +## Basic system setup |
| 20 | + |
| 21 | +1) Install Ubuntu 24.04 on your machine. You can choose the minimal install, and perform disk and other setup as you wish. |
| 22 | + |
| 23 | +2) Ensure the system is fully updated |
| 24 | + `sudo apt update && sudo apt upgrade` |
| 25 | + |
| 26 | +3) Install nvidia drivers |
| 27 | + `apt install nvidia-driver-570-server` |
| 28 | + |
| 29 | +4) Install some common tools |
| 30 | + `apt install wget nano` |
| 31 | + |
| 32 | +## Install Decklink drivers |
| 33 | + |
| 34 | +1) Download these from the Blackmagic website. You may need to use the latest to ensure there aren't issues compiling against the kernel. |
| 35 | + To do so directly onto the server, you can start the download locally to determine a valid url and then perform that on the server with: |
| 36 | + `wget "some-url-here" -O Blackmagic_Desktop_Video_Linux.tar.gz` |
| 37 | + |
| 38 | +2) Extract the drivers |
| 39 | + `tar -xvzf Blackmagic_Desktop_Video_Linux.tar.gz` |
| 40 | + |
| 41 | +3) Install the needed package |
| 42 | + `sudo apt install -y Blackmagic_Desktop_Video_Linux/deb/x86_64/desktopvideo_*.deb` |
| 43 | + Make sure to not install the gui portion, or it will pull in a lot more dependencies than are necessary |
| 44 | + |
| 45 | +## Install the server |
| 46 | + |
| 47 | +### Specific version |
| 48 | + |
| 49 | +1) Download CasparCG onto your machine, and extract the zip if there is any |
| 50 | + |
| 51 | +2) Install the scanner |
| 52 | + `sudo apt install -y casparcg-scanner*.deb` |
| 53 | + |
| 54 | +3) Install CEF |
| 55 | + `sudo apt install -y casparcg-cef*.deb` |
| 56 | + |
| 57 | +4) Install CasparCG |
| 58 | + `sudo apt install -y casparcg-server*.deb` |
| 59 | + |
| 60 | +### Latest version |
| 61 | + |
| 62 | +An Ubuntu PPA is also maintained, which contains the latest version of each minor release: https://launchpad.net/~casparcg/+archive/ubuntu/ppa |
| 63 | + |
| 64 | +If you are less particular about the version, and are ok with it being updated with your system updates, you can install from there instead: |
| 65 | + |
| 66 | +1) Setup the PPA |
| 67 | + ``` |
| 68 | + sudo add-apt-repository ppa:casparcg/ppa |
| 69 | + sudo apt update |
| 70 | + ``` |
| 71 | +
|
| 72 | +2) Install the packages |
| 73 | + `sudo apt install -y casparcg-server casparcg-scanner` |
| 74 | +
|
| 75 | +:::tip |
| 76 | +You can install a specific minor version instead of the latest with `sudo apt install -y casparcg-server-2.4`. |
| 77 | +Multiple of these can be installed at once, each provides a binary named the same as the package |
| 78 | +::: |
| 79 | +
|
| 80 | +### Configure CasparCG |
| 81 | +
|
| 82 | +The exact path of the configuration is not too important, but you need to make sure that everywhere references the same. For simplicity, we shall do so under `/opt/casparcg`. You are free to put it elsewhere or split it up like is possible on windows. |
| 83 | +
|
| 84 | +1) Create a system user to run casparcg as |
| 85 | + `sudo adduser casparcg --system --no-create-home` |
| 86 | +
|
| 87 | +2) Create configuration directory |
| 88 | + `sudo mkdir /opt/casparcg && sudo chown casparcg /opt/casparcg` |
| 89 | +
|
| 90 | +3) Copy default configuration |
| 91 | + `sudo cp /usr/share/casparcg-server-beta/casparcg.config /opt/casparcg/` |
| 92 | + Note: the source path of this may be different, depending on what version you installed |
| 93 | +
|
| 94 | +4) Edit the config as required |
| 95 | + `sudo nano /opt/casparcg/casparcg.config` |
| 96 | +
|
| 97 | +### Setup autostart |
| 98 | +
|
| 99 | +1) Create scanner config |
| 100 | + `sudo nano nano etc/systemd/system/casparcg-scanner.service` |
| 101 | + With the content: |
| 102 | + ``` |
| 103 | + [Unit] |
| 104 | + Description=CasparCG Scanner |
| 105 | +
|
| 106 | + [Service] |
| 107 | + Type=simple |
| 108 | + User=casparcg |
| 109 | + #Group= |
| 110 | + WorkingDirectory=/opt/casparcg |
| 111 | + ExecStart=/usr/bin/casparcg-scanner |
| 112 | + Restart=on-failure |
| 113 | + [Install] |
| 114 | + WantedBy=default.target |
| 115 | + ``` |
| 116 | +
|
| 117 | +2) Create server config |
| 118 | + `sudo nano nano etc/systemd/system/casparcg-server.service` |
| 119 | + With the content: |
| 120 | + ``` |
| 121 | + [Unit] |
| 122 | + Description=CasparCG Server |
| 123 | + After=network-online.target |
| 124 | + Wants=network-online.target |
| 125 | +
|
| 126 | + [Service] |
| 127 | + Type=simple |
| 128 | + User=casparcg |
| 129 | + #Group= |
| 130 | + WorkingDirectory=/opt/casparcg |
| 131 | + ExecStart=/usr/bin/casparcg-server-beta |
| 132 | + Restart=on-failure |
| 133 | +
|
| 134 | + [Install] |
| 135 | + WantedBy=multi-user.target |
| 136 | + ``` |
| 137 | + Note: the name of the executable here may need changing to match the version of casparcg you have installed |
| 138 | +
|
| 139 | +3) Start everything |
| 140 | + ``` |
| 141 | + sudo systemctl daemon-reload |
| 142 | + sudo systemctl enable --now casparcg-scanner |
| 143 | + sudo systemctl enable --now casparcg-server |
| 144 | + ``` |
| 145 | + Note: you may need to reboot for it to start correctly. |
| 146 | +
|
| 147 | +## Recommended config changes |
| 148 | +
|
| 149 | +You should disable the builtin logging to disk, as journald will also be doing this for you. |
| 150 | +Update the `<log-path disable="true">log/</log-path>` line to set `disable` to `true` |
| 151 | +
|
| 152 | +If using CEF/HTML, you will likely want to enable gpu mode and setup a cache path |
| 153 | +``` |
| 154 | +<html> |
| 155 | + <enable-gpu>true</enable-gpu> |
| 156 | +</html> |
| 157 | +``` |
| 158 | +
|
| 159 | +## Debugging |
| 160 | +
|
| 161 | +If you want to more rapidly iterate on configuration, it can often be easier to disable the systemd launch, and start the server manually |
| 162 | +
|
| 163 | +``` |
| 164 | +cd /opt/casparcg |
| 165 | +sudo systemctl stop casparcg-server |
| 166 | + |
| 167 | +# edit the config |
| 168 | +nano casparcg.config |
| 169 | +casparcg-server-beta |
| 170 | + |
| 171 | +# once done |
| 172 | +sudo systemctl start casparcg-server |
| 173 | +``` |
0 commit comments