在centos 7上安装solr 6.2.0时无法创建用户

时间:2016-09-04 19:23:20

标签: bash apache solr centos centos7

cd /tmp

wget http://www-us.apache.org/dist/lucene/solr/6.2.0/solr-6.2.0.tgz

tar xzf solr-6.2.0.tgz solr-6.2.0/bin/install_solr_service.sh --strip-components=2

[root@ns52132 tmp]# sudo ./install_solr_service.sh solr-6.2.0.tgz

id: solr: no such user
Creating new user: solr
adduser: group '--disabled-password' does not exist

Extracting solr-6.2.0.tgz to /opt


Installing symlink /opt/solr -> /opt/solr-6.2.0 ...


Installing /etc/init.d/solr script ...


/etc/default/solr.in.sh already exist. Skipping install ...


/var/solr/data/solr.xml already exists. Skipping install ...


/var/solr/log4j.properties already exists. Skipping install ...

chown: invalid spec: ‘solr:’
./install_solr_service.sh: line 322: update-rc.d: command not found
id: solr: no such user
User solr not found! Please create the solr user before running this script.
id: solr: no such user
User solr not found! Please create the solr user before running this script.
Service solr installed.

许多网站都提到了相同的步骤,我所关注的是https://www.howtoforge.com/tutorial/how-to-install-and-configure-solr-on-ubuntu-1604/

1 个答案:

答案 0 :(得分:0)

修改install_solr_service.sh,找到以下一行

adduser --system --shell /bin/bash --group --disabled-password --home "$SOLR_VAR_DIR" "$SOLR_USER"

并替换为

adduser --system --shell /bin/bash --home "$SOLR_VAR_DIR" "$SOLR_USER"

根据man page for adduser

The default is to disable the password.因此,更改命令后删除--disabled-password不会产生任何影响。

不确定删除--group的影响,但我认为这是选择默认用户组,现在是默认行为。