-
-
Save Ashrafdev/0173deccc9c6d6701a08fd98d64e7ab0 to your computer and use it in GitHub Desktop.
A small shell script to install percona-server (and -client).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
############################ | |
# Author: Till Klampaeckel # | |
# License: New BSD License # | |
############################ | |
version=$1 | |
if [ "x$version" = "x" ]; then | |
echo "Usage: ./$0 5.0|5.1" | |
exit 1 | |
fi | |
distro=$(lsb_release -s -c) | |
apt_opt="-q" # --dry-run | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A | |
if [ "$?" -gt 0 ]; then | |
echo "Could not download key." | |
exit 1 | |
fi | |
gpg -a --export CD2EFD2A | apt-key add - | |
if [ "$?" -gt 0 ]; then | |
echo "Could not import key." | |
exit 1 | |
fi | |
percona_repo="/etc/apt/sources.list.d/percona.list" | |
if [ ! -e $percona_repo ]; then | |
repo="deb http://repo.percona.com/apt ${distro} main\n" | |
repo="${repo}deb-src http://repo.percona.com/apt ${distro} main" | |
echo -n "$repo" > $percona_repo | |
fi | |
apt-get -q update | |
if [ "$version" = "5.0" ]; then | |
apt-get install $apt_opt percona-sql-common percona-sql-client-5.0 | |
apt-get install $apt_opt percona-sql-server-5.0 | |
elif [ "$version" = "5.1" ]; then | |
apt-get install $apt_opt percona-server-common percona-server-client-5.1 | |
apt-get install $apt_opt percona-server-server-5.1 | |
else | |
echo "Version: ${version} - wat?" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment