CentOS版本
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
it 参数表示交互;
d 表示后台运行。
docker attach 表示重新 attach 上后台运行的container
docker pull centos:7
docker run -itd --name gluten centos:7 /bin/bash
docker attach gluten
安装基础库
yum -y install epel-release centos-release-scl
yum -y install \
git \
dnf \
vim \
sudo \
cmake3 \
devtoolset-9 \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
ninja-build \
wget
为 cmake创建 软连接
ln -s /usr/bin/cmake3 /usr/local/bin/cmake
安装maven
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -xvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 /usr/lib/maven
添加环境变量
vim ~/.bashrc
export MAVEN_HOME=/usr/lib/maven
export PATH=${PATH}:${MAVEN_HOME}/bin
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
. /opt/rh/devtoolset-9/enable
source ~/.bashrc
启动 CentOS container
# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dd70f31a02bb centos:7 "/bin/bash" 5 hours ago Exited (128) 5 minutes ago gluten
98aa50e6ba4e hello-world "/hello" 6 hours ago Exited (0) 6 hours ago stoic_saha
# docker restart dd70f31a02bb
dd70f31a02bb
亦可这样启动
# docker start gluten
gluten
docker attach 退出后,不退出容器 (MAC)
正常退出但不关闭容器,请按 Ctrl+P+Q进行退出容器
attach 之后 终止容器
如果想终止 container
attach 之后,直接 exit
exit
或者 ctrl+d
恢复container
docker start gluten
docker exec 登录
docker exec -u root -it gluten bash
非MAC退出
ctrl-c 会直接 终止 container
ctrl-q 可以退出shell, container 依旧在运行
可参考 https://docs.docker.com/engine/reference/commandline/attach/
docker cp
# docker cp ~/.m2/repository gluten:/root/.m2/
Successfully copied 994MB to gluten:/root/.m2/
编译 velox 和 gluten (0718)
## fetch arrow and compile
cd /path_to_gluten/ep/build-arrow/src/
./get_arrow.sh
./build_arrow.sh
## fetch velox
cd /path_to_gluten/ep/build-velox/src/
./get_velox.sh --enable_hdfs=ON
./build_velox.sh --enable_hdfs=ON
cd /path_to_gluten/cpp
mkdir build
cd build
cmake -DBUILD_VELOX_BACKEND=ON -DENABLE_HDFS=ON ..
make -j
mvn clean package -Pbackends-velox -Pspark-3.2 -DskipTests
如果是ARM 架构,
在运行脚本之前,得export 环境变量
export CPU_TARGET="aarch64"
Note, 如果是小型虚拟机,在编译 velox 之前,先export NUM_THREADS
export NUM_THREADS=2
基本命令
修改 data location
默认存储路径为 /var/lib/docker
service docker stop
vi /etc/docker/daemon.json
{
"data-root": "/home/lib/docker"
}
systemctl restart docker
使用 docker info 检查
# docker info | grep "Docker Root Dir"
Docker Root Dir: /home/lib/docker
docker 上,使用 vcpkg 编译 gluten + velox 全过程
docker attach 表示重新 attach 上后台运行的container
docker pull centos:7
docker run -itd --name gluten centos:7 /bin/bash
docker attach gluten
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
yum-config-manager --add-repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all & yum makecache
yum provides git
以上 yum-config-manager 是为了能够安装基本的 yum package
cd /etc/yum.repos.d/
vi CentOS-SCLo-rh.repo
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
yum clean all & yum makecache
这是为了 yum provides devtoolset-9
如果 yum install -y devtoolset-9 遇到如下问题:
Downloading packages:
warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/devtoolset-9-binutils-2.32-16.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't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keVXCj1BK1fzVrDMLPbuNNCZQ==
=UtPD
-----END PGP PUBLIC KEY BLOCK-----
开始编译
git clone https://github.com/apache/incubator-gluten.git
cd incubator-gluten
- 将 centos-release-scl 去掉
diff --git a/dev/vcpkg/setup-build-depends.sh b/dev/vcpkg/setup-build-depends.sh
index 75675c26d..7b2f3a987 100755
--- a/dev/vcpkg/setup-build-depends.sh
+++ b/dev/vcpkg/setup-build-depends.sh
@@ -29,7 +29,7 @@ install_maven_from_source() {
install_centos_7() {
export PATH=/usr/local/bin:$PATH
- yum -y install epel-release centos-release-scl
+ yum -y install epel-release
yum -y install \
wget curl tar zip unzip which \
cmake3 ninja-build perl-IPC-Cmd autoconf autoconf-archive automake libtool \
diff --git a/tools/gluten-te/centos/centos-7-deps.sh b/tools/gluten-te/centos/centos-7-deps.sh
index 4971efc94..84a19eddc 100755
--- a/tools/gluten-te/centos/centos-7-deps.sh
+++ b/tools/gluten-te/centos/centos-7-deps.sh
@@ -34,7 +34,7 @@ sed -e 's|^mirrorlist=|#mirrorlist=|g' \
# Disable fastestmirror
sed -i "s/enabled=1/enabled=0/" /etc/yum/pluginconf.d/fastestmirror.conf
-yum -y install epel-release centos-release-scl
+yum -y install epel-release
yum -y install \
git \
dnf \
bash dev/vcpkg/setup-build-depends.sh
source /opt/rh/devtoolset-9/enable
# source dev/vcpkg/env.sh
...
-- Installing: /root/incubator-gluten/dev/vcpkg/.vcpkg/packages/aws-sdk-cpp_x64-linux-avx/share/aws-sdk-cpp/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 806 ms.
Elapsed time to handle aws-sdk-cpp:x64-linux-avx: 1.1 min
Total install time: 24 min
export NUM_THREADS=4
bash dev/buildbundle-veloxbe.sh --enable_s3=ON --enable_hdfs=ON --enable_vcpkg=ON --spark_version=3.3
# ll ./package/target/gluten-velox-bundle-spark3.3_2.12-centos_7_x86_64-1.2.0-SNAPSHOT.jar
-rw-r--r-- 1 root root 123904864 Jul 19 08:43 ./package/target/gluten-velox-bundle-spark3.3_2.12-centos_7_x86_64-1.2.0-SNAPSHOT.jar
基于container 制作image
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd4e6350c70d centos:7 "/bin/bash" 3 days ago Up 3 days gluten
# docker commit gluten centos7:gluten-0718
sha256:c1628e6f3dd67c209051a19b142b209ac7b06978e65ec6613442c7fa4d144a39
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos7 gluten-0718 c1628e6f3dd6 17 seconds ago 15.7GB
centos 7 eeb6ee3f44bd 2 years ago 204MB
# docker login
Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/
Username: zhixingheyitian
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
# docker tag centos7:gluten-0718 zhixingheyitian/centos7:gluten-0718
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos7 gluten-0718 c1628e6f3dd6 21 minutes ago 15.7GB
zhixingheyitian/centos7 gluten-0718 c1628e6f3dd6 21 minutes ago 15.7GB
centos 7 eeb6ee3f44bd 2 years ago 204MB
# docker push zhixingheyitian/centos7:gluten-0718
The push refers to repository [docker.io/zhixingheyitian/centos7]
ac15bd316dfe: Pushed
174f56854903: Mounted from library/centos
gluten-0718: digest: sha256:59b32e03e678f0947f4352061ed83d4c4fc8f3bcb6af15fe2edbd35212efdf33 size: 743
FQA
# docker run -itd --name gluten centos:7 /bin/bash
docker: Error response from daemon: Conflict. The container name "/gluten" is already in use by container "6c767b55ed704d395a976f50722376764dec9c2483bc5a6eff14c0403b4e51a9". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
解决方案
# docker rm $(docker ps -a -q)
6c767b55ed70
- yum lock
Another app is currently holding the yum lock; waiting for it to exit...=====- ] 316 kB/s | 71 MB 00:00:23 ETA
The other application is: yum
Memory : 35 M RSS (867 MB VSZ)
Started: Fri Aug 9 08:18:26 2024 - 02:48 ago
State : Sleeping, pid: 27
rm -rf /var/run/yum.pid
- thrift 查看版本
# /root/incubator-gluten/dev/vcpkg/.vcpkg/buildtrees/thrift/x64-linux-avx-rel/compiler/cpp/bin/thrift --version
Thrift version 0.16.0