This article is reproduced from:
Http://www.linuxdiyf.com/linux/22527.html
Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. This document documents the steps to install Redis on Ubuntu 16.04. Redis defaults to the Ubuntu repository and can be installed using apt: sudo apt install redis-server but not the latest version in the Repository, I compiled the installation from the source code in order to use the newest redis. First, install the Basic build tool: sudo apt install build-essential tcl 1) Download Redis source code: $ cd/tmp$ Curl-o http://download.redis.io/redis-stable . tar.gz 2) Unzip the TAR package: $ tar xzvf redis-stable.tar.gz 3) Compile and install: CD redis-stable$ make$ make test$ sudo make install 4) Configure Redis: Create R Edis configuration directory/etc/redis:$ sudo mkdir/etc/redis copy profile: $ sudo cp/tmp/redis-stable/redis.conf/etc/redis edit config file: $ sudo vim/etc /redis/redis.conf find supervised row, change No to systemd:supervised systemd
Locate dir line, save directory for configuration database: Dir/var/lib/redis
Save exit. 5) Create the SYSTEMD unit file: Configure Redis as a system service. Create Redis.service file: $ sudo vim/etc/systemd/system/redis.service writes the following: [Unit]description=redis in-memory Data storeafter=network.target[service]user=redisgroup=redisexecstart=/usr/local/bin/redis-server/etc/redis/ REDIS.CONFEXECSTOP=/USR/LOCAL/BIN/REDIS-CLI Shutdownrestart=always[install]wantedby=multi-user.target Save the exit file. 6) Create Redis users, groups, and directories: Create Redis Users and groups: $ sudo adduser--system--group--no-create-home redis Create a database directory corresponding to the configuration above: $ sudo mkdir/var/ lib/redis$ sudo chown redis:redis/var/lib/redis$ sudo chmod 770/var/lib/redis 7) Start Redis service: $ sudo systemctl start redis$ sudo systemctl enable Redis
Restart Service: $ sudo systemctl restart Redis 8) test: Use the command line client Connection Redis service: $ REDIS-CLI Test connectivity Status: Set up Redis authentication password: http://www.linuxdiyf.com/ Linux/22528.htmlredis Document: Http://redis.io/documentation
Ubuntu 16.04 Installation Redis (source installation) ZZ