diff --git a/deps/deps-centos7.sh b/deps/deps-centos7.sh new file mode 100755 index 00000000000..ccec9438670 --- /dev/null +++ b/deps/deps-centos7.sh @@ -0,0 +1,144 @@ +#!/bin/bash +# +# The script is based on a clean CentOS 7 system. +# +# Copyright (c) 2020, Alibaba Group Holding Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Executed by root +if [[ $(/usr/bin/id -u) -ne 0 ]]; then + echo "Not running as root" + exit +fi + +# avoid missing locale +sed -i 's/override_install_langs/# &/' /etc/yum.conf +# for su postgres +sed -i 's/4096/unlimited/g' /etc/security/limits.d/20-nproc.conf + +# extra yum software source +# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo +# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo +rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 +yum install -y epel-release centos-release-scl +rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 +rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo +yum update -y + +# compile tools +yum install -y \ + devtoolset-9-gcc \ + devtoolset-9-gcc-c++ \ + devtoolset-9-gdb \ + devtoolset-9-libstdc++-devel \ + devtoolset-9-make \ + llvm-toolset-7.0-llvm-devel \ + llvm-toolset-7.0-clang-devel \ + cmake3 + +# dependencies +yum install -y \ + libicu-devel \ + pam-devel \ + readline-devel \ + libxml2-devel \ + libxslt-devel \ + openldap-devel \ + openldap-clients \ + openldap-servers \ + openssl-devel \ + libuuid-devel \ + xerces-c-devel \ + bison \ + flex \ + gettext \ + tcl-devel \ + python-devel \ + perl-IPC-Run \ + perl-Expect \ + perl-Test-Simple \ + perl-DBD-Pg \ + perl-ExtUtils-Embed \ + perl-ExtUtils-MakeMaker \ + zlib-devel \ + krb5-devel \ + krb5-workstation \ + krb5-server \ + protobuf-devel \ + libaio-devel \ + fuse-devel + +ln /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so + +# yum install -y +# git lcov psmisc sudo vim \ +# less \ +# net-tools \ +# python2-psycopg2 \ +# python2-requests \ +# tar \ +# shadow-utils \ +# which \ +# binutils\ +# libtool \ +# perf \ +# make sudo \ +# wget \ +# util-linux + +# enable GCC9 and LLVM7 +echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \ +echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc && \ +ln -s /usr/bin/cmake3 /usr/bin/cmake +source /etc/bashrc + +# install Node.js repo +# curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - +# install Yarn +# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \ +# yum install -y yarn + +GITHUB_PROXY= +# GITHUB_PROXY=https://ghproxy.com + +cd /usr/local + +ZLOG_VERSION=1.2.14 +PFSD_VERSION=pfsd4pg-release-1.2.42-20220419 + +# download zlog for PFSD +wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/HardySimpson/zlog/archive/refs/tags/${ZLOG_VERSION}.tar.gz" +# download PFSD +wget --no-verbose --no-check-certificate "${GITHUB_PROXY}https://github.com/ApsaraDB/PolarDB-FileSystem/archive/refs/tags/${PFSD_VERSION}.tar.gz" + +# unzip and install zlog +gzip -d $ZLOG_VERSION.tar.gz && \ +tar xpf $ZLOG_VERSION.tar && \ +cd zlog-$ZLOG_VERSION && \ +make && make install && \ +echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig && \ +cd .. && \ +rm -rf $ZLOG_VERSION* && \ +rm -rf zlog-$ZLOG_VERSION && \ +# unzip and install PFSD +gzip -d $PFSD_VERSION.tar.gz && \ +tar xpf $PFSD_VERSION.tar && \ +cd PolarDB-FileSystem-$PFSD_VERSION && \ +sed -i 's/-march=native //' CMakeLists.txt && \ +./autobuild.sh && ./install.sh && \ +cd .. && \ +rm -rf $PFSD_VERSION* && \ +rm -rf PolarDB-FileSystem-$PFSD_VERSION* && \ +ldconfig diff --git a/docs/development/customize-dev-env.md b/docs/development/customize-dev-env.md index 66c00d54177..d25cf3d305c 100644 --- a/docs/development/customize-dev-env.md +++ b/docs/development/customize-dev-env.md @@ -197,7 +197,7 @@ cd ~ ### 依赖安装 -在 PolarDB for PostgreSQL 的源码库根目录下,有一个 `install_dependencies.sh` 脚本,包含了 PolarDB 和 PFS 需要运行的所有依赖。因此,首先需要克隆 PolarDB 的源码库。 +在 PolarDB for PostgreSQL 源码库根目录的 `deps/` 子目录下,放置了在各个 Linux 发行版上编译安装 PolarDB 和 PFS 需要运行的所有依赖。因此,首先需要克隆 PolarDB 的源码库。 PolarDB for PostgreSQL 的代码托管于 [GitHub](https://github.com/ApsaraDB/PolarDB-for-PostgreSQL) 上,稳定分支为 `POLARDB_11_STABLE`。如果因网络原因不能稳定访问 GitHub,则可以访问 [Gitee 国内镜像](https://gitee.com/mirrors/PolarDB-for-PostgreSQL)。 @@ -220,9 +220,9 @@ git clone -b POLARDB_11_STABLE https://gitee.com/mirrors/PolarDB-for-PostgreSQL ::: :::: -源码下载完毕后,使用 `sudo` 执行源代码根目录下的依赖安装脚本 `install_dependencies.sh` 自动完成所有的依赖安装。如果有定制的开发需求,请自行修改 `install_dependencies.sh`。 +源码下载完毕后,使用 `sudo` 执行 `deps/` 目录下的相应脚本 `deps-***.sh` 自动完成所有的依赖安装。比如: ```bash cd PolarDB-for-PostgreSQL -sudo ./install_dependencies.sh +sudo ./deps/deps-centos7.sh ``` diff --git a/docs/zh/development/customize-dev-env.md b/docs/zh/development/customize-dev-env.md index 66c00d54177..d25cf3d305c 100644 --- a/docs/zh/development/customize-dev-env.md +++ b/docs/zh/development/customize-dev-env.md @@ -197,7 +197,7 @@ cd ~ ### 依赖安装 -在 PolarDB for PostgreSQL 的源码库根目录下,有一个 `install_dependencies.sh` 脚本,包含了 PolarDB 和 PFS 需要运行的所有依赖。因此,首先需要克隆 PolarDB 的源码库。 +在 PolarDB for PostgreSQL 源码库根目录的 `deps/` 子目录下,放置了在各个 Linux 发行版上编译安装 PolarDB 和 PFS 需要运行的所有依赖。因此,首先需要克隆 PolarDB 的源码库。 PolarDB for PostgreSQL 的代码托管于 [GitHub](https://github.com/ApsaraDB/PolarDB-for-PostgreSQL) 上,稳定分支为 `POLARDB_11_STABLE`。如果因网络原因不能稳定访问 GitHub,则可以访问 [Gitee 国内镜像](https://gitee.com/mirrors/PolarDB-for-PostgreSQL)。 @@ -220,9 +220,9 @@ git clone -b POLARDB_11_STABLE https://gitee.com/mirrors/PolarDB-for-PostgreSQL ::: :::: -源码下载完毕后,使用 `sudo` 执行源代码根目录下的依赖安装脚本 `install_dependencies.sh` 自动完成所有的依赖安装。如果有定制的开发需求,请自行修改 `install_dependencies.sh`。 +源码下载完毕后,使用 `sudo` 执行 `deps/` 目录下的相应脚本 `deps-***.sh` 自动完成所有的依赖安装。比如: ```bash cd PolarDB-for-PostgreSQL -sudo ./install_dependencies.sh +sudo ./deps/deps-centos7.sh ``` diff --git a/install_dependencies.sh b/install_dependencies.sh deleted file mode 100755 index 57c8144e419..00000000000 --- a/install_dependencies.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# -# The script is based on a clean Centos7 system. -# -# Copyright (c) 2020, Alibaba Group Holding Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Executed by root -if [[ $(/usr/bin/id -u) -ne 0 ]]; then - echo "Not running as root" - exit -fi - -# avoid missing locale -sed -i 's/override_install_langs/# &/' /etc/yum.conf -# for su postgres -sed -i 's/4096/unlimited/g' /etc/security/limits.d/20-nproc.conf - -# extra yum software source -# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo -# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo -rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 -yum install -y epel-release centos-release-scl -rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 -rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo -yum update -y - -# compile tools -yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++ \ - devtoolset-9-gdb devtoolset-9-make \ - llvm-toolset-7.0-llvm-devel \ - llvm-toolset-7.0-clang-devel \ - llvm-toolset-7.0-cmake - -# dependencies -yum install -y libicu-devel pam-devel readline-devel libxml2-devel \ - libxslt-devel openldap-devel openldap-clients \ - openldap-servers libuuid-devel xerces-c-devel \ - bison flex gettext tcl-devel python-devel \ - perl-IPC-Run perl-Expect perl-Test-Simple perl-DBD-Pg \ - perl-ExtUtils-Embed perl-ExtUtils-MakeMaker zlib-devel \ - krb5-devel krb5-workstation krb5-server \ - git lcov psmisc sudo vim libaio-devel wget \ - protobuf-devel - -ln /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so - -# enable GCC9 and LLVM7 -echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc && \ -echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc && \ -source /etc/bashrc - -# install Node.js repo -curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - -# install Yarn -curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \ - yum install -y yarn - -OPENSSL_VERSION=OpenSSL_1_1_1k -GITHUB_PROXY=https://ghproxy.com - -cd /usr/local - -# download zlog for PFSD -wget --no-verbose --no-check-certificate "${GITHUB_PROXY}/https://github.com/HardySimpson/zlog/archive/refs/tags/1.2.14.tar.gz" -# download PFSD -wget --no-verbose --no-check-certificate "${GITHUB_PROXY}/https://github.com/ApsaraDB/PolarDB-FileSystem/archive/refs/tags/pfsd4pg-release-1.2.41-20211018.tar.gz" -# download OpenSSL 1.1.1 -wget --no-verbose --no-check-certificate "${GITHUB_PROXY}/https://github.com/openssl/openssl/archive/refs/tags/${OPENSSL_VERSION}.tar.gz" - -# unzip and install zlog -tar -zxf 1.2.14.tar.gz && \ -cd zlog-1.2.14 && \ -make && make install && \ -cd .. && \ -rm 1.2.14.tar.gz && \ -rm -rf zlog-1.2.14 && \ -# unzip and install PFSD -tar -zxf pfsd4pg-release-1.2.41-20211018.tar.gz && \ -cd PolarDB-FileSystem-pfsd4pg-release-1.2.41-20211018 && \ -./autobuild.sh && ./uninstall.sh && ./install.sh && \ -cd .. && \ -rm pfsd4pg-release-1.2.41-20211018.tar.gz && \ -rm -rf PolarDB-FileSystem-pfsd4pg-release-1.2.41-20211018 && \ -# unzip and install OpenSSL 1.1.1 -tar -zxf $OPENSSL_VERSION.tar.gz && \ -cd /usr/local/openssl-$OPENSSL_VERSION && \ -./config --prefix=/usr/local/openssl && make -j64 && make install && \ -cp /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/ && \ -cp /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/ && \ -cp -r /usr/local/openssl/include/openssl /usr/include/ && \ -ln -sf /usr/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so && \ -ln -sf /usr/lib64/libssl.so.1.1 /usr/lib64/libssl.so && \ -rm -f /usr/local/$OPENSSL_VERSION.tar.gz && \ -rm -rf /usr/local/openssl-$OPENSSL_VERSION - -ldconfig -