The preferred way of Redis server installation is by compiling it using the source. It only requires GCC and GLIBC packages to be installed on your system to build Redis from Source.
Redis server is available under default package repository on most of the popular Linux platforms. If you don’t want to compile Redis from source code. You can use one of the below tutorials to install Redis using the package manager.
Installing Redis on a Linux VPS
Redis only required GCC and GLIBC packages to build from Source. So its the most recommended way for the Redis installation on a VPS. Run below set of commands to download the latest source code and install Redis latest version on Linux system.
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable
Run below commands to compile redis from source and install.
make make install
A Redis configuration file is also available in the current directory. You can copy this file to a better location and customize Redis.
mkdir /etc/redis cp redis.conf /etc/redis/
Start Redis Server
You can start Redis server without any configuration file. In that situation, Redis uses its inbuilt configuration. If you need to customize, Update changes to /etc/redis/redis.conf and start your Redis server as below.
redis-server /etc/redis/redis.conf &
Run command redis-cli ping on your system terminal. On successful execution, you will get string PONG in response.
redis-cli ping PONG
Using Redis Server
Start working with Redis server by inserting some key and value pair manually. Type redis-cli on terminal and press enter. This will provide your Redis service prompt, Here you can run commands directory to Redis.
redis-cli redis 127.0.0.1:6379> ping PONG redis 127.0.0.1:6379> set keyname datavalue OK redis 127.0.0.1:6379> get mykey "datavalue" redis 127.0.0.1:6379> set website tecadmin.net OK redis 127.0.0.1:6379> get website "tecadmin.net"