码迷,mamicode.com
首页 > 其他好文 > 详细

Install redis3

时间:2018-05-16 20:44:15      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:SQ   res   .gz   pen   lex   cto   port   ati   http   

 

How To Install Redis in Ubuntu

What is Redis?

Redis is a flexible, open-source, key value data store. Following in the footsteps of other NoSQL databases, such as Cassandra, CouchDB, and MongoDB, Redis allows the user to store vast amounts of data without the limits of a relational database. Additionally, it has also been compared to memcache and can be used, with its basic elements as a cache with persistence.

Set-up Environment For Installation.

Before installing redis, there are a couple of prerequisites that need to be downloaded in-order to proceed with the installation.

1. Update all of the apt-get packages.

 

 

2. Download a compiler with build essential in-order to install Redis from source.

 

 

 3. Download and install tcl8.5

 

 

 

Install Redis

After all of the prerequisites and dependencies downloaded to the server, you can proceed with the Redis installation from source.

1. Download the Stable Redis release from their website. google code. The latest stable version is 2.8.3

2. Extract the downloaded .tar file, and switch into that directory.

3. Proceed to with the  make  command.

4. Run the recommended make test .

5. Do the make install , which installs the program system-wide.

 

6. Once the program has been installed, Redis comes with a built in script that sets up Redis to run as a background daemon. To access the script move into the utils directory.

 

7. From there, run the Ubuntu/Debian install script.

 

8. As the script runs, you can choose the default options by pressing enter. Once the script completes, the redis-server will be running in the background. You can start and stop redis with these commands (the number depends on the port you set during the installation. 6379 is the default port setting).

 

 

install:(3.2)

wsl0414@DESKTOP-AQ5HJNE:~$ sudo apt-get update
wsl0414@DESKTOP-AQ5HJNE:~$ sudo apt-get install build-essential
wsl0414@DESKTOP-AQ5HJNE:~$ sudo apt-get install tcl
wsl0414@DESKTOP-AQ5HJNE:~$ wget http://download.redis.io/releases/redis-3.2.11.tar.gz
wsl0414@DESKTOP-AQ5HJNE:~$ tar zxvf redis-3.2.11.tar.gz
wsl0414@DESKTOP-AQ5HJNE:~$ cd redis-3.2.11
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11$ make
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11$ sudo make install
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11$ cd utils
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11/utils$ sudo ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Success!
Starting Redis server...
Installation successful!

 

test:

技术分享图片
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11/utils$ sudo service redis_6379 start
wsl0414@DESKTOP-AQ5HJNE:~/redis-3.2.11/utils$ redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set key1 hello world
(error) ERR syntax error
127.0.0.1:6379> set key1 [hello world]
(error) ERR syntax error
127.0.0.1:6379> set key1 "hello world"
OK
127.0.0.1:6379> get key1
"hello world"
127.0.0.1:6379> exit
redis-cli

 

Install redis3

标签:SQ   res   .gz   pen   lex   cto   port   ati   http   

原文地址:https://www.cnblogs.com/xiaobin-hlj80/p/9047802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!