mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
install
This commit is contained in:
parent
177cd076c2
commit
0ab5559573
7 changed files with 89 additions and 85 deletions
|
@ -39,12 +39,12 @@ You can see the sceenshoots below:
|
||||||
You should have root privileges user to install or upgrade Websoft9, if you use no-root user you can `sudo su` for it
|
You should have root privileges user to install or upgrade Websoft9, if you use no-root user you can `sudo su` for it
|
||||||
|
|
||||||
```
|
```
|
||||||
# install by default
|
# Install by default
|
||||||
curl https://websoft9.github.io/websoft9/install/install.sh | bash
|
curl https://websoft9.github.io/websoft9/install/install.sh | bash
|
||||||
|
|
||||||
|
|
||||||
# install Websoft9 development version and install path at /data/websoft9/source
|
# Install Websoft9 special version by development artifact and install path at /data/websoft9/source ...
|
||||||
wget https://websoft9.github.io/websoft9/install/install.sh && bash install.sh --port 9000 --channel dev --path "/data/websoft9/source"
|
wget https://websoft9.github.io/websoft9/install/install.sh && bash install.sh --port 9000 --channel dev --path "/data/websoft9/source" --version "0.8.25"
|
||||||
```
|
```
|
||||||
After installation, access it by: **http://Internet IP:9000** and using **Linux user** for login
|
After installation, access it by: **http://Internet IP:9000** and using **Linux user** for login
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@ Developer should improve these codes:
|
||||||
- Install and Upgrade Cockpit: */install/install_cockpit.sh*
|
- Install and Upgrade Cockpit: */install/install_cockpit.sh*
|
||||||
|
|
||||||
- Override the default menus: */cockpit/menu_override*
|
- Override the default menus: */cockpit/menu_override*
|
||||||
> shell.override.json is used for Top menu of Cockpit
|
> shell.override.json is used for Top menu of Cockpit。Override function until Cockpit 297
|
||||||
|
|
||||||
- Cockipt configuration file: */cockpit/cockpit.conf*
|
- Cockipt configuration file: */cockpit/cockpit.conf*
|
||||||
|
|
|
@ -8,31 +8,31 @@ export PATH
|
||||||
# Command-line options
|
# Command-line options
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
#
|
#
|
||||||
# --force <y|n>
|
# --version
|
||||||
# Use the --force option to ignore all interactive choices. default is n, for example:
|
# Use the --version option to install a special version for installation. default is latest, for example:
|
||||||
#
|
#
|
||||||
# $ sudo sh install.sh --force n
|
# $ sudo bash install.sh --version "0.8.25"
|
||||||
#
|
#
|
||||||
# --port <9000>
|
# --port <9000>
|
||||||
# Use the --port option to set Websoft9 cosole port. default is 9000, for example:
|
# Use the --port option to set Websoft9 cosole port. default is 9000, for example:
|
||||||
#
|
#
|
||||||
# $ sudo sh install.sh --port 9001
|
# $ sudo bash install.sh --port 9001
|
||||||
#
|
#
|
||||||
# --channel <release|dev>
|
# --channel <release|dev>
|
||||||
# Use the --channel option to install a release(production) or dev distribution. default is release, for example:
|
# Use the --channel option to install a release(production) or dev distribution. default is release, for example:
|
||||||
#
|
#
|
||||||
# $ sudo sh install.sh --channel release
|
# $ sudo bash install.sh --channel release
|
||||||
#
|
#
|
||||||
# --path
|
# --path
|
||||||
# Use the --path option to for installation path for example:
|
# Use the --path option to for installation path for example:
|
||||||
#
|
#
|
||||||
# $ sudo sh install.sh --path "/data/websoft9/source"
|
# $ sudo bash install.sh --path "/data/websoft9/source"
|
||||||
#
|
#
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
|
||||||
# 设置参数的默认值
|
# 设置参数的默认值
|
||||||
force="n"
|
version="latest"
|
||||||
port="9000"
|
port="9000"
|
||||||
channel="release"
|
channel="release"
|
||||||
path="/data/websoft9/source"
|
path="/data/websoft9/source"
|
||||||
|
@ -40,8 +40,8 @@ path="/data/websoft9/source"
|
||||||
# 获取参数值
|
# 获取参数值
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--force)
|
--version)
|
||||||
force="$2"
|
version="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--port)
|
--port)
|
||||||
|
@ -64,7 +64,7 @@ done
|
||||||
|
|
||||||
# 输出参数值
|
# 输出参数值
|
||||||
echo "Your installation parameters are as follows: "
|
echo "Your installation parameters are as follows: "
|
||||||
echo "--force: $force"
|
echo "--version: $version"
|
||||||
echo "--port: $port"
|
echo "--port: $port"
|
||||||
echo "--channel: $channel"
|
echo "--channel: $channel"
|
||||||
echo "--path: $path"
|
echo "--path: $path"
|
||||||
|
@ -75,11 +75,11 @@ echo "--path: $path"
|
||||||
export http_port=80
|
export http_port=80
|
||||||
export https_port=443
|
export https_port=443
|
||||||
export cockpit_port=$port
|
export cockpit_port=$port
|
||||||
export force_install=$force
|
|
||||||
export install_path=$path
|
export install_path=$path
|
||||||
export channel
|
export channel
|
||||||
|
export version
|
||||||
export systemd_path="/opt/websoft9/systemd"
|
export systemd_path="/opt/websoft9/systemd"
|
||||||
export source_zip="websoft9-latest.zip"
|
export source_zip="websoft9-$version.zip"
|
||||||
export source_unzip="websoft9"
|
export source_unzip="websoft9"
|
||||||
export source_github_pages="https://websoft9.github.io/websoft9"
|
export source_github_pages="https://websoft9.github.io/websoft9"
|
||||||
export tools_yum="git curl wget yum-utils jq bc unzip"
|
export tools_yum="git curl wget yum-utils jq bc unzip"
|
||||||
|
@ -123,7 +123,7 @@ download_source() {
|
||||||
echo_prefix_source=$'\n[Dowload Source] - '
|
echo_prefix_source=$'\n[Dowload Source] - '
|
||||||
echo "$echo_prefix_source Download Websoft9 source code from $artifact_url/$source_zip"
|
echo "$echo_prefix_source Download Websoft9 source code from $artifact_url/$source_zip"
|
||||||
|
|
||||||
rm -rf websoft9-latest.zip*
|
find . -type f -name "websoft9*.zip*" -exec rm -f {} \;
|
||||||
if [ -d "$install_path" ]; then
|
if [ -d "$install_path" ]; then
|
||||||
echo "Directory $install_path already exists and installation will cover it."
|
echo "Directory $install_path already exists and installation will cover it."
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,6 +7,7 @@ export PATH
|
||||||
|
|
||||||
## This script is used for install or upgrade Cockpit on Linux
|
## This script is used for install or upgrade Cockpit on Linux
|
||||||
## Cockpit build at redhat family: https://copr.fedorainfracloud.org/coprs/g/cockpit/cockpit-preview/monitor/
|
## Cockpit build at redhat family: https://copr.fedorainfracloud.org/coprs/g/cockpit/cockpit-preview/monitor/
|
||||||
|
## Cockpit reposoitory list: https://pkgs.org/download/cockpit
|
||||||
## PackageKit: https://www.freedesktop.org/software/PackageKit/
|
## PackageKit: https://www.freedesktop.org/software/PackageKit/
|
||||||
## Not use pkcon install/update cockpit, the reason is: https://cockpit-project.org/faq.html#error-message-about-being-offline
|
## Not use pkcon install/update cockpit, the reason is: https://cockpit-project.org/faq.html#error-message-about-being-offline
|
||||||
## pkcon can read repositories at you system directly, it don't provide exra repository
|
## pkcon can read repositories at you system directly, it don't provide exra repository
|
||||||
|
@ -102,13 +103,7 @@ check_ports() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Print_Version(){
|
Print_Version(){
|
||||||
|
sudo /usr/libexec/cockpit-ws --version 2>/dev/null || sudo /usr/lib/cockpit-ws --version 2>/dev/null
|
||||||
if command -v apt >/dev/null; then
|
|
||||||
apt show cockpit | head -n 15
|
|
||||||
else
|
|
||||||
yum info cockpit || dnf info cockpit
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Install_PackageKit(){
|
Install_PackageKit(){
|
||||||
|
@ -121,14 +116,14 @@ Install_PackageKit(){
|
||||||
if [ "$(cat /etc/redhat-release)" = "Redhat7" ]; then
|
if [ "$(cat /etc/redhat-release)" = "Redhat7" ]; then
|
||||||
sudo subscription-manager repos --enable rhel-7-server-extras-rpms
|
sudo subscription-manager repos --enable rhel-7-server-extras-rpms
|
||||||
fi
|
fi
|
||||||
sudo yum install PackageKit
|
sudo yum install PackageKit -y
|
||||||
|
|
||||||
elif command -v dnf &> /dev/null; then
|
elif command -v dnf &> /dev/null; then
|
||||||
sudo dnf install PackageKit
|
sudo dnf install PackageKit -y
|
||||||
|
|
||||||
elif command -v apt &> /dev/null; then
|
elif command -v apt &> /dev/null; then
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install packagekit
|
sudo apt install packagekit -y
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "PackageKit not found, Cockpit cannot be installed"
|
echo "PackageKit not found, Cockpit cannot be installed"
|
||||||
|
@ -154,7 +149,7 @@ Restart_Cockpit(){
|
||||||
echo "$echo_prefix_cockpit Restart Cockpit"
|
echo "$echo_prefix_cockpit Restart Cockpit"
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl restart cockpit
|
sudo systemctl restart cockpit
|
||||||
sudo systemctl restart cockpit.socket
|
sudo systemctl restart cockpit.socket 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_Firewall(){
|
Set_Firewall(){
|
||||||
|
@ -290,12 +285,22 @@ Test_Cockpit(){
|
||||||
echo "$echo_prefix_cockpit Test Cockpit console accessibility"
|
echo "$echo_prefix_cockpit Test Cockpit console accessibility"
|
||||||
test_cmd="curl localhost:$cockpit_port"
|
test_cmd="curl localhost:$cockpit_port"
|
||||||
|
|
||||||
|
start_time=$(date +%s)
|
||||||
|
timeout=30
|
||||||
|
while true; do
|
||||||
if $test_cmd >/dev/null 2>&1; then
|
if $test_cmd >/dev/null 2>&1; then
|
||||||
echo "Cockpit running OK..."
|
echo "Cockpit running OK..."
|
||||||
|
break
|
||||||
else
|
else
|
||||||
echo "Cockpit is not running..."
|
current_time=$(date +%s)
|
||||||
|
elapsed_time=$(($current_time - $start_time))
|
||||||
|
if [ $elapsed_time -ge $timeout ]; then
|
||||||
|
echo "Cockpit is not running... Timeout after waiting $timeout seconds."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
Print_Version
|
Print_Version
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,29 +5,25 @@ export PATH
|
||||||
# Install and Upgade Docker for mosts of Linux
|
# Install and Upgade Docker for mosts of Linux
|
||||||
# This script is intended from https://get.docker.com and add below:
|
# This script is intended from https://get.docker.com and add below:
|
||||||
#
|
#
|
||||||
# - remove Podman
|
# - install or update Docker
|
||||||
# - support Redhat, CentOS-Stream, OracleLinux, AmazonLinux
|
# - support Redhat, CentOS-Stream, OracleLinux, AmazonLinux
|
||||||
#
|
#
|
||||||
# 1. download the script
|
# 1. download the script
|
||||||
#
|
#
|
||||||
# $ curl -fsSL https://websoft9.github.io/websoft9/install/install-docker.sh -o install-docker.sh
|
# $ curl -fsSL https://websoft9.github.io/websoft9/install/install_docker.sh -o install_docker.sh
|
||||||
#
|
#
|
||||||
# 2. verify the script's content
|
# 2. verify the script's content
|
||||||
#
|
#
|
||||||
# $ cat install-docker.sh
|
# $ cat install_docker.sh
|
||||||
#
|
#
|
||||||
# 3. run the script with --dry-run to verify the steps it executes
|
# 3. run the script with --dry-run to verify the steps it executes
|
||||||
#
|
#
|
||||||
# $ sh install-docker.sh --dry-run
|
# $ sh install_docker.sh --dry-run
|
||||||
#
|
#
|
||||||
# 4. run the script either as root, or using sudo to perform the installation.
|
# 4. run the script either as root, or using sudo to perform the installation.
|
||||||
#
|
#
|
||||||
# $ sudo sh install-docker.sh
|
# $ sudo sh install_docker.sh
|
||||||
|
|
||||||
############################################################
|
|
||||||
# Below vars export from install.sh
|
|
||||||
# $force_install
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
|
|
||||||
docker_packages="docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
|
docker_packages="docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
|
||||||
|
@ -45,18 +41,21 @@ is_apt_locked(){
|
||||||
docker_exist() {
|
docker_exist() {
|
||||||
# 检查 `docker` 命令是否存在
|
# 检查 `docker` 命令是否存在
|
||||||
if ! command -v docker &> /dev/null; then
|
if ! command -v docker &> /dev/null; then
|
||||||
echo "false"
|
echo "docker command not exist"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 检查 Docker 服务是否存在
|
# 检查 Docker 服务是否正在运行
|
||||||
systemctl status docker &> /dev/null
|
systemctl is-active docker.service &> /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "false"
|
echo "Docker service is not running, trying to start it..."
|
||||||
|
systemctl start docker.service
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to start Docker service."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "true"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ Install_Docker(){
|
||||||
|
|
||||||
|
|
||||||
Upgrade_Docker(){
|
Upgrade_Docker(){
|
||||||
if eval "$docker_exist"; then
|
if docker_exist; then
|
||||||
echo "$echo_prefix_docker Upgrading Docker for your system..."
|
echo "$echo_prefix_docker Upgrading Docker for your system..."
|
||||||
dnf --version >/dev/null 2>&1
|
dnf --version >/dev/null 2>&1
|
||||||
dnf_status=$?
|
dnf_status=$?
|
||||||
|
@ -113,30 +112,10 @@ else
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
Remove_Podman(){
|
|
||||||
echo "$echo_prefix_docker Try to remove Podman"
|
|
||||||
podman pod stop --all
|
|
||||||
# Remove Podman and its dependencies
|
|
||||||
if [ -x "$(command -v dnf)" ]; then
|
|
||||||
sudo dnf remove podman -y
|
|
||||||
elif [ -x "$(command -v apt)" ]; then
|
|
||||||
sudo apt remove podman -y
|
|
||||||
elif [ -x "$(command -v zypper)" ]; then
|
|
||||||
sudo zypper remove podman -y
|
|
||||||
elif [ -x "$(command -v pacman)" ]; then
|
|
||||||
sudo pacman -Rs podman --noconfirm
|
|
||||||
else
|
|
||||||
echo "Unable to find a suitable package manager to remove Podman."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Podman has been stopped and removed."
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Set_Docker(){
|
Set_Docker(){
|
||||||
# should have Docker server and Docker cli
|
# should have Docker server and Docker cli
|
||||||
if eval $docker_exist; then
|
if docker_exist; then
|
||||||
echo "$echo_prefix_docker Starting to Set docker..."
|
echo "$echo_prefix_docker Starting to Set docker..."
|
||||||
sudo systemctl enable docker
|
sudo systemctl enable docker
|
||||||
sudo systemctl restart docker
|
sudo systemctl restart docker
|
||||||
|
@ -144,23 +123,10 @@ if eval $docker_exist; then
|
||||||
sudo docker network create websoft9
|
sudo docker network create websoft9
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Docker no installed, exit..."
|
echo "Docker settings failed, exit..."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## This Script starting here ....................................
|
|
||||||
|
|
||||||
if command -v podman &> /dev/null; then
|
|
||||||
if [ "$force_install" = "y" ]; then
|
|
||||||
Remove_Podman
|
|
||||||
else
|
|
||||||
read -p "Install Websoft9 will remove Podman and Install Docker for continue(y/n): " answer
|
|
||||||
if [ "$answer" = "y" ]; then
|
|
||||||
Remove_Podman
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
Upgrade_Docker
|
Upgrade_Docker
|
||||||
Set_Docker
|
Set_Docker
|
26
install/install_podman.sh
Normal file
26
install/install_podman.sh
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
# to do
|
||||||
|
|
||||||
|
|
||||||
|
Remove_Podman(){
|
||||||
|
echo "$echo_prefix_docker Try to remove Podman"
|
||||||
|
podman pod stop --all
|
||||||
|
# Remove Podman and its dependencies
|
||||||
|
if [ -x "$(command -v dnf)" ]; then
|
||||||
|
sudo dnf remove podman -y
|
||||||
|
elif [ -x "$(command -v apt)" ]; then
|
||||||
|
sudo apt remove podman -y
|
||||||
|
elif [ -x "$(command -v zypper)" ]; then
|
||||||
|
sudo zypper remove podman -y
|
||||||
|
elif [ -x "$(command -v pacman)" ]; then
|
||||||
|
sudo pacman -Rs podman --noconfirm
|
||||||
|
else
|
||||||
|
echo "Unable to find a suitable package manager to remove Podman."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Podman has been stopped and removed."
|
||||||
|
|
||||||
|
}
|
|
@ -23,6 +23,11 @@
|
||||||
"8",
|
"8",
|
||||||
"7"
|
"7"
|
||||||
],
|
],
|
||||||
|
"Oracle Linux": [
|
||||||
|
"9",
|
||||||
|
"8",
|
||||||
|
"7"
|
||||||
|
],
|
||||||
"Rocky": [
|
"Rocky": [
|
||||||
"9",
|
"9",
|
||||||
"8"
|
"8"
|
||||||
|
@ -32,10 +37,12 @@
|
||||||
"8"
|
"8"
|
||||||
],
|
],
|
||||||
"Debian": [
|
"Debian": [
|
||||||
|
"12",
|
||||||
"11",
|
"11",
|
||||||
"10"
|
"10"
|
||||||
],
|
],
|
||||||
"Ubuntu": [
|
"Ubuntu": [
|
||||||
|
"23.04",
|
||||||
"22.04",
|
"22.04",
|
||||||
"20.04",
|
"20.04",
|
||||||
"18.04"
|
"18.04"
|
||||||
|
|
Loading…
Reference in a new issue