一鍵安裝rancher

2021-10-23 16:18:06 字數 2500 閱讀 4779

shell指令碼

本文件不詳細的地方在官網檢視

#!/bin/bash

# 當前目錄

current_dir=

$(cd

"$(dirname "$0")

" pwd

)#資料庫ip

dbhost=192.168.0.229

#資料庫賬號

dbuser=root

#資料庫埠

dbport=43306

#資料庫密碼

dbpassword=cobbler1234!

#資料庫的資料庫

dbname=cattle

sudo firewall-cmd --zone=public --add-port=2280/tcp --permanent

firewall-cmd --list-all

#檢測docker是否安裝

if ! which docker >/dev/null ; then

echo -e "\033[31m 請先安裝docker \033[0m"

exit

fi#檢測 docker-compose是否安裝if!

which docker-compose >/dev/null ;

then

echo -e "\033[31m 請先安裝docker-compose \033[0m"

exit

fi##install if[

[ -f "$current_dir/rancherimages.tar.gz"]]

;then

echo

"... 離線安裝 rancher"

chmod +x $current_dir/images-load.sh

cd$current_dir

&& ./images-load.sh

else

echo

fifilepath=

"$current_dir/docker-compose.yml"

sed -i "s/dbhost/$/g"

$filepath

sed -i "s/dbuser/$/g"

$filepath

sed -i "s/dbport/$/g"

$filepath

sed -i "s/dbpassword/$/g"

$filepath

sed -i "s/dbname/$/g"

$filepath

docker-compose up -d

docker-compose.yml

version: '2'

services:

magic-rancher:

image: rancher/server:stable

container_name: rancher

hostname: rancher

restart: unless-stopped

command: --db-host dbhost --db-user dbuser --db-port dbport --db-pass dbpassword --db-name dbname

ports:

- "2280:8080"

image-load.sh

#!/bin/sh

echo

"==== starting to load images ===="

echo

"==== 解壓映象包 ===="

tar -zxvf rancherimages.tar.gz

echo

"==== 系統公共匯入映象 ===="

docker load < rancherimages/rancher-server.tar

docker load < rancherimages/rancher-net_holder.tar

docker load < rancherimages/rancher-agent.tar

docker load < rancherimages/rancher-net.tar

docker load < rancherimages/rancher-dns.tar

docker load < rancherimages/rancher-scheduler.tar

docker load < rancherimages/rancher-healthcheck.tar

docker load < rancherimages/rancher-metadata.tar

docker load < rancherimages/rancher-network-manager.tar

echo

"==== 檢視系統公共映象 ===="

docker images

echo

"==== end to load images ===="

一鍵安裝 Apache Mysql Php

適用環境 系統支援 centos 5 32bit 64bit centos 6 32bit 64bit 記憶體要求 256m 安裝了什麼 1 apache 2.2.22或apache 2.4.2 2 mysql 5.5.24 3 php 5.2.17或php 5.3.13 4 phpmyadmin ...

LAMP一鍵安裝

lamp一鍵安裝包常用於搭建動態網頁。lamp一鍵安裝包在使用時經常配合linux apache mysql mariadb perl php python等程式一起使用,這此軟體之間有著很好相容性,能夠幫助使用者快速搭建 快速建立web伺服器。適用環境 首先安裝 wget screen unzip...

LNMP一鍵安裝

安裝步驟 1 使用putty或類似的ssh工具登陸vps或伺服器 登陸後執行 screen s lnmp 如果提示screen command not found 命令不存在可以執行 yum install screen 或 apt get install screen安裝,詳細內容參考screen...