#!/bin/bash #set -x # install system software # create users # create conda env ci39 # set ssh black names # set hccn.conf # 安装jdk # current_dir="$(pwd)" ehco "install base tools for system" yum install -y gcc gcc-c++ gcc-gfortran make cmake glibc hdf5 hdf5-devel gmp-devel patch autoconf libtool automake numactl numactl-devel echo "Install dependency lib of python." yum install -y libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel gdbm-devel xz-devel mesa-libGL echo "Install dependency lib of opencv-python(pip)." yum install -y libSM echo "Install dependency lib of pillow(pip)." yum install -y libjpeg-turbo-devel echo "Install dependency lib of matplotlib(pip)." yum install -y freetype-devel echo "Install dependency lib of scipy(pip)." #yum install -y blas lapack atlas atlas-devel for ubuntu yum install -y openblas # opencv依赖库 yum install mesa-libGL -y echo "Install sshpass" yum install sshpass -y echo "Install redis" yum install redis -y KERNEL_VERSION="$(uname -r | awk -F'-' '{print $1}')" GCC_VERSION="$(gcc --version | head -1 | awk '{print $3}')" CMAKE_VERSION="$(cmake --version | head -1 | awk '{print $3}')" # set ssh black names cd /etc/ssh rm -f ssh_login_failed_host_deny.sh wget --no-check-certificate https://tools.mindspore.cn/scripts/sysconfig/common/ssh_login_failed_host_deny.sh find -iname "ssh_login_failed_host_deny.sh" if [ $? -eq 0 ]; then bash ssh_login_failed_host_deny.sh if [ $? -eq 0 ]; then #crontab -e # 每分钟执行一次 crontab -l > crontab_job_tmp echo "* * * * * /etc/ssh/sh_login_failed_host_deny.sh" >> crontab_job_tmp cat crontab_job_tmp | uniq > crontab_job crontab crontab_job crontab -l else echo "[ERROR] set crontab job failed" fi else echo "[ERROR] set ssh black names failed" fi echo "Install nodejs.====================================" node --version if [ $? -ne 0 ]; then yum install -y nodejs if [ $? -ne 0 ];then mkdir -p ${current_dir}/nodejs cd ${current_dir}/nodejs PACKAGE_NAME="node-v12.18.4-linux-arm64" wget https://mirrors.huaweicloud.com/nodejs/v12.18.4/${PACKAGE_NAME}.tar.gz tar -zxf ${PACKAGE_NAME}.tar.gz rm -rf /usr/local/nodejs mkdir -p /usr/local/nodejs mv ${PACKAGE_NAME} /usr/local/nodejs/ chmod 755 -R /usr/local/nodejs ln -sf /usr/local/nodejs/${PACKAGE_NAME}/bin/node /usr/bin/node ln -sf /usr/local/nodejs/${PACKAGE_NAME}/bin/npm /usr/bin/npm fi npm --version if [ $? -eq 0 ]; then npm config set registry https://mirrors.huaweicloud.com/repository/npm npm config get registry npm info express npm cache clean -f echo "Installed nodejs." else echo "[ERROR] install nodejs failed" fi fi if [ "${CMAKE_VERSION}" < "3.18.3" ]; then echo "Install cmake.======================================" mkdir -p ${current_dir}/cmake cd ${current_dir}/cmake wget http://tools.mindspore.cn/tools/build/cmake/cmake-3.18.3/cmake-3.18.3.tar.gz tar -zxf cmake-3.18.3.tar.gz cd cmake-3.18.3 ./bootstrap --prefix=/usr/local/cmake --parallel=16 make -j16 make install -j16 cd .. chmod 755 -R /usr/local/cmake grep "export PATH=/usr/local/cmake/bin" ~/.bashrc if [ $? -ne 0 ]; then echo "" >> ~/.bashrc echo "# Cmake env" >> ~/.bashrc echo "export PATH=/usr/local/cmake/bin:\$PATH" >> ~/.bashrc fi echo "Installed cmake." fi if [ "${GCC_VERSION}" < "7.3" ]; then echo "Install gcc-7.3.0 ===================================" mkdir -p ${current_dir}/gcc cd ${current_dir}/gcc wget http://tools.mindspore.cn/tools/build/gcc/gcc-7.3.0/source/gcc-7.3.0.tar.gz wget http://tools.mindspore.cn/tools/build/gcc/gcc-7.3.0/source/isl-0.16.1.tar.bz2 wget http://tools.mindspore.cn/tools/build/gcc/gcc-7.3.0/source/gmp-6.1.0.tar.bz2 wget http://tools.mindspore.cn/tools/build/gcc/gcc-7.3.0/source/mpfr-3.1.4.tar.gz wget http://tools.mindspore.cn/tools/build/gcc/gcc-7.3.0/source/mpc-1.0.3.tar.gz tar -zxf gcc-7.3.0.tar.gz tar -zxf mpc-1.0.3.tar.gz tar -zxf mpfr-3.1.4.tar.gz tar -jxf gmp-6.1.0.tar.bz2 tar -jxf isl-0.16.1.tar.bz2 mv gmp-6.1.0 gcc-7.3.0/gmp mv isl-0.16.1 gcc-7.3.0/isl mv mpc-1.0.3 gcc-7.3.0/mpc mv mpfr-3.1.4 gcc-7.3.0/mpfr mkdir -p /usr/local/gcc/gcc730 cd gcc-7.3.0 mkdir build cd build ../configure --prefix=/usr/local/gcc/gcc730 --enable-checking=release --enable-languages=c,c++ --disable-multilib make -j32 make install-strip chmod 755 -R /usr/local/gcc cd /usr/local/gcc/gcc730/bin ln -s gcc cc grep "export PATH=/usr/local/gcc/gcc730/bin" ~/.bashrc if [ $? -ne 0 ]; then echo "" >> ~/.bashrc echo "# GCC env" >> ~/.bashrc echo "export PATH=/usr/local/gcc/gcc730/bin:\$PATH" >> ~/.bashrc echo "export LD_LIBRARY_PATH=/usr/local/gcc/gcc730/lib64:\$LD_LIBRARY_PATH" >> ~/.bashrc echo "export PATH=/usr/local/gcc/gcc730/bin:\$PATH" >> /etc/bashrc echo "export LD_LIBRARY_PATH=/usr/local/gcc/gcc730/lib64:\$LD_LIBRARY_PATH" >> /etc/bashrc export LD_LIBRARY_PATH=/usr/local/gcc/gcc730/lib64:$LD_LIBRARY_PATH export PATH=/usr/local/gcc/gcc730/bin:$PATH fi echo "Installed gcc-7.3.0" fi echo "Install openmpi.===================================" mkdir -p ${current_dir}/openmpi cd ${current_dir}/openmpi if [ "${GCC_VERSION}" == "7.3.0" ]; then wget --no-check-certificate https://tools.mindspore.cn/tools/run/ompi/ompi-4.0.3/ompi-4.0.3.tar.gz tar -zxf ompi-4.0.3.tar.gz cd ompi-4.0.3 ./autogen.pl ./configure make -j32 make install -j32 else wget --no-check-certificate https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz tar -zxf openmpi-4.1.4.tar.gz cd openmpi-4.1.4 ./configure make -j64 make install -j64 fi grep "export LD_LIBRARY_PATH=/usr/local/lib:" ~/.bashrc if [ $? -ne 0 ]; then echo "" >> ~/.bashrc echo "# ompi env" >> ~/.bashrc echo "export LD_LIBRARY_PATH=/usr/local/lib:\${LD_LIBRARY_PATH}" >> ~/.bashrc fi /usr/local/bin/ompi_info --version if [ $? -eq 0 ]; then echo "Installed openmpi." else echo "[ERROR] install openmpi failed" fi echo "Install sshpass.===========================================" sshpass -v if [[ $? -ne 0 ]]; then mkdir -p ${current_dir}/sshpass cd ${current_dir}/sshpass wget http://tools.mindspore.cn/tools/ci/sshpass/sshpass-1.06/sshpass-1.06.tar.gz tar -zxf sshpass-1.06.tar.gz cd sshpass-1.06 ./configure make -j16 make install echo "Installed sshpass." fi echo "Set pip source.==============================================" mkdir /root/.pip echo "[global]" > /root/.pip/pip.conf echo "index-url=https://mirrors.aliyun.com/pypi/simple" >> /root/.pip/pip.conf echo "trusted-host=mirrors.aliyun.com" >> /root/.pip/pip.conf echo "timeout=120" >> /root/.pip/pip.conf cat /root/.pip/pip.conf echo "Setted pip source." # Create user mkdir -p ${current_dir}/createuser cd ${current_dir}/createuser wget --no-check-certificate https://tools.mindspore.cn/scripts/sysconfig/common/create_user.sh bash create_user.sh -u HwHiAiUser -g HwHiAiUser -p 'mindspore@GeKo@r4Pus' if [ $? -eq 0 ]; then echo "chown HwHiAiUser:HwHiAiUser /dev/dvpp_cmdlist" >> /etc/rc.d/rc.local echo "chmod 660 /dev/dvpp_cmdlist" >> /etc/rc.d/rc.local source /etc/rc.d/rc.local bash create_user.sh -u jenkins -g HwHiAiUser -p 'uX9#bM0@dN0AbJ9!' if [ $? -eq 0 ]; then echo "create user end" else echo "[ERROR] create user jenkins failed" fi else echo "[ERROR] create user HwHiAiUser failed" fi echo "create conda env ci39" wget http://tools.mindspore.cn/tools/conda/anaconda/Anaconda3-2024.10-1-Linux-aarch64.sh bash Anaconda3-2024.10-1-Linux-aarch64.sh -p /home/jenkins/anaconda3 source /home/jenkins/anaconda3/bin/activate base conda create -n ci39 python=3.9 -y source /home/jenkins/anaconda3/bin/activate ci39 echo "Install pip package for sault.==================================" umask 022 && pip3 install --upgrade pip umask 022 && pip3 install paramiko umask 022 && pip3 install pyyaml umask 022 && pip3 install scp umask 022 && pip3 install flask umask 022 && pip3 install requests umask 022 && pip3 install flask_restful umask 022 && pip3 install argparse umask 022 && pip3 install pytest==6.2.5 umask 022 && pip3 install virtualenv umask 022 && pip3 install nose echo "Installed pip package for sault." echo "Install pip package of mindspore.===============================" umask 022 && pip3 install 'wheel==0.34.2' umask 022 && pip3 install 'pybind11==2.5.0' umask 022 && pip3 install 'pytest-xdist==1.32.0' umask 022 && pip3 install 'numpy>=1.17.0' umask 022 && pip3 install 'pillow>=6.2.0' umask 022 && pip3 install 'protobuf>=3.8.0' umask 022 && pip3 install 'asttokens>=1.1.13' umask 022 && pip3 install 'scipy==1.5.3' umask 022 && pip3 install 'easydict>=1.9' umask 022 && pip3 install 'sympy>=1.4' umask 022 && pip3 install 'cffi>=1.13.2' umask 022 && pip3 install 'decorator>=4.4.0' umask 022 && pip3 install 'astunparse>=1.6.3' umask 022 && pip3 install 'packaging>=20.0' umask 022 && pip3 install 'bs4' umask 022 && pip3 install 'matplotlib>=3.1.3' umask 022 && pip3 install 'sklearn==0.0' umask 022 && pip3 install 'pandas>=1.0.4' umask 022 && pip3 install 'pycocotools>=2.0.0' umask 022 && pip3 install 'tables>=3.6.1' umask 022 && pip3 install 'attrdict>=2.0.1' umask 022 && pip3 install 'Click>=7.0' umask 022 && pip3 install 'Flask>=1.1.1' umask 022 && pip3 install 'Flask-Cors>=3.0.8' umask 022 && pip3 install 'google-pasta>=0.1.8' umask 022 && pip3 install 'gunicorn>=19.9.0' umask 022 && pip3 install 'itsdangerous>=1.1.0' umask 022 && pip3 install 'Jinja2>=2.10.1' umask 022 && pip3 install 'MarkupSafe>=1.1.1' umask 022 && pip3 install 'marshmallow>=2.19.2' umask 022 && pip3 install 'psutil>=5.6.1' umask 022 && pip3 install 'six>=1.12.0' umask 022 && pip3 install 'Werkzeug>=1.0.0' umask 022 && pip3 install 'tabulate>=0.8.6' umask 022 && pip3 install 'grpcio>=1.27.3' umask 022 && pip3 install 'treelib>=1.6.1' umask 022 && pip3 install 'scikit-learn>=0.21.2' umask 022 && pip3 install 'pyyaml>=5.3.1' umask 022 && pip3 install 'yapf>=0.30.0' umask 022 && pip3 install omegaconf umask 022 && pip3 install einops umask 022 && pip3 install ftfy umask 022 && pip3 install regex umask 022 && pip3 install albumentations umask 022 && pip3 install pandas umask 022 && pip3 install imagesize umask 022 && pip3 install toolz umask 022 && pip3 install tqdm umask 022 && pip3 install mpi4py==3.1.4 umask 022 && pip3 install projectq==0.8.0 umask 022 && pip3 install onnx umask 022 && pip3 install ninja pip install mmcv pip install opencv-python==4.6.0.66 pip install opencv-python-headless==4.6.0.66 umask 022 && pip3 install torch==1.8.1 umask 022 && pip3 install 'torchvision==0.2.2.post3' pip3 list chown -R jenkins:HwHiAiUser /home/jenkins/anaconda3 # set hccn.conf mkdir -p ${current_dir}/hccl cd ${current_dir}/hccl wget --no-check-certificate https://tools.mindspore.cn/scripts/sysconfig/common/set_hccl_ip.sh sh set_hccl_ip.sh if [ $? -ne 0 ]; then echo "set hccl ip failed" else cat /etc/hccn.conf fi # set core set -i '/ulimit -c 0/d' /etc/profile grep "ulimit -c unlimited" /etc/profile if [ $? -ne 0 ]; then echo "ulimit -c unlimited" >> /etc/profile fi grep "jenkins hard core unlimited" /etc/security/limits.conf if [ $? -ne 0 ]; then echo "* - core unlimited" >> /etc/security/limits.conf echo "jenkins hard core unlimited" >> /etc/security/limits.conf echo "jenkins soft core unlimited" >> /etc/security/limits.conf fi echo "kernel.core_pattern=/home/workspace/core/core-%e-%p-%h-%t" >> /etc/sysctl.conf mkdir -p /home/workspace/core chmod 777 /home/workspace/core sysctl -p # Install anti-virus未完成 #wget --no-check-certificate https://tools.mindspore.cn/scripts/anti-virus/installer-linuxs%28access.skylarv6.security.huawei.com_8530%29.sh #bash installer-linuxs\(access.skylarv6.security.huawei.com_8530\).sh #ps aux|grep qaxsafed # 安装jdk wget https://tools.mindspore.cn/tools/build/openjdk/openjdk-17.0.0/openjdk-17_linux-aarch64_bin.tar.gz cp openjdk-17_linux-aarch64_bin.tar.gz /usr/lib/jvm cd /usr/lib/jvm tar -xf openjdk-17_linux-aarch64_bin.tar.gz echo "" >> /etc/profile echo "# JAVA JDK" >> /etc/profile echo "export JAVA_HOME=/usr/lib/jvm/jdk-17" >> /etc/profile echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile echo "" >> /home/jenkins/.bashrc echo "# JAVA JDK" >> /home/jenkins/.bashrc echo "export JAVA_HOME=/usr/lib/jvm/jdk-17" >> /home/jenkins/.bashrc echo "export PATH=$JAVA_HOME/bin:$PATH" >> /home/jenkins/.bashrc