Step-by-Step Guide to Installing Docker, MySQL, and Apollo Services on CentOS
This tutorial provides detailed commands and configurations for installing a specific Docker version, setting up persistent MySQL containers, importing Apollo database scripts, and deploying Apollo Config, Admin, and Portal services using Docker on a CentOS host.
This article presents a comprehensive, command‑by‑command guide for installing a specific Docker version, preparing MySQL data directories, pulling MySQL and Apollo images, and configuring Apollo Config Service, Admin Service, and Portal Server on a CentOS machine.
Install Docker and required utilities:
yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum list docker-ce --showduplicates | sort -r yum -y install docker-ce-18.06.3.ce-3.el7 systemctl start dockerCreate MySQL data directories and set ownership:
mkdir /data/mysql/conf/ -pv mkdir /data/mysql/logs mkdir /data/mysql/mysql chown -R mysql.mysql /data/mysqlPull the MySQL image and run the container with volume mounts and root password:
docker pull mysql:8.0.19 docker run -d --name mysql8.0.19 --restart always -p3306:3306 \
-v /data/mysql/conf/my.cnf:/etc/mysql/my.cnf \
-v /data/mysql/logs:/logs \
-v /data/mysql/mysql:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
mysql:8.0.19Enter the MySQL container and import the Apollo SQL scripts:
docker exec -it 3b0fd3fcbae2 /bin/bash cd /var/lib/mysql mysql> source /var/lib/mysql/mysql/apolloportaldb.sql mysql> source /var/lib/mysql/mysql/apolloconfigdb.sqlPull and run the Apollo Config Service container with required environment variables:
docker pull apolloconfig/apollo-configservice docker run -d \
--name apollo-configservice \
--net=host \
-v /tmp/logs:/opt/logs \
-e SPRING_DATASOURCE_URL="jdbc:mysql://192.168.20.57:3306/ApolloConfigDB?characterEncoding=utf8" \
-e SPRING_DATASOURCE_USERNAME=root \
-e SPRING_DATASOURCE_PASSWORD=123456 \
apolloconfig/apollo-configservicePull and run the Apollo Admin Service container (using the same configuration as Config Service):
docker pull apolloconfig/apollo-adminservice docker run -d --name apollo-adminservice \
--net=host \
-v /tmp/logs:/opt/logs \
-e SPRING_DATASOURCE_URL="jdbc:mysql://192.168.20.57:3306/ApolloConfigDB?characterEncoding=utf8" \
-e SPRING_DATASOURCE_USERNAME=root \
-e SPRING_DATASOURCE_PASSWORD=123456 \
apolloconfig/apollo-configservicePull and run the Apollo Portal Server container with additional environment variables for portal configuration:
docker pull apolloconfig/apollo-portal docker run -d --name apollo-portal \
--net=host \
-v /tmp/logs:/opt/logs \
-e SPRING_DATASOURCE_URL="jdbc:mysql://192.168.20.57:3306/ApolloPortalDB?characterEncoding=utf8" \
-e SPRING_DATASOURCE_USERNAME=root \
-e SPRING_DATASOURCE_PASSWORD=123456 \
-e APOLLO_PORTAL_ENVS=dev \
-e DEV_META=http://192.168.20.57:8080 \
apolloconfig/apollo-portalVerify the services are running:
netstat -nltp docker ps -aImages illustrating the steps are included throughout the article.
End of tutorial.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
