时间:2017年10月
关键字:debian、apacheds、安装、失败、删除

安装失败

Debian 9,通过apt安装ApacheDS,出错如下:

root@debian:~# apt-get install apacheds
...
Failed to start apacheds.service: Unit apacheds.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status apacheds.service' for details.
invoke-rc.d: initscript apacheds, action "start" failed.
● apacheds.service - Apache Directory Server
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

Oct 28 08:41:44 c1037u systemd[1]: [/lib/systemd/system/apacheds.service:11] Executable path is not absolute, ignoring: ${JAVA_HOME}/bin/java ${JAVA_OPTS}              -Dapacheds.controls=${ADS_CONTROLS}              -Dapacheds.extendedOperations=${ADS_EXTENDED_OPERATIONS}              -Dlog4j.configuration=file:${ADS_INSTANCES}/${ADS_INSTANCE}/conf/log4j.properties              -Dapacheds.log.dir=${ADS_INSTANCES}/${ADS_INSTANCE}/log              -cp '${ADS_HOME}/lib/*'              org.apache.directory.server.UberjarMain              ${ADS_INSTANCES}/${ADS_INSTANCE}/
...
root@debian:~#

无法删除

进行删除,但失败,如下:

root@debian:~# apt-get remove apacheds
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ant ant-optional junit4 libantlr-java libapache-directory-api-java libapache-directory-jdbm-java libapacheds-i18n-java
  libapacheds-java libapacheds-kerberos-codec-java libbcprov-java libcommons-collections3-java libcommons-io-java
  libcommons-lang-java libcommons-pool-java libdom4j-java libehcache-java libhamcrest-java libisorelax-java libjaxen-java
  libjdom1-java libjetty9-java libmavibot-java libmina2-java libmsv-java librelaxng-datatype-java libxom-java libxpp2-java
  libxpp3-java
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  apacheds
0 upgraded, 0 newly installed, 1 to remove and 76 not upgraded.
1 not fully installed or removed.
After this operation, 172 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 118924 files and directories currently installed.)
Removing apacheds (2.0.0~M15-4) ...
Failed to stop apacheds.service: Unit apacheds.service not loaded.
invoke-rc.d: initscript apacheds, action "stop" failed.
dpkg: error processing package apacheds (--remove):
 subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
 apacheds
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian:~#

解决方法

根据提示判断是ExecStart有问题,于是屏蔽问题ExecStart,重新删除:

root@debian:~# vim /lib/systemd/system/apacheds.service
[Unit]
Description=Apache Directory Server
After=network.target
ConditionPathExists=/etc/apacheds/config.ldif

[Service]
Type=simple
User=apacheds
Group=apacheds
EnvironmentFile=/etc/default/apacheds
ExecStart=/bin/true
#ExecStart=${JAVA_HOME}/bin/java ${JAVA_OPTS} \
#            -Dapacheds.controls=${ADS_CONTROLS} \
#            -Dapacheds.extendedOperations=${ADS_EXTENDED_OPERATIONS} \
#            -Dlog4j.configuration=file:${ADS_INSTANCES}/${ADS_INSTANCE}/conf/log4j.properties \
#            -Dapacheds.log.dir=${ADS_INSTANCES}/${ADS_INSTANCE}/log \
#            -cp '${ADS_HOME}/lib/*' \
#            org.apache.directory.server.UberjarMain \
#            ${ADS_INSTANCES}/${ADS_INSTANCE}/
PrivateTmp=true

[Install]
WantedBy=multi-user.target

root@debian:~# apt-get remove --purge apacheds
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ant ant-optional junit4 libantlr-java libapache-directory-api-java libapache-directory-jdbm-java libapacheds-i18n-java
  libapacheds-java libapacheds-kerberos-codec-java libbcprov-java libcommons-collections3-java libcommons-io-java
  libcommons-lang-java libcommons-pool-java libdom4j-java libehcache-java libhamcrest-java libisorelax-java libjaxen-java
  libjdom1-java libjetty9-java libmavibot-java libmina2-java libmsv-java librelaxng-datatype-java libxom-java libxpp2-java
  libxpp3-java
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  apacheds*
0 upgraded, 0 newly installed, 1 to remove and 76 not upgraded.
1 not fully installed or removed.
After this operation, 172 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 118924 files and directories currently installed.)
Removing apacheds (2.0.0~M15-4) ...
(Reading database ... 118839 files and directories currently installed.)
Purging configuration files for apacheds (2.0.0~M15-4) ...
Processing triggers for systemd (232-25+deb9u1) ...
root@debian:~#

后记

也许是Debian9的ApacheDS安装包存在bug,没有深入研究,选择slapd代替。

时间:2017年10月
关键字:kafka、维护、常用、命令

显示topic列表

> bin/kafka-topics.sh --zookeeper 172.16.132.176:2181/kafka --list

创建topic

> bin/kafka-topics.sh --zookeeper 172.16.132.176:2181/kafka --create --replication-factor 3 --partitions 8 --topic topic001

删除topic

> bin/kafka-topics.sh --zookeeper 172.16.132.176:2181/kafka --delete --topic topic001

查看topic描述

> bin/kafka-topics.sh --zookeeper 172.16.132.176:2181/kafka --describe --topic topic001

显示group列表,java创建的group需要在zookeeper中查看

> bin/kafka-consumer-groups.sh --bootstrap-server 172.16.132.197:9092 --list

显示group描述

> bin/kafka-consumer-groups.sh --bootstrap-server 172.16.132.197:9092 --group group001 --describe

显示偏移情况

> bin/kafka-consumer-offset-checker.sh --zookeeper 172.16.132.176:2181/kafka --topic topic001 --group group001

控制台生产消息

> bin/kafka-console-producer.sh --broker-list 172.16.132.197:9092 --topic topic001

控制台消费消息

> bin/kafka-console-consumer.sh --bootstrap-server 172.16.132.197:9092 --topic topic001 --from-beginning

时间:2017年10月
关键字:vsftpd、root、debian、无法登录

背景

通过查找资料,并反复尝试修改/etc/vsftpd.ftpusers与/etc/vsftpd.user_list,均无法实现root登录ftp。

原因分析

root@debian:~# apt-get install vsftpd
root@debian:~# dpkg -L vsftpd
...
/etc/ftpusers
...
/etc/pam.d/vsftpd
...

root@www:/tmp# cat /etc/pam.d/vsftpd 
# Standard behaviour for ftpd(8).
auth	required	pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed

# Note: vsftpd handles anonymous logins on its own. Do not enable pam_ftp.so.

# Standard pam includes
@include common-account
@include common-session
@include common-auth
auth	required	pam_shells.so


root@debian:~# cat /etc/ftpusers 
# /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5).

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
nobody

解决办法

/etc/ftpusers文件中的root前加#。