This guide will take you through how to install Redis on FreeBSD 13. Redis is a distributed, in-memory key-value database, cache, and message broker with optional durability that is used as an in-memory data structure store. A variety of abstract data structures are supported by Redis, including strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.
How to Install Redis on FreeBSD 13
- Change to superuser using the command below.
su -
- Then update and upgrade FreeBSD 13 using the following command.
pkg update && pkg upgrade
- Next, install Redis on FreeBSD 13.
pkg install -y redis
Sample output
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
redis: 7.0.4
Number of packages to be installed: 1
The process will require 8 MiB more space.
846 KiB to be downloaded.
[1/1] Fetching redis-7.0.4.pkg: 0%
8[1/1] Fetching redis-7.0.4.pkg: 1%
16[1/1] Fetching redis-7.0.4.pkg: 2%
24[1/1] Fetching redis-7.0.4.pkg: 3%
32[1/1] Fetching redis-7.0.4.pkg: 4%
40[1/1] Fetching redis-7.0.4.pkg: 5%
48 KiB [1/1] Fetching redis-7.0.4.pkg: 1
1[1/1] Fetching redis-7.0.4.pkg: 12%
104[1/1] Fetching redis-7.0.4.pkg: 14%
120[1/1] Fetching redis-7.0.4.pkg: 15%
128[1/1] Fetching redis-7.0.4.pkg: 16%
136[1/1] Fetching redis-7.0.4.pkg: 17%
144[1/1] Fetching redis-7.0.4.pkg: 17%
152[1/1] Fetching redis-7.0.4.pkg: 18%
160[1/1] Fetching redis-7.0.4.pkg: 19%
168[1/1] Fetching redis-7.0.4.pkg: 20%
176[1/1] Fetching redis-7.0.4.pkg: 21%
184[1/1] Fetching redis-7.0.4.pkg: 23%
200[1/1] Fetching redis-7.0.4.pkg: 25%
216[1/1] Fetching redis-7.0.4.pkg: 28%
240[1/1] Fetching redis-7.0.4.pkg: 29%
248[1/1] Fetching redis-7.0.4.pkg: 30%
256[1/1] Fetching redis-7.0.4.pkg: 31%
264[1/1] Fetching redis-7.0.4.pkg: 32%
272[1/1] Fetching redis-7.0.4.pkg: 34%
288[1/1] Fetching redis-7.0.4.pkg: 35%
296[1/1] Fetching redis-7.0.4.pkg: 36%
312[1/1] Fetching redis-7.0.4.pkg: 37%
320[1/1] Fetching redis-7.0.4.pkg: 39%
336[1/1] Fetching redis-7.0.4.pkg: 40%
344[1/1] Fetching redis-7.0.4.pkg: 41%
352[1/1] Fetching redis-7.0.4.pkg: 42%
360[1/1] Fetching redis-7.0.4.pkg: 44%
376[1/1] Fetching redis-7.0.4.pkg: 45%
384[1/1] Fetching redis-7.0.4.pkg: 46%
392[1/1] Fetching redis-7.0.4.pkg: 47%
400[1/1] Fetching redis-7.0.4.pkg: 48%
408[1/1] Fetching redis-7.0.4.pkg: 49%
416[1/1] Fetching redis-7.0.4.pkg: 51%
432[1/1] Fetching redis-7.0.4.pkg: 52%
440[1/1] Fetching redis-7.0.4.pkg: 52%
448[1/1] Fetching redis-7.0.4.pkg: 53%
456[1/1] Fetching redis-7.0.4.pkg: 54%
464[1/1] Fetching redis-7.0.4.pkg: 55%
472[1/1] Fetching redis-7.0.4.pkg: 57%
488[1/1] Fetching redis-7.0.4.pkg: 58%
496[1/1] Fetching redis-7.0.4.pkg: 59%
504[1/1] Fetching redis-7.0.4.pkg: 63%
536[1/1] Fetching redis-7.0.4.pkg: 65%
552[1/1] Fetching redis-7.0.4.pkg: 67%
568[1/1] Fetching redis-7.0.4.pkg: 69%
584[1/1] Fetching redis-7.0.4.pkg: 70%
592[1/1] Fetching redis-7.0.4.pkg: 70%
600[1/1] Fetching redis-7.0.4.pkg: 71%
608[1/1] Fetching redis-7.0.4.pkg: 74%
632[1/1] Fetching redis-7.0.4.pkg: 75%
640[1/1] Fetching redis-7.0.4.pkg: 76%
648[1/1] Fetching redis-7.0.4.pkg: 78%
664[1/1] Fetching redis-7.0.4.pkg: 80%
680[1/1] Fetching redis-7.0.4.pkg: 81%
688[1/1] Fetching redis-7.0.4.pkg: 82%
696[1/1] Fetching redis-7.0.4.pkg: 83%
704[1/1] Fetching redis-7.0.4.pkg: 85%
720[1/1] Fetching redis-7.0.4.pkg: 87%
736[1/1] Fetching redis-7.0.4.pkg: 88%
752[1/1] Fetching redis-7.0.4.pkg: 91%
776[1/1] Fetching redis-7.0.4.pkg: 92%
784[1/1] Fetching redis-7.0.4.pkg: 93%
792[1/1] Fetching redis-7.0.4.pkg: 94%
800[1/1] Fetching redis-7.0.4.pkg: 95%
808[1/1] Fetching redis-7.0.4.pkg: 96%
816[1/1] Fetching redis-7.0.4.pkg: 97%
824[1/1] Fetching redis-7.0.4.pkg: 100%
846 KiB 4.1kB/s 03:31
Checking integrity... done (0 conflicting)
[1/1] Installing redis-7.0.4...
===> Creating groups.
Creating group 'redis' with gid '535'.
===> Creating users
Creating user 'redis' with uid '535'.
[1/1] Extracting redis-7.0.4: 100%
=====
Message from redis-7.0.4:
--
To setup "redis" you need to edit the configuration file:
/usr/local/etc/redis.conf
To run redis from startup, add redis_enable="YES"
in your /etc/rc.conf.
- Check the version of Redis installed using the command below.
pkg info redis
Sample output
redis-7.0.4 Name : redis Version : 7.0.4 Installed on : Thu Sep 8 17:58:49 2022 EAT Origin : databases/redis Architecture : FreeBSD:13:amd64 Prefix : /usr/local Categories : databases Licenses : BSD3CLAUSE Maintainer : [email protected] WWW : https://redis.io/ Comment : Persistent key-value database with built-in net interface Options : JEMALLOC : off LUA : off LUAJIT : off LUAJITOR : off TESTS : off TLS : on TRIB : off Annotations : FreeBSD_version: 1301000 cpe : cpe:2.3:a:redislabs:redis:7.0.4:::::freebsd13:x64 repo_type : binary repository : FreeBSD Flat size : 8.42MiB Description : Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set. In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log. Redis also supports trivial-to-setup master-slave replication, with very fast non-blocking first synchronization, auto-reconnection on net split and so forth. WWW: https://redis.io/
- After the installation, start Redis.
service redis onestart
- Then enable Redis on FreeBSD to start on system boot.
sysrc redis_enable="YES"
- Redis should be running after starting it, confirm by checking its status.
service redis status
Configure Redis on FreeBSD 13
- Open the Redis configuration file using the command below.
nano /usr/local/etc/redis.conf
Then search for requirepass foobared, uncomment it by removing # and change foobared with the password of your choice.
# IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility # layer on top of the new ACL system. The option effect will be just setting # the password for the default user. Clients will still authenticate using # AUTH as usually, or more explicitly with AUTH default # if they follow the new protocol: both will work. # # The requirepass is not compatible with aclfile option and the ACL LOAD # command, these will cause requirepass to be ignored. # requirepass YourStrongPassword # New users are initialized with restrictive permissions by default, via the # equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it # is possible to manage access to Pub/Sub channels with ACL rules as well.
- To access Redis from specific IP, uncomment bind 127.0.0.1 by removing # and add your IP address e.g.
bind 192.168.115.14
- Next, restart Redis using the following command to apply changes.
service redis restart
Test Redis on FreeBSD 13
- Launch Redis CLI using the command below.
redis-cli
- Next, authenticate by entering your password.
auth YourStrongPassword
- Run ping test.
ping
Sample output
127.0.0.1:6379> auth YourStrongPassword OK 127.0.0.1:6379> ping PONG 127.0.0.1:6379> exit
- That concludes our article on how to install Redis on FreeBSD 13.
Read more on Redis Documentation