TheRobotLearns Platform · ProxySQL: from first install to production

Choose an installation path and install ProxySQL

  • about 18 min read

Learning objectives

  • Confirm ProxySQL host prerequisites for OS, MySQL/MariaDB, and network before installation.
  • Compare package-manager versus source installation for version freshness, customization, dependencies, and maintenance.
  • Install ProxySQL using GitHub packages, distribution repositories, or a generic Linux tarball.
  • Prepare generic ProxySQL tarballs: verify checksum/signature, create service user, and enable systemd.
  • Use repository commands for Debian-family, RedHat-family, SUSE, and Amazon Linux targets.
  • Plan ProxySQL tarball upgrades and rollbacks with stopped-state backups and matching plugins.

Check the host before install

Before installation, ensure the host meets the prerequisites from the installation guide:

  • Supported OS — Linux: Ubuntu, Debian, CentOS, or RHEL.
  • System resources — Sufficient RAM, CPU, and disk space for the anticipated workload.
  • MySQL / MariaDB — Must be installed and running before configuring ProxySQL backends.
  • Network — Connectivity between ProxySQL and database servers with appropriate firewall rules.
  • Admin privileges — Required for installation and service management.
  • Package manager — apt (Debian/Ubuntu) or yum (CentOS/RHEL); update before installing.
  • DNS (optional) — Configure DNS if using hostnames rather than IP addresses for backend servers.

ProxySQL offers packaged releases for RedHat & CentOS, Amazon Linux, Debian, Ubuntu, Almalinux, and OpenSUSE Leap. The supported OS table lists versions for package installations: RedHat & CentOS 10, 9, 8, 7; Amazon Linux 2023, 2; Debian 13, 12, 11, 10; Ubuntu 24, 22, 20, 18, 16; Almalinux 10, 9, 8; OpenSUSE Leap 15, 16. Asterisked versions apply to ProxySQL v2.7.x and older releases only.

Takeaway: Confirm OS, database availability, network, privileges, and package tools before choosing apt, yum, zypper, or source installation.

Compare package and source paths

You need the newest ProxySQL code or a build with custom options? The comparison table lists version freshness, customization, dependency handling, and maintenance.

Building from source gives the latest version and full control over customization. It uses manual dependency handling and self-managed maintenance. A package manager may lag behind the latest version and gives limited customization. It handles dependencies automatically and provides streamlined maintenance.

The source path tells you to clone the repository and install build dependencies such as cmake and Boost libraries. On Debian/Ubuntu, you then run make and sudo make install. The package-manager path uses sudo apt install proxysql or sudo yum install proxysql and leaves dependency handling to the package system.

Use packages when automatic dependency handling and streamlined maintenance matter. Use source when you need the latest version and full control.

Takeaway: Choose source for latest and full control; choose packages for automatic dependencies and streamlined maintenance.

Install from repos or GitHub

You install ProxySQL by adding a repository or downloading a package from GitHub. On Debian or Ubuntu, the repository route installs helper packages, adds the key, registers the tree, and installs proxysql.

apt-get install -y --no-install-recommends lsb-release wget apt-transport-https ca-certificates gnupg
wget -nv -O /etc/apt/trusted.gpg.d/proxysql-3.0.x-keyring.gpg 'https://repo.proxysql.com/ProxySQL/proxysql-3.0.x/repo_pub_key.gpg'
echo deb https://repo.proxysql.com/ProxySQL/proxysql-3.0.x/$(lsb_release -sc)/ ./ | tee /etc/apt/sources.list.d/proxysql.list
apt-get update
apt-get install proxysql

The echo deb line uses $(lsb_release -sc) to select the distribution-specific directory. If you need one release, pin it with apt-get install proxysql=PROXYSQL_VERSION-ubuntu22.

For older series, replace proxysql-3.0.x in the repository URL with proxysql-2.7.x, proxysql-2.6.x, and so on.

RedHat-family hosts use a repo file in /etc/yum.repos.d/proxysql.repo with gpgcheck=1, then you run yum install proxysql. The file content is:

cat <<EOF | tee /etc/yum.repos.d/proxysql.repo
[proxysql_repo]
name=ProxySQL repository
baseurl=https://repo.proxysql.com/ProxySQL/proxysql-3.0.x/centos/\$releasever
gpgcheck=1
gpgkey=https://repo.proxysql.com/ProxySQL/proxysql-3.0.x/repo_pub_key
EOF

This writes the repo file, and the next command installs proxysql. The same file pattern changes only the baseurl. Use almalinux/$releasever for the AlmaLinux entry. For Amazon Linux, use CentOS packages: centos/9 for Amazon Linux 2023 and centos/7 for Amazon Linux 2.

OpenSUSE Leap uses zypper. The first command adds the repository with -g -n 'ProxySQL repository'. The second installs proxysql and imports the key with --gpg-auto-import-keys.

You can also download a GitHub release asset and install it with dpkg -i. The commands fetch the .deb and install the package:

wget https://github.com/sysown/proxysql/releases/download/vPROXYSQL_VERSION/proxysql_PROXYSQL_VERSION-ubuntu22_amd64.deb
dpkg -i proxysql_PROXYSQL_VERSION-ubuntu22_amd64.deb

Takeaway: Add a repository, or install a GitHub asset with dpkg; only the repository path changes across Debian, RedHat-family, Amazon, AlmaLinux, and OpenSUSE.

Use a tarball when needed

