Update 'install-Redis.sh'

This commit is contained in:
bprieshof
2019-06-19 13:52:51 +02:00
parent df1ff0d8d4
commit d59bc1e0de

View File

@@ -8,11 +8,14 @@
# #
##============================================================= ##=============================================================
##----------## ##----------##
# Menu # # Menu #
##----------## ##----------##
echo "Ubuntu 18.04 Reddis installatie script." echo "Ubuntu 18.04 Reddis installatie script."
echo "LETOP!!: 32-bit versie tot 4GB"
echo "Installatiemethode?" echo "Installatiemethode?"
PS3='Keuze:' PS3='Keuze:'
options=("apt" "Compile 64-Bit" "Compile 32-Bit" "Quit") options=("apt" "Compile 64-Bit" "Compile 32-Bit" "Quit")
@@ -34,23 +37,31 @@ do
esac esac
done done
while true; do while true; do
read -p "Wiltu predis instaleren? -> ja/nee?" yn read -p "Wilt u PHPredis instaleren? -> ja/nee?" yn
case $yn in case $yn in
[JjYy]* ) predis=1 [JjYy]* ) phpredis=1
break;; break;;
[Nn]* ) predis=0 [Nn]* ) phpredis=0
break;; break;;
* ) echo "Kies ja of nee.";; * ) echo "Kies ja of nee.";;
esac esac
done done
##-----------------##
# Static-Vars #
##-----------------##
phpver=$(php -v | grep ^PHP | cut -d' ' -f2 | grep -Po "^...")
##-------------------## ##-------------------##
# Apt installer # # Apt installer #
##-------------------## ##-------------------##
if [ "$rcomp" == 'apt' ]; then if [ "$rcomp" == 'apt' ]; then
apt install -y redis-server apt install -y redis-server
sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
@@ -59,42 +70,78 @@ if [ "$rcomp" == 'apt' ]; then
fi fi
##--------------------------------## ##--------------------------------##
# Common redis build funtion # # Common redis build funtion #
##--------------------------------## ##--------------------------------##
function redis_common {
echo "redis_common functie" function redis_common_before {
cd ~
apt install build-essential -y
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
} }
function redis_common_after {
cp src/redis-server /usr/local/bin/
cp src/redis-cli /usr/local/bin/
mkdir -p /etc/redis
mkdir -p /var/redis
cp utils/redis_init_script /etc/init.d/redis_6379
cp redis.conf /etc/redis/6379.conf
sed -i 's/supervised no/supervised systemd/g' /etc/redis/6379.conf
sed -i 's/daemonize no/daemonize yes/g' /etc/redis/6379.conf
sed -i 's#dir ./#dir /var/redis/6379#g' /etc/redis/6379.conf
sed -i 's/# maxmemory <bytes>/maxmemory 512mb/g' /etc/redis/6379.conf
mkdir -p /var/redis/6379
update-rc.d redis_6379 defaults
/etc/init.d/redis_6379 start
apt install redis-tools -y
}
##---------------------## ##---------------------##
# Build installer # # Build installer #
##---------------------## ##---------------------##
if [ "$rcomp" == 'c32' ]; then if [ "$rcomp" == 'c32' ]; then
redis_common redis_common_before
echo "morehere" apt install libc6-dev-i386 -y
#sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf make 32bit
#sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf redis_common_after
#sed -i 's/# requirepass foobared/# requirepass '$password'/g' /etc/redis/redis.conf
fi fi
if [ "$rcomp" == 'c64' ]; then if [ "$rcomp" == 'c64' ]; then
redis_common redis_common_before
echo "morehere" apt-get install libc6-dev -y
#sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf make
#sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf redis_common_after
#sed -i 's/# requirepass foobared/# requirepass '$password'/g' /etc/redis/redis.conf
fi fi
echo "[OK] Redis succesvol geinstalleerd.........."
##------------##
# Predis #
##------------##
if [ $predis = 1 ]; then ##--------------##
echo "This feature wil implemented later" # PHPredis #
#git clone https://github.com/phpredis/phpredis.git /opt/phpredis ##--------------##
#apt install -y php${phpver}-dev
if [ $phpredis = 1 ]; then
apt-get install php${phpver}-dev -y
pecl install redis
sed -i 's#; http://php.net/engine#extension=redis.so#g' /etc/php/"${phpver}"/fpm/php.ini
echo "extension=redis.so" > /etc/php/"${phpver}"/mods-available/redis.ini
ln -sf /etc/php/"${phpver}"/mods-available/redis.ini /etc/php/"${phpver}"/fpm/conf.d/20-redis.ini
ln -sf /etc/php/"${phpver}"/mods-available/redis.ini /etc/php/"${phpver}"/cli/conf.d/20-redis.ini
echo "[OK] PHP Redis succesvol geinstalleerd.........."
echo "Voor meer info over php redis ga naar: https://github.com/phpredis/phpredis"
echo "Voor meer info over php redis ga naar: https://github.com/phpredis/phpredis" > ~/phpredisInfo.txt
fi fi
read -p "Druk op enter om het systeem te herstarten"
reboot
#/bin/end