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

Unable to create user when installing solr 6.2.0 on centos 7

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/

编辑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 的影响,但我相信这是对 select 默认用户组的影响,这是现在的默认行为。