В данном разделе приведены сведения по подготовке операционной системы к установке контейнеризированной Платформы НЕЙРОСС.
Общие сведения
Для работы Платформы НЕЙРОСС в контейнеризированной модели требуются предварительная установка Docker — платформы для разработки, развёртывания и запуска приложений в контейнерах, а также Docker Compose — инструмента оркестрации докер-контейнеров (запуска нескольких Докер-сервисов как единого изолированного приложения).
Установка необходимого окружения
Вы можете установить Docker и Docker Compose требуемых версий самостоятельно, а также использовать уже имеющийся сервер с установленными приложениями. Для вашего удобства специалисты компании ИТРИУМ подготовили скрипт автоматической установки требуемых компонентов.
Скрипт поддерживает следующие семейства операционных систем:
- Ubuntu, Debian
- AstraLinux
- RHEL (CentOS, RedHat, Fedora)
Вам потребуется:
- Сформировать файл скрипта и поместить его на целевой сервер.
- Запустить скрипт на выполнение.
Создание файла скрипта
Скопируйте код ниже и сохраните в файл формата SH, например prepare-os-docker.sh.
set -e
# debian packages
add_docker_debian_apt_repo() {
# for ubuntu or debian adding actual repo based on os-release
# for astra adding fixed repo for debian buster
. /etc/os-release
lsb_dist=""
lsb_version=""
case $ID in
"debian" | "ubuntu")
lsb_dist="$ID"
lsb_version=$(lsb_release -cs)
;;
"astra")
lsb_dist="debian"
lsb_version="buster"
;;
*)
# this should not be the case
exit 1
;;
esac
DOCKER_APT_REPO="deb [arch=amd64] https://download.docker.com/linux/$lsb_dist $lsb_version stable"
echo "[docker] adding repo $DOCKER_APT_REPO to /etc/apt/sources.list"
COMMENT_TEXT="repo to install docker appended by neyross-platform installer"
if [ $(grep -c "$COMMENT_TEXT" /etc/apt/sources.list) -eq 1 ]
then
echo "[docker] repo to install docker already added to sources.list by previous run of installer; do nothing"
else
echo "[docker] this is first run; adding repo to install docker..."
sudo tee -a /etc/apt/sources.list > /dev/null <<EOT
# $COMMENT_TEXT
# repo to install docker
$DOCKER_APT_REPO
EOT
fi
}
ensure_docker_debian() {
if command -v docker > /dev/null 2>&1; then
echo "[docker] already installed, do nothing"
else
# standart way with software-properties-common and apt-add-repository not working on Astra
echo "[docker] not installed, installing manually, updating apt..."
sudo apt update
echo "[docker] installing additional packages..."
sudo apt install -y apt-transport-https ca-certificates curl gnupg2
echo "[docker] adding gpg key"
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo "[docker] adding docker apt repo..."
add_docker_debian_apt_repo
echo "[docker] running update..."
sudo apt update
echo "[docker] installing docker-ce..."
sudo apt install -y docker-ce
echo "[docker] done; starting and enabling docker service"
sudo systemctl start docker
sudo systemctl enable docker
fi
docker -v
docker compose version
}
ensure_cockpit_debian() {
if command -v cockpit-bridge > /dev/null 2>&1; then
echo "[cockpit] already installed, do nothing"
else
echo "[cockpit] not found; installing it with plugins"
sudo apt update
sudo apt install -y cockpit cockpit-system cockpit-bridge
echo "[cockpit] done; preparing cockpit.conf"
COCKPIT_CONF_CONTENT=$(cat <<-END
[WebService]
AllowUnencrypted = true
END
)
echo "$COCKPIT_CONF_CONTENT" > /etc/cockpit/cockpit.conf
sudo chgrp cockpit-ws /etc/cockpit/cockpit.conf
echo "[cockpit] done; enabling all network interfaces for cockpit JIC"
GLOBALLY_MANAGED_DEVICES_CONTENT=$(cat <<-END
[keyfile]
unmanaged-devices=none
END
)
echo "$GLOBALLY_MANAGED_DEVICES_CONTENT" > /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
sudo systemctl restart NetworkManager
echo "done; starting and enabling cockpit service"
sudo systemctl start cockpit
sudo systemctl enable cockpit
echo "[cockpit] done with cockpit"
fi
}
install_debian_packages() {
echo "installing ubuntu \ debian packages;"
ensure_docker_debian
ensure_cockpit_debian
}
# end debian packages
# astra packages
ensure_astra_repositories() {
COMMENT_TEXT="added by neyross-platform installer"
if [ $(grep -c "$COMMENT_TEXT" /etc/apt/sources.list) -eq 1 ]
then
echo "repos already added to sources.list by previous run of installer; do nothing"
else
echo "this is first run; adding repos for extended astra..."
sudo tee -a /etc/apt/sources.list > /dev/null <<EOT
# $COMMENT_TEXT
# all astra repos
deb https://dl.astralinux.ru/astra/stable/1.7_x86-64/repository-main/ 1.7_x86-64 main contrib non-free
deb https://dl.astralinux.ru/astra/stable/1.7_x86-64/repository-update/ 1.7_x86-64 main contrib non-free
deb https://dl.astralinux.ru/astra/stable/1.7_x86-64/repository-base/ 1.7_x86-64 main contrib non-free
deb https://dl.astralinux.ru/astra/stable/1.7_x86-64/repository-extended/ 1.7_x86-64 main contrib non-free
deb https://dl.astralinux.ru/astra/stable/1.7_x86-64/repository-extended/ 1.7_x86-64 astra-ce backports
EOT
fi
}
install_astra_packages() {
echo "installing astra packages;"
ensure_astra_repositories
ensure_docker_debian
ensure_cockpit_debian
}
# end astra packages
# rhel packages
ensure_docker_rhel() {
if command -v docker > /dev/null 2>&1; then
echo "docker already installed, do nothing"
else
echo "docker not installed, using script from get.docker.com..."
curl -fsSL https://get.docker.com -o /tmp/install-docker.sh
sh /tmp/install-docker.sh
echo "done installing docker; starting and enabling systemd service..."
systemctl start docker
systemctl enable docker
echo "done with docker"
fi
docker -v
docker compose version
}
ensure_cockpit_rhel() {
if command -v cockpit-bridge > /dev/null 2>&1; then
echo "[cockpit] already installed, do nothing"
else
echo "[cockpit] not found; installing it with plugins"
sudo yum update
sudo yum install cockpit
echo "[cockpit] done; preparing cockpit.conf"
COCKPIT_CONF_CONTENT=$(cat <<-END
[WebService]
AllowUnencrypted = true
END
)
echo "$COCKPIT_CONF_CONTENT" > /etc/cockpit/cockpit.conf
sudo chgrp cockpit-ws /etc/cockpit/cockpit.conf
echo "[cockpit] done; enabling all network interfaces for cockpit JIC"
GLOBALLY_MANAGED_DEVICES_CONTENT=$(cat <<-END
[keyfile]
unmanaged-devices=none
END
)
echo "$GLOBALLY_MANAGED_DEVICES_CONTENT" > /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
sudo systemctl restart NetworkManager
echo "done; starting and enabling cockpit service"
sudo systemctl enable --now cockpit.socket
sudo systemctl start cockpit
sudo systemctl enable cockpit
echo "done; enabling FW rules"
sudo firewall-cmd --permanent --add-service=cockpit
sudo firewall-cmd --reload
echo "[cockpit] done with cockpit"
fi
}
# NOT TESTED YET
install_rhel_packages() {
echo "installing RHEL packages"
ensure_docker_rhel
ensure_cockpit_rhel
}
# end rhel packages
check_docker_version() {
required_version="23.0.0"
if ! command -v docker &>/dev/null; then
echo "docker is not installed" >&2
return
fi
current_version=$(docker --version | awk '{print $3}')
if [[ "$(printf '%s\n' "$required_version" "$current_version" | sort -V | head -n1)" != "$required_version" ]]; then
echo "the current version of Docker (${current_version}) is less than the required version (${required_version})." >&2
exit 1
fi
}
install_packages() {
if [ -f "/etc/os-release" ]; then
. /etc/os-release
echo "checking for docker availability"
check_docker_version
echo "installing system packages; OS ID is $ID, OS ID_LIKE is $ID_LIKE"
case $ID in
"debian" | "ubuntu")
install_debian_packages
;;
"astra")
install_astra_packages
;;
"centos" | "rhel" | "fedora")
install_rhel_packages
;;
# Add cases for other distributions and call the appropriate installation functions
*)
echo "Unsupported distribution, please contact Itrium for support in adding your distribution. Please provide output of /etc/os-release and /etc/lsb_release"
exit 1
;;
esac
else
echo "Unsupported Linux distribution"
exit 1
fi
}
# Make sure we are root or we sudo'd
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
echo "Hello, this script prepares OS to Neyross Platform (installs docker and cockpit)"
install_packages
echo "done, ready to install neyross-platform-docker / neyross-start"
exit 0
Поместите данный файл на целевой сервер (например, в директорию $HOME).
СОВЕТ: для загрузки файла по сети с Windows-машины, вы можете воспользоваться свободно-распространяемым клиентом удалённого доступа Putty, например, — SCP-клиентом с интерфейсом командной строки pscp.exe.
Поместите файл pscp.exe из дистрибутива Putty в папку со скриптом инсталляции и из интерфейса командной строки ОС Windows выполните:
Где:
- prepare-os-docker.sh — скрипт подготовки ОС;
- user — имя суперпользователя в ОС;
- 10.1.29.38 — IP-адрес сервера;
- /home/user/ — путь к целевой папке.
Запуск скрипта
В терминале ОС целевого сервера в директории с файлом prepare-os-docker.sh выполните:
где, prepare-os-docker.sh — название файла скрипта.
Работа скрипта
Ниже приведён алгоритм работы и пример вывода скрипта.
Выполняется обновление ОC, установка и запуск Docker и Docker Compose.
Hello, this script prepares OS to Neyross Platform (installs docker and cockpit)
checking for docker availability
docker is not installed
installing system packages; OS ID is ubuntu, OS ID_LIKE is debian
installing ubuntu \ debian packages;
[docker] not installed, installing manually, updating apt...
Hit:1 http://ru.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ru.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ru.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://ru.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
68 packages can be upgraded. Run 'apt list --upgradable' to see them.
[docker] installing additional packages...
Reading package lists... Done
...
[docker] adding docker apt repo...
[docker] adding repo deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable to /etc/apt/sources.list
[docker] this is first run; adding repo to install docker...
[docker] running update...
Hit:1 http://ru.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ru.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ru.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://ru.archive.ubuntu.com/ubuntu focal-security InRelease
Get:5 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
Get:6 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [51.6 kB]
Fetched 109 kB in 1s (81.0 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
68 packages can be upgraded. Run 'apt list --upgradable' to see them.
...
The following NEW packages will be installed:
containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin pigz slirp4netns
0 upgraded, 8 newly installed, 0 to remove and 68 not upgraded.
Need to get 123 MB of archives.
After this operation, 442 MB of additional disk space will be used.
Get:1 http://ru.archive.ubuntu.com/ubuntu focal/universe amd64 pigz amd64 2.4-1 [57.4 kB]
...
Selecting previously unselected package pigz.
(Reading database ... 134175 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
...
Setting up docker-buildx-plugin (0.17.1-1~ubuntu.20.04~focal) ...
Setting up containerd.io (1.7.22-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.29.7-1~ubuntu.20.04~focal) ...
Setting up docker-ce-cli (5:27.3.1-1~ubuntu.20.04~focal) ...
Setting up pigz (2.4-1) ...
Setting up docker-ce-rootless-extras (5:27.3.1-1~ubuntu.20.04~focal) ...
Setting up docker-ce (5:27.3.1-1~ubuntu.20.04~focal) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.23) ...
[docker] done;
starting and enabling docker service
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
Docker version 27.3.1, build ce12230
Docker Compose version v2.29.7Выполняется установка Cockpit.
[cockpit] not found; installing it with plugins
Hit:1 http://ru.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ru.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ru.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 https://download.docker.com/linux/ubuntu focal InRelease
Hit:5 http://ru.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
68 packages can be upgraded. Run 'apt list --upgradable' to see them.
...
The following NEW packages will be installed:
cockpit cockpit-bridge cockpit-dashboard cockpit-networkmanager cockpit-packagekit cockpit-storaged cockpit-system cockpit-ws cracklib-runtime dns-root-data dnsmasq-base libblockdev-mdraid2 libbluetooth3 libbytesize1
libcrack2 libidn11 libjansson4 libndp0 libnl-route-3-200 libnm0 libpwquality-common libpwquality-tools libpwquality1 libteamdctl0 network-manager network-manager-pptp ppp pptp-linux wamerican wpasupplicant
0 upgraded, 30 newly installed, 0 to remove and 68 not upgraded.
Need to get 10.2 MB of archives.
After this operation, 25.4 MB of additional disk space will be used.
Get:1 http://ru.archive.ubuntu.com/ubuntu focal/universe amd64 cockpit-bridge amd64 215-1 [557 kB]
...
Get:30 http://ru.archive.ubuntu.com/ubuntu focal/main amd64 wamerican all 2018.04.16-1 [210 kB]
Fetched 10.2 MB in 2s (6,363 kB/s)
Preconfiguring packages ...
Selecting previously unselected package cockpit-bridge.
(Reading database ... 134429 files and directories currently installed.)
Preparing to unpack .../00-cockpit-bridge_215-1_amd64.deb ...
Unpacking cockpit-bridge (215-1) ...
...
Setting up cockpit-ws (215-1) ...
Adding system user `cockpit-ws' (UID 116) ...
Adding new group `cockpit-ws' (GID 122) ...
Adding new user `cockpit-ws' (UID 116) with group `cockpit-ws' ...
Adding system user `cockpit-wsinstance' (UID 117) ...
Adding new group `cockpit-wsinstance' (GID 123) ...
Adding new user `cockpit-wsinstance' (UID 117) with group `cockpit-wsinstance' ...
...
Setting up cockpit-packagekit (215-1) ...
Setting up network-manager (1.22.10-1ubuntu2.4) ...
Created symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service → /lib/systemd/system/NetworkManager-dispatcher.service.
Created symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service → /lib/systemd/system/NetworkManager-wait-online.service.
Created symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service → /lib/systemd/system/NetworkManager.service.
...
Setting up cockpit-system (215-1) ...
Setting up cockpit (215-1) ...
Processing triggers for systemd (245.4-4ubuntu3.23) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
Processing triggers for libc-bin (2.31-0ubuntu9.16) ...
[cockpit] done; preparing cockpit.conf
[cockpit] done; enabling all network interfaces for cockpit JIC
done; starting and enabling cockpit service
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
[cockpit] done with cockpit
done, ready to install neyross-platform-docker / neyross-start
Ошибки выполнения
Если выполняются попытки поиска дистрибутивов на локальном носителе, который более не доступен, например:
удалите данный источник из списка. Для этого перейдите в режим редактирования файла sources.list
и удалите строку с недоступным источником, файлы будут загружены из сети Интернет, при отсутствии доступа в сеть, укажите правильный путь с дистрибутивами.
Если Docker уже был установлен в среде операционной системы, проверьте, что установлены все зависимости, в частности, — установлен docker compose. Для этого выполните команды
docker compose version
Следующий шаг:
Перейдите к установке НЕЙРОСС Старт