kali-环境配置

docker

安装docker

Add Docker PGP key:

1
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Configure Docker APT repository:

1
echo 'deb https://download.docker.com/linux/debian stretch stable' > /etc/apt/sources.list.d/docker.list

Update APT:

1
apt-get update

Install Docker
If you had older versions of Docker installed, uninstall them:

1
apt-get remove docker docker-engine docker.io

Install Docker:

1
apt-get install docker-ce

Test:

1
docker run hello-world

After installation, Docker service will be started, but not enabled (i.e. it will not be started automatically after reboot). To start it:

1
systemctl start docker

To start Docker automatically upon reboot (do it on your own risk!):

1
systemctl enable docker

创建/使用docker

zookeeper dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
FROM java:latest
ARG MIRROR=http://mirrors.aliyun.com/
ARG VERSION=3.4.14

LABEL name="zookeeper" version=$VERSION

RUN wget $MIRROR/apache/zookeeper/zookeeper-$VERSION/zookeeper-$VERSION.tar.gz \
&& tar -zxvf zookeeper-$VERSION.tar.gz -C /opt/ \
&& mv /opt/zookeeper-$VERSION /opt/zookeeper \
&& cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg \
&& mkdir -p /tmp/zookeeper
EXPOSE 2181
WORKDIR /opt/zookeeper
VOLUME ["/opt/zookeeper/conf", "/tmp/zookeeper"]
ENTRYPOINT ["/opt/zookeeper/bin/zkServer.sh"]
CMD ["start-foreground"]

kafka dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
FROM java:latest  

ARG MIRROR=http://mirror.bit.edu.cn/
ARG SCALA_VERSION=2.11
ARG KAFKA_VERSION=2.2.1

LABEL name="kafka" version=$VERSION

RUN wget $MIRROR/apache/kafka/$KAFKA_VERSION/kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz \
&& tar -zxvf kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz -C /opt/
&& mv /opt/kafka_$SCALA_VERSION-$KAFKA_VERSION /opt/kafka \
&& sed -i 's/num.partitions.*$/num.partitions=3/g' /opt/kafka/config/server.properties \
&& sed -i 's/zookeeper.connect=.*$/zookeeper.connect=zookeeper:2181/g' /opt/kafka/config/server.properties

EXPOSE 9092
ENTRYPOINT ["/opt/kafka/bin/kafka-server-start.sh"]
CMD ["/opt/kafka/config/server.properties"]

构建容器

1
2
docker build -f zookeeper.Dockerfile -t zookeeper:3.4.14 .
docker build -f kafka.Dockerfile -t kafka:2.2.1 .

启动容器

1
2
docker run --name zookeeper -itd -p2181:2181 zookeeper:3.4.14
docker run --name kafka -itd -p9092:9092 --link zookeeper kafka:2.2.1

查看启动状况

1
2
docker logs zookeeper
docker logs kafka

验证

1
2
3
4
5
6
7
8
docker exec -it kafka bash
cd /opt/kafka
source /root/.bash_profile
bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 3 --topic test1
bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 3 --topic test2
bin/kafka-topics.sh --describe --topic test1 --zookeeper zookeeper:2181
bin/kafka-topics.sh --describe --topic test2 --zookeeper zookeeper:2181
bin/kafka-topics.sh --list --zookeeper zookeeper:2181

mysql创建外连用户

1
2
3
create user admin; 
GRANT ALL PRIVILEGES ON *.* TO admin@"%" IDENTIFIED BY 'admin' WITH GRANT OPTION;
flush privileges;

安装pwntools

坚持原创技术分享,您的支持将鼓励我继续创作!