赞
踩
参考官方安装:https://www.runoob.com/docker/centos-docker-install.html
如果曾经安装过docker,但docker不能正常使用,建议先彻底卸载docker:
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
rm -rf /etc/systemd/system/docker.service.d
rm -rf /var/lib/docker
rm -rf /var/run/docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
[root@localhost base]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 93d2499759296ac1f9c510605fef85052a2c32be
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c 'yum install -y -q yum-utils'
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
+ sh -c 'yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Metadata Cache Created
+ '[' -n '' ']'
+ sh -c 'yum install -y -q docker-ce'
+ version_gte 20.10
+ '[' -z '' ']'
+ return 0
+ sh -c 'yum install -y -q docker-ce-rootless-extras'
Package docker-ce-rootless-extras-20.10.12-3.el7.x86_64 already installed and latest version
================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/
WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/
================================================================================
设置仓库,安装所需的软件包。yum-utils 提供了 yum-config-manager ,并且 device mapper 存储驱动程序需要 device-mapper-persistent-data 和 lvm2
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
[root@localhost base]# sudo yum install -y yum-utils \
> device-mapper-persistent-data \
> lvm2
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.6.3-1.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 will be an update
---> Package lvm2.x86_64 7:2.02.166-1.el7 will be updated
---> Package lvm2.x86_64 7:2.02.187-6.el7_9.5 will be an update
--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7_9.5 for package: 7:lvm2-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_141)(64bit) for package: 7:lvm2-2.02.187-6.el7_9.5.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_138)(64bit) for package: 7:lvm2-2.02.187-6.el7_9.5.x86_64
--> Running transaction check
---> Package device-mapper-libs.x86_64 7:1.02.135-1.el7 will be updated
--> Processing Dependency: device-mapper-libs = 7:1.02.135-1.el7 for package: 7:device-mapper-1.02.135-1.el7.x86_64
---> Package device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package lvm2-libs.x86_64 7:2.02.166-1.el7 will be updated
---> Package lvm2-libs.x86_64 7:2.02.187-6.el7_9.5 will be an update
--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7_9.5 for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-event.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 will be an update
--> Processing Dependency: device-mapper-event-libs = 7:1.02.170-6.el7_9.5 for package: 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================
Updating:
device-mapper-persistent-data x86_64 0.8.5-3.el7_9.2 updates 423 k
lvm2 x86_64 7:2.02.187-6.el7_9.5 updates 1.3 M
Updating for dependencies:
device-mapper x86_64 7:1.02.170-6.el7_9.5 updates 297 k
device-mapper-event x86_64 7:1.02.170-6.el7_9.5 updates 192 k
device-mapper-event-libs x86_64 7:1.02.170-6.el7_9.5 updates 192 k
device-mapper-libs x86_64 7:1.02.170-6.el7_9.5 updates 325 k
lvm2-libs x86_64 7:2.02.187-6.el7_9.5 updates 1.1 M
Transaction Summary
============================================================================================================================================================================================
Upgrade 2 Packages (+5 Dependent packages)
Total size: 3.8 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 1/14
Updating : 7:device-mapper-1.02.170-6.el7_9.5.x86_64 2/14
Updating : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64 3/14
Updating : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64 4/14
Updating : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64 5/14
Updating : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 6/14
Updating : 7:lvm2-2.02.187-6.el7_9.5.x86_64 7/14
Cleanup : 7:lvm2-2.02.166-1.el7.x86_64 8/14
Cleanup : 7:lvm2-libs-2.02.166-1.el7.x86_64 9/14
Cleanup : 7:device-mapper-event-1.02.135-1.el7.x86_64 10/14
Cleanup : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64 11/14
Cleanup : 7:device-mapper-1.02.135-1.el7.x86_64 12/14
Cleanup : 7:device-mapper-libs-1.02.135-1.el7.x86_64 13/14
Cleanup : device-mapper-persistent-data-0.6.3-1.el7.x86_64 14/14
Verifying : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64 1/14
Verifying : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64 2/14
Verifying : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 3/14
Verifying : 7:device-mapper-1.02.170-6.el7_9.5.x86_64 4/14
Verifying : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64 5/14
Verifying : 7:lvm2-2.02.187-6.el7_9.5.x86_64 6/14
Verifying : 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 7/14
Verifying : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64 8/14
Verifying : 7:device-mapper-libs-1.02.135-1.el7.x86_64 9/14
Verifying : 7:lvm2-2.02.166-1.el7.x86_64 10/14
Verifying : device-mapper-persistent-data-0.6.3-1.el7.x86_64 11/14
Verifying : 7:device-mapper-1.02.135-1.el7.x86_64 12/14
Verifying : 7:lvm2-libs-2.02.166-1.el7.x86_64 13/14
Verifying : 7:device-mapper-event-1.02.135-1.el7.x86_64 14/14
Updated:
device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 lvm2.x86_64 7:2.02.187-6.el7_9.5
Dependency Updated:
device-mapper.x86_64 7:1.02.170-6.el7_9.5 device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5
device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5 lvm2-libs.x86_64 7:2.02.187-6.el7_9.5
Complete!
使用以下命令来设置稳定的仓库
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装最新版本的 Docker Engine-Community 和 containerd,或者转到下一步安装特定版本:
sudo yum install docker-ce docker-ce-cli containerd.io
启动 Docker
sudo systemctl start docker
检查Docker状态
sudo systemctl status docker
[root@localhost zbox]# sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2022-01-05 16:59:36 CST; 1 weeks 1 days ago
Docs: https://docs.docker.com
Main PID: 97399 (dockerd)
Tasks: 0
Memory: 229.1M
CGroup: /system.slice/docker.service
├─25950 /usr/bin/containerd-shim-runc-v2 -namespace moby -id e5bba89299232dd51b84b08dc2cb55625c3b3ba2f0351c1b3b5c94739dc4d9e4 -address /var/run/docker/containerd/containerd.s...
├─25996 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3307 -container-ip 172.30.10.3 -container-port 3306
(本次使用的是离线安装,所以需要先下载安装包)
安装包下载地址:https://community.fit2cloud.com/#/products/metersphere/downloads
tar -zxvf metersphere-offline-installer-v1.15.4.tar.gz
cd metersphere-offline-installer-v1.15.4/
sudo sh install.sh
[root@localhost base]# tail -zxvf metersphere-offline-installer-v1.15.4.tar.gz
[root@localhost base]# cd metersphere-offline-installer-v1.15.4/
[root@localhost metersphere-offline-installer-v1.15.4]# sudo sh install.sh
存在已安装的 MeterSphere, 安装目录为 /opt/metersphere, 执行升级流程
[MeterSphere Log]: 拷贝安装文件到目标目录
‘./metersphere/docker-compose-kafka.yml’ -> ‘/opt/metersphere/docker-compose-kafka.yml’ (backup: ‘/opt/metersphere/docker-compose-kafka.yml.20220105-1719’)
‘./metersphere/docker-compose-prometheus.yml’ -> ‘/opt/metersphere/docker-compose-prometheus.yml’ (backup: ‘/opt/metersphere/docker-compose-prometheus.yml.20220105-1719’)
‘./metersphere/docker-compose-node-controller.yml’ -> ‘/opt/metersphere/docker-compose-node-controller.yml’ (backup: ‘/opt/metersphere/docker-compose-node-controller.yml.20220105-1719’)
‘./metersphere/docker-compose-mysql.yml’ -> ‘/opt/metersphere/docker-compose-mysql.yml’ (backup: ‘/opt/metersphere/docker-compose-mysql.yml.20220105-1719’)
‘./metersphere/conf/my.cnf’ -> ‘/opt/metersphere/conf/my.cnf’ (backup: ‘/opt/metersphere/conf/my.cnf.20220105-1719’)
‘./metersphere/conf/version’ -> ‘/opt/metersphere/conf/version’ (backup: ‘/opt/metersphere/conf/version.20220105-1719’)
‘./metersphere/conf/prometheus/prometheus.yml’ -> ‘/opt/metersphere/conf/prometheus/prometheus.yml’ (backup: ‘/opt/metersphere/conf/prometheus/prometheus.yml.20220105-1719’)
‘./metersphere/conf/metersphere.properties’ -> ‘/opt/metersphere/conf/metersphere.properties’ (backup: ‘/opt/metersphere/conf/metersphere.properties.20220105-1719’)
‘./metersphere/version’ -> ‘/opt/metersphere/version’ (backup: ‘/opt/metersphere/version.20220105-1719’)
‘./metersphere/docker-compose-base.yml’ -> ‘/opt/metersphere/docker-compose-base.yml’ (backup: ‘/opt/metersphere/docker-compose-base.yml.20220105-1719’)
‘./metersphere/docker-compose-server.yml’ -> ‘/opt/metersphere/docker-compose-server.yml’ (backup: ‘/opt/metersphere/docker-compose-server.yml.20220105-1719’)
‘./metersphere/logs/README.md’ -> ‘/opt/metersphere/logs/README.md’ (backup: ‘/opt/metersphere/logs/README.md.20220105-1719’)
[MeterSphere Log]: ======================= 开始安装 =======================
[MeterSphere Log]: 检测到 Docker 已安装,跳过安装步骤
[MeterSphere Log]: 启动 Docker
Redirecting to /bin/systemctl start docker.service
[MeterSphere Log]: 检测到 Docker Compose 已安装,跳过安装步骤
[MeterSphere Log]: 加载镜像
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/jmeter-master:5.4.1-ms13-jdk8
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/kafka:2
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/metersphere:v1.15.4
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/ms-data-streaming:v1.15.4
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/ms-node-controller:v1.15.4
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/mysql:5.7.33
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/node-exporter:latest
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/prometheus:latest
Loaded image: registry.cn-qingdao.aliyuncs.com/metersphere/zookeeper:3
[MeterSphere Log]: 启动服务
Removing network metersphere_ms-network
Network metersphere_ms-network not found.
Removing volume metersphere_ms-conf
Volume metersphere_ms-conf not found.
Removing volume metersphere_ms-logs
Volume metersphere_ms-logs not found.
Removing volume metersphere_ms-data
Volume metersphere_ms-data not found.
Removing volume metersphere_ms-mysql-data
Volume metersphere_ms-mysql-data not found.
Removing volume metersphere_ms-zookeeper-data
Volume metersphere_ms-zookeeper-data not found.
Removing volume metersphere_ms-kafka-data
Volume metersphere_ms-kafka-data not found.
Removing volume metersphere_ms-prometheus-data
Volume metersphere_ms-prometheus-data not found.
Removing volume metersphere_ms-prometheus-conf
Volume metersphere_ms-prometheus-conf not found.
Creating network "metersphere_ms-network" with driver "bridge"
Creating volume "metersphere_ms-conf" with default driver
Creating volume "metersphere_ms-logs" with default driver
Creating volume "metersphere_ms-data" with default driver
Creating volume "metersphere_ms-mysql-data" with default driver
Creating volume "metersphere_ms-zookeeper-data" with default driver
Creating volume "metersphere_ms-kafka-data" with default driver
Creating volume "metersphere_ms-prometheus-data" with default driver
Creating volume "metersphere_ms-prometheus-conf" with default driver
Creating zookeeper ... done
Creating mysql ... done
Creating ms-prometheus ... done
Creating ms-node-controller ... done
Creating kafka ... done
Creating nodeexporter ... done
Creating ms-server ... done
Creating ms-data-streaming ... done
Name Command State Ports
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
kafka /opt/bitnami/scripts/kafka ... Up (healthy) 0.0.0.0:19092->19092/tcp,:::19092->19092/tcp, 9092/tcp
ms-data-streaming /deployments/run-java.sh Up (health: starting)
ms-node-controller /deployments/run-java.sh Up (health: starting) 0.0.0.0:8082->8082/tcp,:::8082->8082/tcp, 0.0.0.0:9100->9100/tcp,:::9100->9100/tcp
ms-prometheus /bin/prometheus --config.f ... Up (healthy) 0.0.0.0:9090->9090/tcp,:::9090->9090/tcp
ms-server /deployments/run-java.sh Up (health: starting) 0.0.0.0:10000->10000/tcp,:::10000->10000/tcp, 0.0.0.0:10001->10001/tcp,:::10001->10001/tcp,
0.0.0.0:10002->10002/tcp,:::10002->10002/tcp, 0.0.0.0:10003->10003/tcp,:::10003->10003/tcp,
0.0.0.0:10004->10004/tcp,:::10004->10004/tcp, 0.0.0.0:10005->10005/tcp,:::10005->10005/tcp,
0.0.0.0:10006->10006/tcp,:::10006->10006/tcp, 0.0.0.0:10007->10007/tcp,:::10007->10007/tcp,
0.0.0.0:10008->10008/tcp,:::10008->10008/tcp, 0.0.0.0:10009->10009/tcp,:::10009->10009/tcp,
0.0.0.0:10010->10010/tcp,:::10010->10010/tcp, 0.0.0.0:8081->8081/tcp,:::8081->8081/tcp
mysql docker-entrypoint.sh mysqld Up (healthy) 0.0.0.0:3307->3306/tcp,:::3307->3306/tcp, 33060/tcp
nodeexporter /bin/node_exporter --path. ... Up (healthy)
zookeeper /opt/bitnami/scripts/zooke ... Up (healthy) 2181/tcp, 2888/tcp, 3888/tcp, 8080/tcp
======================= 安装完成 =======================
请通过以下方式访问:
URL: http://$LOCAL_IP:8081
用户名: admin
初始密码: metersphere
您可以使用命令 'msctl status' 检查服务运行情况.
安装完后,查看服务运行情况
[root@localhost metersphere]# sudo msctl status
Name Command State Ports
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
kafka /opt/bitnami/scripts/kafka ... Up (healthy) 0.0.0.0:19092->19092/tcp,:::19092->19092/tcp, 9092/tcp
ms-data-streaming /deployments/run-java.sh Up (healthy)
ms-node-controller /deployments/run-java.sh Up (healthy) 0.0.0.0:8082->8082/tcp,:::8082->8082/tcp, 0.0.0.0:9100->9100/tcp,:::9100->9100/tcp
ms-prometheus /bin/prometheus --config.f ... Up (healthy) 0.0.0.0:9090->9090/tcp,:::9090->9090/tcp
ms-server /deployments/run-java.sh Up (healthy) 0.0.0.0:10000->10000/tcp,:::10000->10000/tcp, 0.0.0.0:10001->10001/tcp,:::10001->10001/tcp,
0.0.0.0:10002->10002/tcp,:::10002->10002/tcp, 0.0.0.0:10003->10003/tcp,:::10003->10003/tcp,
0.0.0.0:10004->10004/tcp,:::10004->10004/tcp, 0.0.0.0:10005->10005/tcp,:::10005->10005/tcp,
0.0.0.0:10006->10006/tcp,:::10006->10006/tcp, 0.0.0.0:10007->10007/tcp,:::10007->10007/tcp,
0.0.0.0:10008->10008/tcp,:::10008->10008/tcp, 0.0.0.0:10009->10009/tcp,:::10009->10009/tcp,
0.0.0.0:10010->10010/tcp,:::10010->10010/tcp, 0.0.0.0:8081->8081/tcp,:::8081->8081/tcp
mysql docker-entrypoint.sh mysqld Up (healthy) 0.0.0.0:3307->3306/tcp,:::3307->3306/tcp, 33060/tcp
nodeexporter /bin/node_exporter --path. ... Up (healthy)
zookeeper /opt/bitnami/scripts/zooke ... Up (healthy) 2181/tcp, 2888/tcp, 3888/tcp, 8080/tcp
[root@localhost metersphere]# netstat -antlpe | grep 8081
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 0 282143 28166/docker-proxy
tcp6 0 0 :::8081 :::* LISTEN 0 282150 28171/docker-proxy
请通过以下方式访问:
URL: http://$LOCAL_IP:8081
(我这里用的是Linux的主机IP登录:http://192.168.182.128:8081/login)
使用ifconfig即可查到IP信息,[如果这里没显示IP,可以先执行:sudo dhclient ens33,再执行ifconfig]
ifconfig
[bonree@localhost ~]$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.182.128 netmask 255.255.255.0 broadcast 192.168.182.255
inet6 fe80::bccc:a8a0:6dd9:6969 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:ea:bc:d4 txqueuelen 1000 (Ethernet)
RX packets 2473629 bytes 3524726711 (3.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 352058 bytes 45140138 (43.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
用户名: admin
初始密码: metersphere
systemctl restart docker
重启msctl
msctl reload
重启成功后显示如下
[root@localhost metersphere-offline-installer-v1.15.4]# systemctl restart docker
[root@localhost metersphere-offline-installer-v1.15.4]# msctl reload
Starting zookeeper ...
Starting zookeeper ... done
Starting mysql ...
Starting mysql ... done
Starting ms-node-controller ... done
Starting nodeexporter ... done
Starting ms-server ... done
Creating ms-data-streaming ... done
重启失败也不要急,可以再次尝试重启
[root@localhost br]# msctl reload
Starting zookeeper ...
Starting zookeeper ... done
Starting mysql ...
Starting mysql ... done
Starting ms-node-controller ... done
Starting nodeexporter ... done
Starting ms-server ... done
ERROR: for ms-data-streaming Container "18959f298f5f" is unhealthy.
ERROR: Encountered errors while bringing up the project.
[root@localhost br]# msctl reload
ms-node-controller is up-to-date
zookeeper is up-to-date
mysql is up-to-date
ms-prometheus is up-to-date
nodeexporter is up-to-date
kafka is up-to-date
ms-server is up-to-date
ms-data-streaming is up-to-date
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。