Generic release tarballs are useful when no matching RPM or DEB is available. They are built on AlmaLinux 9 and target Linux systems with glibc 2.34 or newer and OpenSSL 3. Unlike a distribution package, a tarball does not create the service account, install files into system paths, or register the service. The operator owns those steps and the upgrade/rollback procedure.

Release assets use this version-independent naming scheme:

proxysql-<version>-linux-amd64.tar.gz
proxysql-<version>-linux-arm64.tar.gz

Choose amd64 for x86_64 and arm64 for aarch64/arm64. Set the release version explicitly rather than copying a version from this page:

PROXYSQL_VERSION='<release-version>'

case "$(uname -m)" in
  x86_64)         PROXYSQL_ARCH=amd64 ;;
  aarch64|arm64)  PROXYSQL_ARCH=arm64 ;;
  *) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac

PROXYSQL_ARCHIVE="proxysql-${PROXYSQL_VERSION}-linux-${PROXYSQL_ARCH}.tar.gz"
PROXYSQL_RELEASE_URL="https://github.com/sysown/proxysql/releases/download/v${PROXYSQL_VERSION}"

curl -fLO "${PROXYSQL_RELEASE_URL}/${PROXYSQL_ARCHIVE}"
curl -fLO "${PROXYSQL_RELEASE_URL}/${PROXYSQL_ARCHIVE}.sha256"
curl -fLO "${PROXYSQL_RELEASE_URL}/${PROXYSQL_ARCHIVE}.asc"

Import the ProxySQL release signing key from a separately authenticated source and verify its fingerprint under your organization's trust policy. Then verify the detached signature and the published checksum before extracting anything:

gpg --verify "${PROXYSQL_ARCHIVE}.asc" "${PROXYSQL_ARCHIVE}"
sha256sum -c "${PROXYSQL_ARCHIVE}.sha256"

Both commands must succeed. A checksum detects a damaged download; the signature, together with an independently verified signing key, authenticates the artifact.

tar tzf "${PROXYSQL_ARCHIVE}"
tar xzf "${PROXYSQL_ARCHIVE}"
cd "proxysql-${PROXYSQL_VERSION}-linux-${PROXYSQL_ARCH}"

The archive contains:

  • bin/proxysql - the ProxySQL executable;
  • etc/proxysql.cnf and etc/logrotate.d/proxysql - sample configuration and log rotation;
  • systemd/system/proxysql.service and proxysql-initial.service - service units;
  • share/proxysql/tools/ - operational helper scripts; and
  • lib/proxysql/ - runtime plugins when included by the release tier, notably in 4.0 builds.

The bundled systemd unit expects /usr/bin/proxysql, /etc/proxysql.cnf, a proxysql user and group, and a writable /var/lib/proxysql. The following is a starting point for a systemd host; adapt the service-account commands and nologin path to the distribution:

sudo groupadd --system proxysql
sudo useradd --system --gid proxysql --home-dir /var/lib/proxysql --shell /usr/sbin/nologin proxysql
sudo install -d -o proxysql -g proxysql -m 0750 /var/lib/proxysql
sudo install -o root -g root -m 0755 bin/proxysql /usr/bin/proxysql
sudo install -o root -g proxysql -m 0640 etc/proxysql.cnf /etc/proxysql.cnf
sudo install -o root -g root -m 0644 systemd/system/proxysql.service systemd/system/proxysql-initial.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable proxysql

If lib/proxysql/ is present, install its contents under /usr/lib/proxysql/ and configure only the plugins you intend to load. Before the first start, edit /etc/proxysql.cnf, replace the sample Admin credentials, restrict admin_variables.mysql_ifaces to trusted interfaces, and review every other listener. Install log rotation as appropriate and confirm file ownership. Start the service only after those security settings are in place:

sudo systemctl start proxysql

Use proxysql-initial.service only when you intentionally want --initial behavior.

Before an upgrade, record the current version and test the new tarball with the same libc/OpenSSL baseline and configuration in a staging environment. During the change window, stop ProxySQL before making a raw-copy backup of the executable, configuration, plugin directory, and /var/lib/proxysql/proxysql.db. The database backup contains credentials and other sensitive configuration; restrict its permissions and protect its storage and transport. After the stopped-state backup completes, install the matching executable and plugins, then start and verify the service before removing the backup.

For rollback, stop ProxySQL and restore the previous executable and matching plugins. If the newer release changed the on-disk schema or configuration, restore its matching proxysql.db backup while ProxySQL is stopped; do not assume a database written by a newer version is backward compatible.

Distribution packages remain preferable when available: the RPM/DEB lifecycle handles dependency metadata, standard paths, service-account creation, systemd integration, package signatures, upgrades, and removal. Generic tarballs provide portability, but those responsibilities remain with the administrator.

Takeaway: Import and independently verify the signing key, verify the checksum, create the proxysql service user, edit /etc/proxysql.cnf before first start, and make stopped-state backups with matching plugins.

Verify the install before the Admin interface

-- Installation steps show:
-- proxysql --version
-- mysql -u admin -padmin -h 127.0.0.1 -P 6032 --prompt='ProxySQLAdmin> '

proxysql --version verifies the installed version. mysql -u admin -padmin -h 127.0.0.1 -P 6032 --prompt='ProxySQLAdmin> ' connects to the Admin interface. Use 127.0.0.1, not localhost, because the MySQL client uses a Unix socket for localhost.

Sources

Do more with an account

Choose an installation path and install ProxySQL — ProxySQL: from first install to production