Installing ZooKeeper
- Install dependencies.
yum install -y wget openssl-devel zlib-devel autoconf automake libtool ant svn make libstdc++-static glibc-static git snappy snappy-devel fuse fuse-devel cppunit-devel net-tools
- Download the ZooKeeper installation package.
1 2 3
cd /home wget https://github.com/apache/zookeeper/archive/refs/tags/release-3.4.14.tar.gz --no-check-certificate mv release-3.4.14.tar.gz zookeeper-3.4.14.tar.gz
- Decompress the installation package.
1 2
tar -zxf zookeeper-3.4.14.tar.gz mv zookeeper-release-3.4.14 zookeeper-3.4.14
- Go to the directory generated after the decompression.
cd /home/zookeeper-3.4.14
- The build.xml and ivysettings.xml files need to be modified due to network proxy problems.
- Open build.xml.
vim build.xml
- Press i to enter the insert mode, and comment out the lines of downloading and copying ant-eclipse.

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Manually download the ant-eclipse-1.0.bin.tar.bz2 source package.
wget https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2 --no-check-certificate
Orwget http://ufpr.dl.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
- Copy the ant-eclipse-1.0.bin.tar.bz2 source package to the corresponding path.
cp ant-eclipse-1.0.bin.tar.bz2 /home/zookeeper-3.4.14/zookeeper-server/src/main/resources
- Open the ivysettings.xml file.
vim ivysettings.xml
- Press i to enter the insert mode and change the value of repo.maven.org to https://mirrors.huaweicloud.com/repository/maven/.

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Modify the repo link in the build.xml file.
1sed -i 's/http:\/\/repo2/https:\/\/repo1/' build.xml
- Open build.xml.
- Perform the compilation.
1ant package tar
- View the generated zookeeper-3.4.6.tar.gz package.
ls build
- Move zookeeper-3.4.6.tar.gz to the specified directory and decompress it.
1 2 3
cp build/zookeeper-3.4.14.tar.gz /opt/ cd /opt/ tar -zxvf zookeeper-3.4.14.tar.gz
Parent topic: Configuring the Compilation Environment