Jump to content

How to setup redis on a Linux vps

From KeenWiki
Revision as of 05:43, 14 March 2025 by 21spy (talk | contribs) (Created page with "To set up Redis on a Linux VPS, follow these steps: 1. Update your system packages: ``` sudo apt update ``` 2. Install Redis: ``` sudo apt install redis ``` 3. Verify the installation: ``` redis-cli --version ``` 4. Check Redis service status: ``` sudo systemctl status redis ``` 5. If not running, start Redis: ``` sudo systemctl start redis ``` 6. Enable Redis to start on boot: ``` sudo systemctl enable redis ``...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To set up Redis on a Linux VPS, follow these steps:

1. Update your system packages:

  ```
  sudo apt update
  ```

2. Install Redis:

  ```
  sudo apt install redis
  ```

3. Verify the installation:

  ```
  redis-cli --version
  ```

4. Check Redis service status:

  ```
  sudo systemctl status redis
  ```

5. If not running, start Redis:

  ```
  sudo systemctl start redis
  ```

6. Enable Redis to start on boot:

  ```
  sudo systemctl enable redis
  ```

7. Configure Redis by editing the configuration file:

  ```
  sudo nano /etc/redis/redis.conf
  ```

8. Set important configuration parameters:

  - Bind address: `bind 127.0.0.1`
  - Protected mode: `protected-mode yes`
  - Set max memory: `maxmemory 256mb`

9. Save the configuration and restart Redis:

  ```
  sudo systemctl restart redis
  ```

10. Test the Redis connection:

   ```
   redis-cli ping
   ```
   If successful, you should see "PONG" as the response.

For enhanced security, consider renaming or deactivating dangerous Redis commands and implementing regular backups and log auditing[1].

Citations: [1] https://www.hostinger.com/tutorials/how-to-install-and-setup-redis-on-ubuntu/ [2] https://anovin.mk/tutorial/how-to-install-and-set-up-redis-on-a-vps/ [3] https://www.inmotionhosting.com/support/server/how-to-install-redis-on-your-vps-dedicated-server/ [4] https://www.kdnuggets.com/getting-started-redis-installation-setup-guide [5] https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/ [6] https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-20-04 [7] https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/ [8] https://www.youtube.com/watch?v=mfMWqDXz118

--- Answer from Perplexity: pplx.ai/share