Markus Michalski FAQ

Server Tools: Installation

Install, update and uninstall Server Tools: installer steps, created paths, MySQL access via .my.cnf, running without installation and what uninstalling leaves in place.

Deutsche Version

Back to overview


Installation

Install

git clone https://github.com/markus-michalski/server-tools-v2.git
cd server-tools-v2
git checkout "$(git tag -l 'v*' | sort -V | tail -1)"
sudo ./bin/server-tools install

Check out the latest release tag. The main branch may contain untested changes.

sudo make install calls the same installer (./bin/server-tools install).

The installer does the following, in order:

Step Result
Config directory /etc/server-tools/ (755), if missing
Config file Copy of conf/server-tools.conf.example to /etc/server-tools/config (600), only if the file does not exist yet
Credential directory /root/db-credentials/ with umask 077, if missing
Backup directory /root/server-tools-backups/ (700), if missing
Audit log directory /var/log/ or the directory of ST_AUDIT_LOG, if missing
Libraries All lib/*.sh and lib/webserver/*.sh to /usr/local/lib/server-tools/ (644)
Version marker File .version in the library directory, containing the output of git describe --tags --always of the clone
Binary /usr/local/bin/server-tools (700), the library path inside it is rewritten to the installation directory
Shortcuts Symlinks st and servertools next to the binary

The paths change if your existing config file sets other values for ST_CREDENTIAL_DIR, ST_BACKUP_DIR, ST_AUDIT_LOG, ST_INSTALL_DIR or ST_BIN_DIR, because the installer loads the config before installing.

The installer does not create the directory for database dumps (ST_DB_BACKUP_DIR). db backup creates it when needed with mode 700.

Because the binary has mode 700, always start it with sudo.

The installer aborts if you start it from the already installed copy. Start it from the Git clone.

If the version cannot be determined via git describe, the installer writes dev into the marker and prints a warning.

Run without installing

sudo ./bin/server-tools

The binary then uses the libraries from ../lib relative to itself. If no library is there, it looks in /usr/local/lib/server-tools, otherwise it aborts with ERROR: Cannot find server-tools libraries.

Update

cd server-tools-v2
git fetch --tags
git checkout "$(git tag -l 'v*' | sort -V | tail -1)"
sudo ./bin/server-tools install

Running it again overwrites libraries, binary and shortcuts. An existing config file stays unchanged, even if the template contains new variables. You add new options yourself, see Configuration.

Uninstall

sudo server-tools uninstall

or sudo make uninstall.

Removed Kept
/usr/local/bin/server-tools /etc/server-tools/config
The symlinks st and servertools, only if they point to the binary Credential files in /root/db-credentials/
/usr/local/lib/server-tools/, only if core.sh and install.sh are in it Backups in /root/server-tools-backups/ and /root/db-backups/
The audit log /var/log/server-tools-audit.log
Everything the tool managed: databases, VHosts, certificates, SSH users, cron files, logrotate files

Uninstalling removes only the tool. What ssl renew created (/usr/local/bin/ssl-renewal.sh and /etc/cron.d/ssl-renewal) also stays in place.

MySQL/MariaDB access

Database management uses the options file from ST_MYSQL_CONFIG_FILE (default /root/.my.cnf) as --defaults-file:

[client]
user=root
password=your_root_password
sudo chmod 600 /root/.my.cnf

If the file permissions are not 600 or 400, the tool prints a warning but continues. If the file is missing, every database operation aborts with MySQL config not found.

First test

sudo server-tools --version
sudo server-tools --config
sudo server-tools status

Next