I am working with Laravel but i have installed all on my own (php, mysql, composer, nginx) and now i need to install Redis and configure it so i could use it for queue driver in Laravel.
How to install it, because it cannot be installed through apt-get install redis
i get this error:
ubuntu@ubuntu:~$ sudo apt-get install redis
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package redis
I think always is better (and simpler) to install from main repos as first option if you don't have any special requirements.
The package you are searching for is named
redis-server
. You can check its package info withapt show redis-server
.Also you can search all packages mentioning redis with
apt search redis
, or even do some simple filtering usinggrep
, useapt search redis | grep php
to search forphp-redis
or related package(s) for example.If you have any special requirements, you always can build from source and install as @George posted in his answer.
Hope it helps.
To install redis follow these steps:
Set up a non-root user with
sudo
privilegesInstall build and test dependencies:
Set up redis:
Download latest copy via this link or with this
/home/username/redis-stable
directoryMove into created folder and extract it
Change into the folder
cd redis-stable
and build it withConfigure redis:
Create configuration directory:
Move sample redis configuration file:
Edit the file:
supervised no
tosupervised systemd
dir
todir /var/lib/redis
# for persistent data dumpSet up the systemd unit file:
Add the text:
Set up redis user, groups and directories:
create redis user and group with same ID but no home directory:
Test redis:
Start redis service:
Check status:
Result of status if started successfully:
Test instance:
Connect:
Test connectivity at prompt:
Check ability to set keys:
Get the key just set:
Exit redis:
Restart redis and then re-run steps 1, 4, and 5 to connect with the client again and confirm that your test value is still available, hence it's working as expected:
Enable redis to start at boot:
Source:
Digital Ocean - how to install and configure redis on Ubuntu 16.04
Direct download links
First add PPA repository to your OS then update your repository list and install it.
Following @George's answer, after running
make
(step 3, part 4),cd
intoredis-stable/utils
and run./install_server.sh
.This interactive script will help you define a port and other file locations, and after which you can immediately run
redis-cli
.That same directory also has a handy script for starting and stopping the server.
1) First of all go to redis.io site
2) and you see there check the download page
3) Open the terminal
4) apt-cache policy redis-server
you able to see the version table for your operating system version display
5) sudo apt-get install redis-server
6) Easiest way Go to redis.io site and click on the download link Further you will go scroll on the more down you will see the installation
7) First of all you are enter the update command. All the going to repo was update.
8)
sudo apt-get install build-essential tcl
9)
mkdir redis
10)
wget http://download.redis.io/releases/redis-4.0.0.tar.gz
11) Now give the tar command
12)
cd redis-4.0.0
13)
make
- making on redis binaryif once finish you can see the "make test" command
14)
src/redis-server
- start the redis server15)
src/redis-cli
- start the redis client16)
sudo make install
- whenever give the redis command on enter the any dir