-
-
Save someburner/2f609ffe7b85fb611f39aeb65294937c to your computer and use it in GitHub Desktop.
Install Redis from source (Ubuntu)
This file contains hidden or 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/bash | |
if [ "$(whoami)" != "root" ]; then | |
echo "ERROR : Run script as Root (sudo !!) please" | |
exit 1 | |
fi | |
read -e -p "Redis version to be installed (change if needed) : " -i "2.8.2" VERSION | |
echo 'Installing redis v.'$VERSION' ... ' | |
# installing build essentials if it is missing | |
apt-get install build-essential | |
wget http://download.redis.io/releases/redis-$VERSION.tar.gz | |
tar xzf redis-$VERSION.tar.gz | |
cd redis-$VERSION | |
make | |
make install prefix=/usr/local/bin/ | |
cp redis.conf /etc/redis.conf | |
cd .. | |
rm redis-$VERSION -R | |
rm redis-$VERSION.tar.gz | |
# create user and autostart | |
useradd -r -s /bin/false redis | |
wget -O /etc/init.d/redis-server https://gist.github.com/iJackUA/5336459/raw/4d7e4adfc08899dc7b6fd5d718f885e3863e6652/redis-server-for-init.d-startup | |
touch /var/run/redis.pid | |
chown redis:redis /var/run/redis.pid | |
chmod 755 /etc/init.d/redis-server | |
# add overcommit memory change (if not already present) | |
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf | |
sysctl vm.overcommit_memory=1 | |
# UNCOMMENT IF NEEDED to do autostart | |
# update-rc.d redis-server defaults |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment