Skip to content

Instantly share code, notes, and snippets.

Last active November 24, 2020 06:21
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Raspberry Pi MariaDB 10.1 with Galera Cluster build
if [ "$EUID" -ne 0 ]
then echo "Must be root"
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
apt-get install -y build-essential git cmake scons rpi-update
apt-get install -y libarchive-dev libevent-dev libssl-dev libboost-dev
apt-get install -y libncurses5-dev libbison-dev
cd /tmp
git clone -b 10.1 --depth=1 mariadb-server-src
cd mariadb-server-src
make install
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
update-rc.d mysqld defaults
echo "export PATH=\${PATH}:/usr/local/mysql/bin/" > /etc/profile.d/mysql
groupadd mysql && useradd -g mysql mysql
mkdir -p /srv/mysql
rm -rf /etc/mysql
install -v -dm 755 /etc/mysql &&
cat > /etc/mysql/my.cnf << "EOF"
# Begin /etc/mysql/my.cnf
# The following options will be passed to all MySQL clients
#password = your_password
port = 3306
socket = /run/mysqld/mysqld.sock
# The MySQL server
port = 3306
socket = /run/mysqld/mysqld.sock
datadir = /srv/mysql
key_buffer_size = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 16K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all.
# required unique id between 1 and 2^32 - 1
server-id = 1
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000
# InnoDB tables are now used by default
innodb_data_home_dir = /srv/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /srv/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
max_allowed_packet = 16M
# Remove the next comment character if you are not familiar with SQL
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
# End /etc/mysql/my.cnf
source /etc/profile.d/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/srv/mysql --basedir=/usr/local/mysql
chown -R mysql:mysql /srv/mysql
apt-get install -y libboost-program-options-dev check
cd /tmp
git clone --depth=1
cd galera
if [ -d "/etc/php/7.0" ]; then
apt-get install -y php7.0-mysql
Copy link

ronie19 commented May 14, 2020

Someone on Facebook did point to this blog while I put my requirements there

Copy link

sanfx commented Nov 23, 2020

FYI future visitors galera is part of mariadb-server from mariadb version 10.4 onwards

Copy link

Thx @sanfx, this is from 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment