Home > Backend Development > PHP Tutorial > Share 2 ways to install redis under Ubuntu

Share 2 ways to install redis under Ubuntu

高洛峰
Release: 2023-03-05 15:16:01
Original
1435 people have browsed it

Preface

Redis is currently recognized as the fastest memory-based key-value database, but the shortcomings of redis are also very obvious. It only provides the most basic hash set, list, sorted set and other data-based data. Type, no table classification, no schema, no index, no foreign key, lack of basic data types such as int/date, multi-condition query needs to be implemented indirectly through collection inlining (sinter, zinterstore) and connection, which is inconvenient to operate and low in development efficiency. The maintainability is not good; therefore, it is generally not used as a complete database alone. Many websites use redis as a cache and session state storage layer, and then use it with other databases.

Note: This article installs version 3.0.6, you can download the latest stable version from https://redis.io/download

Method 1

$ wget http://download.redis.io/releases/redis-3.0.6.tar.gz
$ tar xzf redis-3.0.6.tar.gz
$ cd redis-3.0.6
$ make
$ cd src
Copy after login

After make, the redis-server service program and redis-cli client program will appear in the redis-3.0.6/src directory. Copy redis-3.0.6/redis.conf to the src directory

Start the redis server

./redis-server redis.conf
Copy after login

At this time open another terminal and start the client Terminal

./redis-cli
Copy after login

Test run

127.0.0.1:6379> set name tom
OK
127.0.0.1:6379> get name
"tom"
127.0.0.1:6379>
Copy after login

The installation was successful.

Method 2

Use the following commands to install online

$sudo apt-get update
$sudo apt-get install redis-server
Copy after login

Start the redis server and client respectively

$ redis-server
$ redis-cli
Copy after login

Summary

The above is the entire content of this article. I hope the content of this article can bring some help to everyone's study or work. If you have any questions, you can leave a message to communicate. .

For more 2 ways to install redis under Ubuntu and share related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template