![如何在 openSUSE Leap 42.3 上正确安装 redis](https://linux22.com/image/711441/%E5%A6%82%E4%BD%95%E5%9C%A8%20openSUSE%20Leap%2042.3%20%E4%B8%8A%E6%AD%A3%E7%A1%AE%E5%AE%89%E8%A3%85%20redis.png)
我有一个大问题。我是 Owncloud 的新手。我安装了 owncloud 10.0.3(最新版本),但在管理员面板中我收到了一些警告。所以我正在尝试修复这些问题。
其中之一是:
事务文件锁定应配置为使用基于内存的锁定,而不是默认的基于数据库的慢速锁定
因此,我阅读了 owncloud 的手册> https://doc.owncloud.org/server/latest/admin_manual/configuration/server/caching_configuration.html
接下来,他们说我必须安装一个 redis 模块...所以现在我站在墙前...
也许我会写下到目前为止我所做的事情。但我认为最好的方法是有人从一开始就向我展示如何在 openSUSE 上正确安装 redis。
安装 Redis 的方式:
wget http://download.redis.io/releases/redis-4.0.2.tar.gz
tar xzf redis-4.0.2.tar.gz
cd redis-4.0.2
make
make install
还添加 php7-redis 和 extension=redis.so
创建文件:/etc/redis/redis.conf
supervised systemd
and then
dir /var/lib/redis
我添加了一个 Owncloud 配置条目:
This example config.php configuration uses Redis for the local server cache:
'memcache.local' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
'memcache.locking' => '\OC\Memcache\Redis', // Add this for best performance
现在我尝试更改 redis.service 文件,因此我粘贴:
/etc/systemd/system/redis.service
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
Environment=statedir=/run/redis
PermissionsStartOnly=true
PIDFile=/run/redis/redis.pid
ExecStartPre=/bin/touch /var/log/redis.log
ExecStartPre=/bin/chown redis:redis /var/log/redis.log
ExecStartPre=/bin/mkdir -p ${statedir}
ExecStartPre=/bin/chown -R redis:redis ${statedir}
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
启动 redis 服务时的错误文本为:
linux-kye3:/srv/www/htdocs/owncloud # systemctl status redis.service
● redis.service
Loaded: loaded (/etc/systemd/system/redis.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since
śro 2017-10-04 11:09:57 CEST; 1s ago
Process: 13568 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=1/FAILURE)
Process: 13564 ExecStartPre=/bin/chown -R redis:redis ${statedir} (code=exited, status=0/SUCCESS)
Process: 13560 ExecStartPre=/bin/mkdir -p ${statedir} (code=exited, status=0/SUCCESS)
Process: 13556 ExecStartPre=/bin/chown redis:redis /var/log/redis.log (code=exited, status=0/SUCCESS)
Process: 13554 ExecStartPre=/bin/touch /var/log/redis.log (code=exited, status=0/SUCCESS)
Main PID: 13275 (code=exited, status=1/FAILURE)
paź 04 11:09:57 vesta systemd[1]: redis.service: Control process exited, code=exited status=1
paź 04 11:09:57 vesta systemd[1]: Failed to start redis.service.
paź 04 11:09:57 vesta systemd[1]: redis.service: Unit entered failed state.
paź 04 11:09:57 vesta systemd[1]: redis.service: Failed with result 'exit-code'.
请一些聪明人来帮忙。
答案1
openSUSE 好像有一个 redis rpm:https://www.rpmfind.net/linux/RPM/opensuse/updates/leap/42.1/oss/x86_64/redis-3.0.4-6.1.x86_64.html。如果那不是一个选项并且docker可用,我建议在docker中运行redis。