In order to compile Redis follow these simple steps: wget Īt this point you can test if your build has worked correctly by typing make test, but this is an optional step.
You can either download the latest Redis tar ball from the redis.io web site, or you can alternatively use this special URL that always points to the latest stable Redis version, that is. Installing it using the package manager of your Linux distribution is somewhatĭiscouraged as usually the available version is not the latest. Redis has no dependencies other than a working GCC compiler and libc. The suggested way of installing Redis is compiling it from sources as
Therefore, knowing how to install it in Ubuntu 20.04 is a great step to start with this great database engine. It stores data quite quickly and especially the response time makes it important in mobile or IoT applications. To access Redis’ console, type: :~$ redis-cliĪnd, for example, ping to check the operation: pingĪnd you’ll get a screen output like this: 3.- Redis CLI :~$ sudo systemctl restart redis-serverĪnd again you can check the service and verify that everything is in order. To apply all these changes, simply restart the Redis service. Save all changes by pressing CTRL + O and exit the CTRL + X editor. In this case, I have opted for the default setting that prohibits the use of more than memory and throws an error message. maxmemory 300mbĪs well as the policy of the application with the maximum memory size. This will depend on your computer and the amount of memory it has. You can also specify a time to keep a TCP connection active. In this file, you can change Redis’ default port which is 6379 to whatever you prefer.
:~$ sudo nano /etc/redis/nfĪs I said, the archive is well documented and therefore looks quite extensive, but the reality is quite easy to follow. :~$ sudo cp /etc/redis/nf /etc/redis/Īnd now, proceed to open it. In case we make a mistake we can always go back to the original configuration. It is very well documented so you can customize it to the maximum by just reading it.įirst, we will make a backup. These will allow a smooth use of the program and allow you to get the most out of it.įirst of all, the /etc/redis/nf file is where all Redis’ settings are located.
Configuring Redis on Ubuntu 20.04Įven though Redis is ready for battle, some of his settings need to be reviewed. 2.- Redis service statusĪs you can see, Redis is installed and running smoothly. Jul 22 19:54:09 osradar systemd: Started Advanced key-value store. Jul 22 19:54:09 osradar systemd: rvice: Can't open PID file /run/redis/redis-server.pid (yet?) after start: Operation not permitted Jul 22 19:54:09 osradar systemd: Starting Advanced key-value store… Loaded: loaded (/lib/systemd/system/rvice enabled vendor preset: enabled)Īctive: active (running) since Wed 19:54:09 UTC 28s agoĬGroup: /system.slice/rvice You can do this using systemd like any other system service. In the end, you can check whether the Redis service is running. Once the proposal for units has been accepted, the whole process will begin.
Libatomic1 libhiredis0.14 libjemalloc2 liblua5.1-0 lua-bitop lua-cjson redis-server redis-toolsĠ upgraded, 8 newly installed, 0 to remove and 0 not upgraded.Īfter this operation, 4123 kB of additional disk space will be used.ĭo you want to continue? 1.- Install Redis on Ubuntu 20.04 The following NEW packages will be installed: Libatomic1 libhiredis0.14 libjemalloc2 liblua5.1-0 lua-bitop lua-cjson redis-tools The following additional packages will be installed: So, install Redis with the following command: :~$ sudo apt install redis-server Also, you will have the security patches installed and thus a more stable system. This ensures that your system will be ready for the installation of Redis.
So, open a terminal or connect to your server through SSH and update your system. Remember that on a server it is sometimes preferable to sacrifice new features for the sake of stability. This is perhaps the easiest and safest way to install Redis.
Redis is available in the official Ubuntu 20.04 repositories. So today you will learn how to install it.