Skip to content

Instantly share code, notes, and snippets.

@runekaagaard
Last active November 8, 2024 15:04
Show Gist options
  • Save runekaagaard/0ef1cab7f916cd3ae294bb8343f652b3 to your computer and use it in GitHub Desktop.
Save runekaagaard/0ef1cab7f916cd3ae294bb8343f652b3 to your computer and use it in GitHub Desktop.
Unattended install of mysql 5.7.42 (latest ubuntu deb packages) on Ubuntu 22.04. Change ROOT_PASSWORD. Choose gdal support.
#!/bin/bash
set -e
# Pre-configure root password
export DEBIAN_FRONTEND=noninteractive
ROOT_PASSWORD="your_password_here"
debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $ROOT_PASSWORD"
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $ROOT_PASSWORD"
mkdir -p /tmp/mysql-install
cd /tmp/mysql-install
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
tar xf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
apt install -y \
./mysql-common_5.7.42-1ubuntu18.04_amd64.deb \
./libmysqlclient20_5.7.42-1ubuntu18.04_amd64.deb \
./mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb \
./mysql-client_5.7.42-1ubuntu18.04_amd64.deb \
./mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb \
./mysql-server_5.7.42-1ubuntu18.04_amd64.deb \
./libmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deb
cd -
rm -rf /tmp/mysql-install
# For Python MySQL and GDAL support
apt install -y python3-dev build-essential gdal-bin libgdal-dev
# If the pypi package mysqlclient is already installed we need to do:
pip uninstall -y mysqlclient
pip install --no-binary mysqlclient mysqlclient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment