当前位置:网站首页>Redis - how to install redis and configuration (how to quickly install redis on ubuntu18.04 and centos7.6 Linux systems)
Redis - how to install redis and configuration (how to quickly install redis on ubuntu18.04 and centos7.6 Linux systems)
2022-07-04 13:50:00 【Alascanfu】
Contents of this article
How to install quickly Redis And configure environment variables
Ubuntu18.04 Linux Lower installation Redis
Preparation
redis-6.2.6.tar.gz Installation package
tcl8.6.1-src.tar Installation package ( To solve the problem
make testIn the process encounter“You need tcl 8.5 or newer in order to run the Redis test”The problem of )
Ubuntu 18.04 Installation in environment
Step one : Unzip and download it, and put it in ~/downloads/redis-6.2.6.tar.gz To /usr/local Directory and rename
# Enter the directory where the user downloaded the installation package
$ cd ~/downloads
# decompression redis-6.2.6.tar.gz To /usr/local Under the table of contents
$ sudo tar -zxvf redis-6.2.6.tar.gz -C /usr/local
# Go to the application folder
$ cd /usr/local
# rename
$ sudo mv ./redis-6.2.6 ./redis
# Change folder permissions
$ sudo chown -R hadoop ./redis/
Step two : Enter into /usr/local/redis/src Compile below (make)
$ cd /usr/local/redis/src && make
Pay attention to point one : If there is Command ‘gcc’ not found , because redis It was the author who passed C Written in language , There is no installation in the system gcc Or the version is too low to compile and run , There is no such instruction operation to compile .
Solution
# Update installation source
$ sudo apt-get update
# install gcc
$ sudo apt-get install gcc
After completing the above operations , Again in /usr/local/redis/src Execute under directory make
Pay attention to point two : When we do it again make On command , Show error: jemalloc/jemalloc.h: No such file or directory when , Official documents suggest that this is about the distributor allocator The problem of , If there is MALLOC This environment variable , We'll use this environment variable To build Redis.libc It's not the default allocator , The default is jemalloc because jemalloc Proved to be better than libc Less fragmentation problems, In order to solve the problem caused by the above default values . We just need to do the following :
$ make MALLOC=libc
After completing the above operations , Again in /usr/local/redis/src Execute under directory make
Step three : Conduct make test test redis The function of
$ make test
Pay attention to point one : In execution redis The test command make test In the process , encounter “You need tcl 8.5 or newer in order to run the Redis test” The problem with
Solution
Will be ready tcl8.6.1-src.tar.gz Extract and configure the installation
# Enter the directory where the user downloaded the installation package
$ cd ~/downloads
# decompression tcl8.6.1-src.tar.gz Go to the specified directory
$ tar -zxvf ./tcl8.6.1-src.tar.gz -C ~/software
$ cd ~/software/tcl8.6.1/unix
# Enter the software and start the configuration
$ sudo ./configure
# install
$ sudo make
$ sudo make install
After completing the above operations , Enter into /usr/local/redis/src Under the table of contents perform make test Conduct redis test
Step four : install redis After and start
$ cd /usr/local/redis/src
$ sudo make install
$ redis-server
The startup is successful, as shown in the figure :

Configure environment variables
# Modify environment variable configuration
$ vim ~/.bashrc
# Make the modification of environment variable configuration effective
$ source ~/.bashrc
~./bashrc Ubuntu18.04 Next
export REDIS_HOME=/usr/local/redis
export PATH=${REDIS_HOME}/src:${JAVA_HOME}/bin:${HADOOP_HOME}/bin:${HADOOP_HOME}/sbin:${HBASE_HOME}/bin:${ZOOKEEPER_HOME}/bin:${MY_HOME}/bin:$PATH
Be accomplished QwQ
CentOS 7.6 Linux Lower installation Redis
Preparation
redis-6.2.6.tar.gz Installation package
CentOS 7.6 Installation in environment
Step one : install Redis rely on
because Redis Is based on C Written in language , So first you need to install Redis The required gcc rely on .
sudo yum install -y gcc tcl
Step two : Unzip and download it, and put it in ~/downloads/redis-6.2.6.tar.gz To /usr/local Directory and rename
# Enter the directory where the user downloaded the installation package
$ cd ~/downloads
# decompression redis-6.2.6.tar.gz To /usr/local Under the table of contents
$ sudo tar -zxvf redis-6.2.6.tar.gz -C /usr/local
# Go to the application folder
$ cd /usr/local
# rename
$ sudo mv ./redis-6.2.6 ./redis
# Change folder permissions
$ sudo chown -R hadoop ./redis/
Step three : Enter the redis After the folder Installation
# Go to decompress the good redis Under the table of contents
$ cd /usr/local/redis
$ make && make install
# The default path after installation is /usr/local/bin Under the table of contents
$ cd /usr/local/bin
# Check if the installation is successful
[[email protected] bin]# ll
Total usage 18904
-rwxr-xr-x. 1 root root 4829528 6 month 15 10:48 redis-benchmark
lrwxrwxrwx. 1 root root 12 6 month 15 10:48 redis-check-aof -> redis-server
lrwxrwxrwx. 1 root root 12 6 month 15 10:48 redis-check-rdb -> redis-server
-rwxr-xr-x. 1 root root 5003816 6 month 15 10:48 redis-cli
lrwxrwxrwx. 1 root root 12 6 month 15 10:48 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 9518952 6 month 15 10:48 redis-server
Step four : Start and test
# Because the global environment variables have been configured, you can start directly
$ redis-server
# test
[[email protected] redis]$ redis-cli
127.0.0.1:6379> keys *
(empty array)
127.0.0.1:6379> exit
Be accomplished QwQ
边栏推荐
- Besides, rsync+inotify realizes real-time backup of data
- PostgreSQL 9.1 soaring Road
- ASP.NET Core入门一
- MySQL three-level distribution agent relationship storage
- ASP. Net core introduction I
- C语言个人通讯录管理系统
- Reading cognitive Awakening
- After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
- C语言中学生成绩管理系统
- 室外LED屏幕防水吗?
猜你喜欢

HAProxy高可用解决方案

.Net之延迟队列

How real-time cloud interaction helps the development of education industry

2022年中国移动阅读市场年度综合分析

CA: efficient coordinate attention mechanism for mobile terminals | CVPR 2021
Three schemes to improve the efficiency of MySQL deep paging query

聊聊支付流程的设计与实现逻辑

JVM series - stack and heap, method area day1-2

Flet tutorial 03 basic introduction to filledbutton (tutorial includes source code) (tutorial includes source code)

室外LED屏幕防水吗?
随机推荐
CTF competition problem solution STM32 reverse introduction
一个数据人对领域模型理解与深入
Use fail2ban to prevent password attempts
C language dormitory management query software
XML入门一
Node の MongoDB安装
Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7
Distributed base theory
Using nsproxy to forward messages
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
字节面试算法题
使用宝塔部署halo博客
嵌入式编程中五个必探的“潜在错误”
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
The only core indicator of high-quality software architecture
C语言图书租赁管理系统
"Tips" to slim down Seurat objects
C language Dormitory Management Query Software
C语言程序设计