当前位置:网站首页>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 test
In 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
边栏推荐
猜你喜欢
Etcd storage, watch and expiration mechanism
Introduction to reverse debugging PE structure resource table 07/07
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
How real-time cloud interaction helps the development of education industry
基于链表管理的单片机轮询程序框架
结合案例:Flink框架中的最底层API(ProcessFunction)用法
When MDK uses precompiler in header file, ifdef is invalid
OpenHarmony应用开发之如何创建DAYU200预览器
安装trinity、解决报错
Talk about the design and implementation logic of payment process
随机推荐
C语言职工管理系统
Haproxy high availability solution
How real-time cloud interaction helps the development of education industry
N++ is not reliable
XML入门三
Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
美国土安全部长:国内暴力极端主义是目前美面临的最大恐怖主义威胁之一
Database lock table? Don't panic, this article teaches you how to solve it
C语言图书租赁管理系统
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#/VB. Net to add text / image watermarks to PDF documents
Besides, rsync+inotify realizes real-time backup of data
The old-fashioned synchronized lock optimization will make it clear to you at once!
Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
ViewBinding和DataBinding的理解和区别
基于STM32+华为云IOT设计的酒驾监控系统
数据库公共字段自动填充
Efficient! Build FTP working environment with virtual users
Node mongodb installation