阿里云-安装docker、中间件

1、安装docker
安装参考:https://docs.docker.com/engine/install/centos/
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce docker-ce-cli containerd.io
systemctl start docker
docker ps

#进入容器
docker exec -it 容器名称 bash

 

2、设置国内镜像库
配置文件:vi /etc/docker/daemon.json
{
    "registry-mirrors": [
        "https://y8yh50dy.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
    ]
}
配置生效:systemctl restart docker

 

3、安装geoserver
官方参考:https://hub.docker.com/r/oscarfonts/geoserver
docker pull oscarfonts/geoserver
docker run -d -p 53001:8080 --name geoserver --restart=always -v /publish/geoserver/data_dir:/var/local/geoserver oscarfonts/geoserver
访问:http://IP:53001/geoserver
账号:admin/geoserver

 

4、安装portainer
官方参考:https://docs.portainer.io/start/install-ce/server/docker/linux
docker pull portainer/portainer-ce
docker run -d -p 52002:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /publish/portainer/portainer_data:/data portainer/portainer-ce
访问地址:https://IP:52002
账号:admin/a@1

 

5、安装nginx
docker pull nginx
docker run -dp 80:80 --name nginx nginx
mkdir -p /publish/nginx/conf/
docker cp nginx:/etc/nginx/nginx.conf /publish/nginx/conf/

修改配置文件:vi /publish/nginx/conf/nginx.conf
增加配置:
    server {
        listen 58001;

        location / {
            root /usr/share/nginx/cdp5/dist/;
            index index.html index.htm;
        }

        location /api {
            proxy_pass http://localhost:57001/;
        }
    }

运行docker
docker run -d --network host --name nginx --restart=always \
-v /publish/app/cdp5/dist:/usr/share/nginx/cdp5/dist \
-v /publish/nginx/conf/nginx.conf:/etc/nginx/nginx.conf nginx

拷贝静态文件到:/publish/app/cdp5/dist
访问:http://IP:58001

 

6、安装LibreSpeed
docker pull ghcr.io/linuxserver/librespeed

docker run -d \
--name=librespeed \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 52003:80 \
-v /publish/librespeed/config:/config \
ghcr.io/linuxserver/librespeed

 

7、安装mysql
sudo docker pull mysql:8.0

docker run \
-p 53306:3306 \
--name mysql8 \
-e MYSQL_ROOT_PASSWORD=Root@123 \
-e TZ=Asia/Shanghai \
-v /publish/mysql/config:/etc/mysql/conf.d \
-v /publish/mysql/data:/var/lib/mysql \
-v /publish/mysql/logs:/var/log/mysql \
-v /publish/mysql/temp:/temp \
--privileged=true \
--restart=always \
-d mysql:8.0 \
--lower_case_table_names=1

docker exec -it mysql8 bash
mysql -u root -p

create database testdb;
create user 'test'@'%' identified by '123456';
grant all privileges on testdb.* to 'test'@'%';
flush privileges;

posted @ 2024-06-27 23:03  vv_online  阅读(13)  评论(0编辑  收藏  举报