install redis in ubuntu 18.04 code example

Example 1: how to install redis in ubuntu

sudo apt update
sudo apt install redis-server

sudo nano /etc/redis/redis.conf

# change "supervised no" to "supervised systemd" 
supervised systemd

sudo systemctl restart redis.service

sudo systemctl status redis

redis-cli

Example 2: install redis ubuntu

sudo apt update
sudo apt install redis-server

sudo systemctl restart redis.service

sudo systemctl status redis

redis-cli

Example 3: redis ubuntu install

# This explanation shows how to install the latest redis version on ubuntu

# add redis repository - as ubuntu normal repository holds an old version of redis
sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update

# install redis
sudo apt-get install redis-server

# set redis to auto-strat on boot
sudo systemctl enable redis-server
sudo systemctl daemon-reload

Example 4: redis ubuntu install

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make