华为泰山服务器的CPU芯片架构为aarch64,所装系统为EulerOS 2.0 (SP8)aarch64系统,安装saltstack比较困难。本文讲解通过pip安装方式离线安装saltstack3003.1以进行集中化管理和维护。
1、操作系统版本
- [root@localhost ~]# cat /etc/os-release
- NAME="EulerOS"
- VERSION="2.0 (SP8)"
- ID="euleros"
- ID_LIKE="rhel fedora centos"
- VERSION_ID="2.0"
- PRETTY_NAME="EulerOS 2.0 (SP8)"
- ANSI_COLOR="0;31"
2、python版本及所能识别支持的包信息
- [root@localhost ~]# python
- Python 3.7.0 (default, Mar 16 2020, 00:02:15)
- [GCC 7.3.0] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import pip
- >>> import pip._internal.pep425tags
- >>> print(pip._internal.pep425tags.get_supported())
- [('cp37', 'cp37m', 'linux_aarch64'), ('cp37', 'abi3', 'linux_aarch64'), ('cp37', 'none', 'linux_aarch64'), ('cp36', 'abi3', 'linux_aarch64'), ('cp35', 'abi3', 'linux_aarch64'), ('cp34', 'abi3', 'linux_aarch64'), ('cp33', 'abi3', 'linux_aarch64'), ('cp32', 'abi3', 'linux_aarch64'), ('py3', 'none', 'linux_aarch64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
- >>> exit()
- [root@localhost ~]#
3、服务器CPU架构
- [root@localhost ~]# uname -m
- aarch64
4、操作系统内核信息
- [root@localhost ~]# rpm -qa |grep kernel
- kernel-4.19.36-vhulk1907.1.0.h702.eulerosv2r8.aarch64
- kernel-headers-4.19.36-vhulk1907.1.0.h475.eulerosv2r8.aarch64
1、软件包内容
- [root@localhost tmp]# cd salt-pip/
- [root@localhost salt-pip]# ll
- total 13752
- -rw-r-----. 1 root root 155255 Sep 18 19:20 certifi-2022.12.7-py3-none-any.whl
- -rw-r-----. 1 root root 45489 Sep 18 19:20 charset_normalizer-3.0.1-py3-none-any.whl
- -rw-r-----. 1 root root 9570 Sep 18 19:20 contextvars-2.4.tar.gz
- -rw-r-----. 1 root root 20315 Sep 18 19:20 distro-1.8.0-py3-none-any.whl
- -rw-r-----. 1 root root 61538 Sep 18 19:20 idna-3.4-py3-none-any.whl
- -rw-r-----. 1 root root 116441 Sep 18 19:20 immutables-0.19-cp37-cp37m-linux_aarch64.whl
- -rw-r-----. 1 root root 133357 Sep 18 19:20 Jinja2-3.0.0-py3-none-any.whl
- -rw-r-----. 1 root root 9669 Sep 18 19:20 MarkupSafe-2.1.1-py3-none-any.whl
- -rw-r-----. 1 root root 15541 Sep 18 19:20 msgpack-1.0.4-py3-none-any.whl
- -rw-r-----. 1 root root 2071041 Sep 18 19:20 pycryptodomex-3.16.0-cp35-abi3-linux_aarch64.whl
- -rw-r-----. 1 root root 656952 Sep 18 19:20 PyYAML-6.0-cp37-cp37m-linux_aarch64.whl
- -rw-r-----. 1 root root 863287 Sep 18 19:20 pyzmq-25.0.0-cp37-cp37m-linux_aarch64.whl
- -rw-r-----. 1 root root 62822 Sep 18 19:20 requests-2.28.2-py3-none-any.whl
- -rw-r-----. 1 root root 256 Sep 18 19:20 requirements-euler2.8-salt.txt
- -rw-r-----. 1 root root 9654098 Sep 18 19:20 salt-3003.1-py3-none-any.whl
- -rw-r-----. 1 root root 26662 Sep 18 19:20 typing_extensions-4.4.0-py3-none-any.whl
- -rw-r-----. 1 root root 140642 Sep 18 19:20 urllib3-1.26.14-py2.py3-none-any.whl
2、依赖包描述文件requirements-euler2.8-salt.txt内容
- [root@localhost salt-pip]# cat requirements-euler2.8-salt.txt
- certifi==2022.12.7
- charset-normalizer==3.0.1
- contextvars==2.4
- idna==3.4
- immutables==0.19
- Jinja2==3.0.0
- MarkupSafe==2.1.1
- msgpack==1.0.4
- pycryptodomex==3.16.0
- PyYAML==6.0
- pyzmq==25.0.0
- requests==2.28.2
- salt==3003.1
- typing-extensions==4.4.0
- urllib3==1.26.14
1、编写安装脚本install.sh
- #!/bin/bash
- ##__author__='daigjianbing'
-
- pip3 install --no-index --find-links . -r requirements-euler2.8-salt.txt
- which salt-minion
- salt --version
- targetfile='/usr/lib/systemd/system/salt-minion.service'
- if [ ! -f $targetfile ];then
- cat > $targetfile <<"EOF"
- ##__author__='daigjianbing'
- [Unit]
- Description=The Salt Minion
- Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
- After=network.target salt-master.service
-
- [Service]
- KillMode=process
- Type=notify
- NotifyAccess=all
- LimitNOFILE=8192
- ExecStart=/usr/local/bin/salt-minion
-
- [Install]
- WantedBy=multi-user.target
- EOF
- fi
-
- chmod 644 $targetfile
- systemctl daemon-reload
-
- if [ ! -d "/etc/salt" ]; then
- mkdir -p /etc/salt
- chmod 755 /etc/salt
- fi
-
- targetfile='/etc/salt/minion'
- if [ ! -f $targetfile ];then
- cat > $targetfile <<"EOF"
- ##__author__='daigjianbing'
- master: server
- id: test
- hash_type: sha256
- EOF
- fi
-
-
- systemctl enable --now salt-minion
- systemctl status salt-minion
2、执行安装
- [root@localhost salt-pip]# sh install.sh
- WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
- Looking in links: .
- Collecting certifi==2022.12.7 (from -r requirements-euler2.8-salt.txt (line 1))
- Collecting charset-normalizer==3.0.1 (from -r requirements-euler2.8-salt.txt (line 2))
- Collecting contextvars==2.4 (from -r requirements-euler2.8-salt.txt (line 3))
- Collecting idna==3.4 (from -r requirements-euler2.8-salt.txt (line 4))
- Collecting immutables==0.19 (from -r requirements-euler2.8-salt.txt (line 5))
- Collecting Jinja2==3.0.0 (from -r requirements-euler2.8-salt.txt (line 6))
- Collecting MarkupSafe==2.1.1 (from -r requirements-euler2.8-salt.txt (line 7))
- Collecting msgpack==1.0.4 (from -r requirements-euler2.8-salt.txt (line 8))
- Collecting pycryptodomex==3.16.0 (from -r requirements-euler2.8-salt.txt (line 9))
- Collecting PyYAML==6.0 (from -r requirements-euler2.8-salt.txt (line 10))
- Collecting pyzmq==25.0.0 (from -r requirements-euler2.8-salt.txt (line 11))
- Collecting requests==2.28.2 (from -r requirements-euler2.8-salt.txt (line 12))
- Collecting salt==3003.1 (from -r requirements-euler2.8-salt.txt (line 13))
- Collecting typing-extensions==4.4.0 (from -r requirements-euler2.8-salt.txt (line 14))
- Collecting urllib3==1.26.14 (from -r requirements-euler2.8-salt.txt (line 15))
- Requirement already satisfied: distro>=1.0.1 in /usr/local/lib/python3.7/site-packages (from salt==3003.1->-r requirements-euler2.8-salt.txt (line 13)) (1.8.0)
- Installing collected packages: certifi, charset-normalizer, typing-extensions, immutables, contextvars, idna, MarkupSafe, Jinja2, msgpack, pycryptodomex, PyYAML, pyzmq, urllib3, requests, salt
- Successfully installed Jinja2-3.0.0 MarkupSafe-2.1.1 PyYAML-6.0 certifi-2022.12.7 charset-normalizer-3.0.1 contextvars-2.4 idna-3.4 immutables-0.19 msgpack-1.0.4 pycryptodomex-3.16.0 pyzmq-25.0.0 requests-2.28.2 salt-3003.1 typing-extensions-4.4.0 urllib3-1.26.14
- /usr/local/bin/salt-minion
- salt 3003.1
- Created symlink /etc/systemd/system/multi-user.target.wants/salt-minion.service → /usr/lib/systemd/system/salt-minion.service.
- ● salt-minion.service - The Salt Minion
- Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; enabled; vendor preset: disabled)
- Active: active (running) since Mon 2023-09-18 20:17:21 CST; 11ms ago
- Docs: man:salt-minion(1)
- file:///usr/share/doc/salt/html/contents.html
- https://docs.saltstack.com/en/latest/contents.html
- Main PID: 291056 (salt-minion)
- Tasks: 1 (limit: 51200)
- Memory: 17.0M
- CGroup: /system.slice/salt-minion.service
- └─291056 /usr/bin/python3 /usr/local/bin/salt-minion
-
- Sep 18 20:17:20 localhost systemd[1]: Starting The Salt Minion...
- Sep 18 20:17:21 localhost systemd[1]: Started The Salt Minion.
看到 active (running),可见salt-minion服务已正常运行起来了。
1、验证版本及可执行程序情况
- root@localhost salt-pip]# salt --version
- salt 3003.1
- [root@localhost salt-pip]# /usr/local/bin/salt-minion --version
- salt-minion 3003.1
- [root@localhost salt-pip]# ll /usr/local/bin/salt*
- -rwxr-xr-x. 1 root root 225 Sep 18 20:17 /usr/local/bin/salt
- -rwxr-xr-x. 1 root root 223 Sep 18 20:17 /usr/local/bin/salt-api
- -rwxr-xr-x. 1 root root 225 Sep 18 20:17 /usr/local/bin/salt-call
- -rwxr-xr-x. 1 root root 227 Sep 18 20:17 /usr/local/bin/salt-cloud
- -rwxr-xr-x. 1 root root 221 Sep 18 20:17 /usr/local/bin/salt-cp
- -rwxr-xr-x. 1 root root 223 Sep 18 20:17 /usr/local/bin/salt-key
- -rwxr-xr-x. 1 root root 229 Sep 18 20:17 /usr/local/bin/salt-master
- -rwxr-xr-x. 1 root root 229 Sep 18 20:17 /usr/local/bin/salt-minion
- -rw-r-----. 1 root root 1027 Sep 18 20:17 /usr/local/bin/salt-proxy
- -rwxr-xr-x. 1 root root 223 Sep 18 20:17 /usr/local/bin/salt-run
- -rwxr-xr-x. 1 root root 223 Sep 18 20:17 /usr/local/bin/salt-ssh
- -rwxr-xr-x. 1 root root 229 Sep 18 20:17 /usr/local/bin/salt-syndic
- -rwxr-xr-x. 1 root root 227 Sep 18 20:17 /usr/local/bin/salt-unity
2、核对服务运行情况
如上,可见安装已完全成功。