环境
cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
cat /proc/cpuinfo # 查看CPU信息
Docker
安装Docker
yum -y install docker
Docker-compose
安装docker-compose
# 1. 下载文件 【国内镜像地址】
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.1/docker-compose-`uname -s`-`uname -m` > /usr/local/sbin/docker/docker-compose
# 2. 添加运行权限
chmod 777 /usr/local/sbin/docker/docker-compose
# 3. 配置环境变量
# ~/.bash_profile 添加 【此处省略,好像可以不添加】
# 4. 检查安装状态
docker-compose version
部署PgSQL&Adminer
- 拉取镜像
docker pull docker.io/adminer
docker pull docker.io/postgres
- 配置docker-compose.yml
version: '3'
services:
db:
container_name: postgres
image: postgres:latest
restart: always
environment:
POSTGRES_PASSWORD: ******
volumes:
- /data/pgsql/data:/var/lib/postgresql/data
ports:
- 5432:5432
adminer:
container_name: adminer
image: adminer
restart: always
ports:
- 8080:8080
- 启动 docker-compose
# 一、 当前路径与 Docker-Compose.yml 相同
docker-compose up -d # -d 后台运行
docker-compose down # 停止服务
# 二、 当前路径与 Docker-Compose.yml 不同
docker-compose -f /data/docker-compose.yml up -d # -f 可以指定多个配置文件
# docker-compose -f docker-compose-base.yml -f docker-compose-dev.yml config
docker-compose -f /data/docker-compose.yml down
- 配置Nginx
vim /usr/local/nginx/conf/nginx.conf
# http 下添加
include /data/nginx/conf.d/*.conf;
# 添加配置文件
vim /data/nginx/conf.d/adminer.conf
server{
listen 80;
server_name localhost;
error_log /data/nginx/logs/adminer.error.log;
access_log /data/nginx/logs/adminer.access.log;
location /adminer/ {
proxy_pass http://127.0.0.1:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html
{
root /html;
}
}
# 重启nginx
nginx -t
nginx -s reload
- 测试访问
http://ip/adminer/