简体   繁体   English

在 Ubuntu 19.04 上安装 Redis-Commander 作为服务

[英]Install Redis-Commander as service on Ubuntu 19.04

I created my self a virtual machine with an Ubuntu 19.04 guest system running redis and redis commander.我为自己创建了一个虚拟机,其中有一个运行 redis 和 redis 命令的 Ubuntu 19.04 来宾系统。

I can access the redis commander via 8081 but need to start it manually everytime I start the VM.我可以通过 8081 访问 redis 命令,但每次启动 VM 时都需要手动启动它。

How would I install the redis-commander as linux service?我如何将 redis-commander 安装为 linux 服务? I would like to keep it directly installed in Ubuntu and not running in a docker container.我想将它直接安装在 Ubuntu 中,而不是在 docker 容器中运行。

Yes, you can.是的你可以。 I had the same issue but on Centos 7. In /etc/systemd/system directory you should create .service file, for example, my-redis-commader.service .我在 Centos 7 上遇到了同样的问题。在/etc/systemd/system目录中,您应该创建.service文件,例如my-redis-commader.service The content of file is like this:文件内容是这样的:

[Unit]
Description=Redis Commander Activator
After=network.target

[Service]
WorkingDirectory=/usr/lib/node_modules/redis-commander/bin/
ExecStart=/usr/bin/node /usr/lib/node_modules/redis-commander/bin/redis-commander.js

[Install]
WantedBy=multi-user.target

where在哪里

/usr/bin/node - node.js executable file /usr/bin/node - node.js 可执行文件

/usr/lib/node_modules/redis-commander/bin/redis-commander.js - is the file of node.js module, which run the web application - gui for redis server. /usr/lib/node_modules/redis-commander/bin/redis-commander.js - 是 node.js 模块的文件,它运行 web 应用程序 - redis 服务器的 gui。

Then run:然后运行:

systemctl enable my-redis-commander.service
systemctl start my-redis-commander.service

Check status:检查状态:

systemctl status my-redis-commander.service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM