Installation and deployment of DeviceHive under CentOS

1. Install Docker

Official document

  1. Uninstall the old version
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2. Required installation package

yum install -y yum-utils

3. Set up mirrored warehouse

# 默认是国外的
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo  

# 推荐使用阿里云的
sudo yum-config-manager \
    --add-repo \
	http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

4. Update yum package index

yum makecache fast

5. Install docker related engine

yum install docker-ce docker-ce-cli containerd.io

6. Start docker

[root@localhost /]# systemctl start docker

7. Use docker version to test whether the installation is successful

[root@localhost /]# docker version
Client: Docker Engine - Community
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:17:48 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:16:13 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

8. Run hello-world for testing (can be omitted)

[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

9.Docker replaces domestic mirrors

sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
    
    
  "registry-mirrors": ["https://lj1g9tkb.mirror.aliyuncs.com"]
}
EOF

sudo systemctl daemon-reload

sudo systemctl restart docker

2. Install DockerCompose

1. Run the following command to download the current stable version of Docker Compose:

# 官网命令
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# 推荐命令
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

2. Apply executable permissions to binary files:

chmod +x /usr/local/bin/docker-compose

Note: If the command docker-compose fails after installation, please check your path. You can also create a symbolic link to /usr/bin or any other directory in the path.

E.g;

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

3. Test the installation.

 docker-compose --version

3. DeviceHive deployment

  1. Clone devicehive-docker from github to local
git clone https://github.com/devicehive/devicehive-docker
  1. Switch to the folder
cd devicehive-docker/rdbms-image/
  1. Run the installation successfully and generate the corresponding container
sudo docker-compose up -d

Insert picture description here
4. Browser Test

# 在浏览器输入http://你的IP地址/admin/
Login:dhadmin
password:dhadmin_#911

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_37955704/article/details/112648958