计划之后将centos-8作为平时的开发环境,记录一下安装过程。
关闭防火墙
我发现centos-8自带的防火墙影响了我对本机程序的telnet,所以需要关闭.
1 2
| systemctl stop firewalld systemctl disable firewalld
|
更新软件包
1 2 3 4 5 6 7
| dnf upgrade
dnf install -y epel-release dnf install -y vim telnet tmux dnf install -y wget iftop htop net-tools bind-utils tcpdump
|
安装docker
在安装docker时发现containerd.io版本过低导致报错,所以需要安装新版containerd.io
1 2 3 4 5 6 7 8 9 10
| dnf config-manager \ --add-repo \ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm dnf install docker-ce systemctl enable docker systemctl start docker
|
更换docker仓库地址
1 2 3 4 5 6 7 8
| mkdir -p /etc/docker cat << EOF > /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } EOF systemctl restart docker
|
将普通用户加入docker组
为了避免普通用户运行docker时需要sudo,所以将其加入到docker组中
1 2 3
| sudo gpasswd -a ${USER} docker
|
安装docker版mysql
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| docker run \ --name mysql \ -d \ -e MYSQL_ROOT_PASSWORD=123456 \ mysql docker cp mysql:/var/lib/mysql /var/lib/mysql docker cp mysql:/etc/mysql /etc/mysql docker stop mysql docker rm mysql docker run \ --name mysql \ --restart=always \ -d \ -p 3306:3306 \ --user root \ -v /etc/mysql:/etc/mysql \ -v /var/lib/mysql:/var/lib/mysql \ mysql
|
安装docker版grafana
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| docker run \ --name=grafana \ -d \ grafana/grafana
mkdir -p /app/grafana docker cp grafana:/etc/grafana /app/grafana/config docker cp grafana:/var/lib/grafana /app/grafana/data
docker stop grafana docker rm grafana
docker run \ --name=grafana \ --restart=always \ -d -p 3000:3000 \ --volume /app/grafana/config:/etc/grafana \ --volume /app/grafana/data:/var/lib/grafana \ --user root \ grafana/grafana
|
安装docker版prometheus
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| docker run \ --name=prometheus \ -d \ prom/prometheus
mkdir -p /app/prometheus/config docker cp prometheus:/etc/prometheus/prometheus.yml /app/prometheus/config docker cp prometheus:/prometheus /app/prometheus/data
docker stop prometheus docker rm prometheus
docker run \ --name=prometheus \ --restart=always \ -d -p 9090:9090 \ --volume /app/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml \ --volume /app/prometheus/data:/prometheus \ --user root \ prom/prometheus
|
安装docker版postgres
1 2 3 4 5 6 7 8
| docker run -d \ --name postgres-13 \ --restart always \ --user root \ --net host \ -e POSTGRES_PASSWORD=密码 \ -v /home/souhup/app/postgres-13/data:/var/lib/postgresql/data \ postgres:13
|