Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Last active April 27, 2017 21:09
Show Gist options
  • Save mamemomonga/2823ecc2b20b886e90d1b8d523515724 to your computer and use it in GitHub Desktop.
Save mamemomonga/2823ecc2b20b886e90d1b8d523515724 to your computer and use it in GitHub Desktop.
Install MariaDB Client 10.1 for Debian8, Ubuntu 16.04
#!/bin/bash
# ----------
# Install MariaDB Client 10.1 for Debian8, Ubuntu 16.04
# curl -L https://gist.githubusercontent.com/mamemomonga/2823ecc2b20b886e90d1b8d523515724/raw/MariaDBInstall.sh | sudo bash -eux
# ----------
set -eux
if [ `id --user` -ne 0 ]; then
echo "rootでの実行が必要"
exit 255
fi
export DEBIAN_FRONTEND=noninteractive
if [ -e '/etc/lsb-release' ]; then
# MariaDB 10.1 Ubuntu 16.04 LTS xenial
if [ -z "$(grep 'xenial' /etc/lsb-release)" ]; then
echo "Ubuntu 16.04 LTS xenialが確認できません"
exit 2
fi
sudo apt-get install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.1/ubuntu xenial main'
sudo apt -y update
elif [ -e '/etc/debian_version' ]; then
# MariaDB 10.1 Debian 8 Jessie
if [ -z "$(cat /etc/debian_version | perl -nle 'print $_ if(/^8\.\d+$/)')" ]; then
echo "Debian 8が確認できません"
exit 2
fi
sudo apt-get install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.1/debian jessie main'
sudo apt-get update
fi
sudo apt-get install -y mariadb-client libmariadbd-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment