# 1. 修改sshd配置文件 vi /etc/ssh/sshd_config PermitRootLogin no -> PermitRootLogin yes systemctl restart sshd sed -i 's@#UseDNS no@UseDNS no@g' /etc/ssh/sshd_config sed -i 's@# StrictHostKeyChecking ask@ StrictHostKeyChecking no@g' /etc/ssh/ssh_config systemctl restart sshd # 2. 配置IP vi /etc/sysconfig/network-scripts/ifcfg-enp189s0f0 TYPE="Ethernet" BOOTPROTO="none" NAME="enp189s0f0" ONBOOT="yes" DEVICE="enp189s0f0" IPADDR="10.10.10.10" NETMASK="255.255.255.0" GATEWAY="10.10.10.1" DNS1=202.96.134.133 DNS2=202.96.134.134 systemctl restart network # 3. 设置主机名 name=D01 hostname ${name} echo "${hostname}" > /etc/hostname # 4. 关闭防火墙 systemctl stop firewalld systemctl disable firewalld # 5. yum源 # (1) 网络源 repo_path=/etc/yum.repos.d/euleros_aarch64.repo rm -f /etc/yum.repos.d/euleros*.repo echo "[base]" > ${repo_path} echo "name=EulerOS-2.0SP8 base" >> ${repo_path} echo "baseurl=http://dev-thirdparty.mindspore.cn:8081/productrepo/repo/EulerOS_Server_V200R008C00SPC201B530/" >> ${repo_path} echo "enabled=1" >> ${repo_path} echo "gpgcheck=1" >> ${repo_path} echo "gpgkey=http://dev-thirdparty.mindspore.cn:8081/productrepo/repo/EulerOS_Server_V200R008C00SPC201B530/RPM-GPG-KEY-EulerOS" >> ${repo_path} yum clean all yum makecache # (2) 本地源 repo_path=/etc/yum.repos.d/euleros_aarch64.repo rm -f /etc/yum.repos.d/euleros*.repo echo "[base]" > ${repo_path} echo "name=EulerOS-2.0SP8 base" >> ${repo_path} echo "baseurl=file:///mnt/iso/" >> ${repo_path} echo "enabled=1" >> ${repo_path} echo "gpgcheck=1" >> ${repo_path} echo "gpgkey=file:///mnt/iso/RPM-GPG-KEY-EulerOS" >> ${repo_path} yum clean all yum makecache # (3) 华为云源 RUN repo_path=/etc/yum.repos.d/euleros_aarch64.repo echo "[base]" > ${repo_path} echo "name=EulerOS-2.0SP8 base" >> ${repo_path} echo "baseurl=http://mirrors.huaweicloud.com/euler/2.8/os/aarch64/" >> ${repo_path} echo "enabled=1" >> ${repo_path} echo "gpgcheck=1" >> ${repo_path} echo "gpgkey=http://mirrors.huaweicloud.com/euler/2.8/os/aarch64/RPM-GPG-KEY-EulerOS" >> ${repo_path} yum clean all yum makecache # 6. 安装基础包 yum install -y gcc yum install -y gcc-c++ yum install -y gcc-fortran yum install -y make yum install -y patch yum install -y gmp-devel yum install -y vim yum install -y wget yum install -y xz yum install -y net-tools yum install -y openssh-clients yum install -y git yum install -y curl yum install -y subversion # opencv-python依赖库 yum install -y libSM # pillow依赖包 yum install -y libjpeg-turbo-devel # matplotlib依赖包 yum install -y freetype-devel # scipy依赖包 yum install -y openblas yum install -y blas yum install -y lapack yum install -y atlas-devel # 7. 挂载磁盘 # (1) fdisk分区(最大2.2TB) fdisk /dev/sdb n p w mkfs -t ext4 /dev/sdb1 # (2) parted分区(没有限制) parted /dev/sdc mklabel gpt p unit s print free mkpart primary 0% 100% unit s print free q mkfs -t ext4 /dev/sdc1 # (3) 挂载 mkdir /data echo "/dev/sdb1 /srv ext4 defaults 0 0" >> /etc/fstab cat /etc/fstab # 8. 配置pip源 mkdir /root/.pip PIP_CONF="/root/.pip/pip.conf" echo "[global]" > ${PIP_CONF} echo "trusted-host=repo.huaweicloud.com" >> ${PIP_CONF} echo "index-url=https://repo.huaweicloud.com/repository/pypi/simple" >> ${PIP_CONF} echo "timeout = 120" >> ${PIP_CONF} cat ${PIP_CONF} # 9. 修改时区 tzselect rm -f /etc/localtime cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo 'Asia/Shanghai' > /etc/timezone echo "export TZ='Asia/Shanghai'" >> /etc/profile hwclock --systohc # ntp server ntpdate ntp1.aliyun.com # 10. 修改ssh连接超时 sed -i 's@export TMOUT=300@export TMOUT=0@g' /etc/profile source /etc/profile # 11. 关闭SELinux(重启后生效) sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config setenforce 0 /usr/sbin/sestatus -v # 12. 创建用户 # (1) 创建用户和用户组 groupadd HwHiAiUser useradd -d /home/HwHiAiUser -g HwHiAiUser HwHiAiUser mkdir -pv /home/HwHiAiUser chown HwHiAiUser:HwHiAiUser -R /home/HwHiAiUser # (2) 设置密码 echo -e "P*****\nP******" | passwd u****** # (3) su root(加入至wheel用户组) usermod -G wheel HwHiAiUser