Linux上搭建meterSphere
镜像下载、域名解析、时间同步请点击 阿里云开源镜像站
一、安装Docker
(1)安装CentOS 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/
================================================================================
(2)安装 Docker Engine-Community
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!
(3)启动并检查docker状态
sudo systemctl start docker
sudo systemctl status docker
[root@localhost base]# sudo systemctl start docker
[root@localhost base]# 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; 19min ago
Docs: https://docs.docker.com
Main PID: 97399 (dockerd)
Tasks: 0
Memory: 58.8M
CGroup: /system.slice/docker.service
├─97399 /usr/bin/dockerd
└─97412 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
Jan 05 17:00:23 localhost.localdomain dockerd[97399]: time="2022-01-05T17:00:23.218537488+08:00" level=info msg="Attempting next endpoint for pull after error: Head \"https:/...ke timeout"
Jan 05 17:00:23 localhost.localdomain dockerd[97399]: time="2022-01-05T17:00:23.221555539+08:00" level=error msg="Handler for POST /v1.41/images/create returned error: Head \...ke timeout"
Jan 05 17:01:10 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:10.059479965+08:00" level=info msg="starting signal loop" namespace=moby path=/run/docker/contain...d pid=98227
Jan 05 17:01:10 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:10.357324081+08:00" level=info msg="ignoring event" container=8149b29cadca1403bfe1df665f4a608bb01...TaskDelete"
Jan 05 17:01:10 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:10.359788730+08:00" level=info msg="shim disconnected" id=8149b29cadca1403bfe1df665f4a608bb0197e7...3141c638efd
Jan 05 17:01:10 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:10.359881885+08:00" level=error msg="copy shim log" error="read /proc/self/fd/14: file already closed"
Jan 05 17:01:17 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:17.341227632+08:00" level=info msg="starting signal loop" namespace=moby path=/run/docker/contain...1 pid=98362
Jan 05 17:01:17 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:17.593448271+08:00" level=info msg="ignoring event" container=9a183ecff69e89963aa86351f53bb9d51d5...TaskDelete"
Jan 05 17:01:17 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:17.594207060+08:00" level=info msg="shim disconnected" id=9a183ecff69e89963aa86351f53bb9d51d5ca53...1fd409b3e11
Jan 05 17:01:17 localhost.localdomain dockerd[97399]: time="2022-01-05T17:01:17.594300540+08:00" level=error msg="copy shim log" error="read /proc/self/fd/14: file already closed"
Hint: Some lines were ellipsized, use -l to show in full.
二、安装metersphere
(1)离线安装metersphere
tail -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' 检查服务运行情况.
(2)检查服务运行情况
sudo msctl status
[root@localhost metersphere-offline-installer-v1.15.4]# 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 (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
[root@localhost metersphere-offline-installer-v1.15.4]# 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
三、访问刚刚搭建的meterSphere
请通过以下方式访问:
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
本文转自:https://blog.csdn.net/weixin_45072910/article/details/122329016