work note

Scroll Down

一.docker安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl enable docker
#配置加速
mkdir /etc/docker
#这条命令可以修改docker的工作目录 echo '{"registry-mirrors":["https://hub-mirror.c.163.com/"],"data-root":"/data/docker"}' > /etc/docker/daemon.json
echo '{"registry-mirrors":["https://hub-mirror.c.163.com/"]}' > /etc/docker/daemon.json
systemctl start docker
#或者
systemctl restart docker

#创建并move到挂载磁盘路径
mkdir /data/docker
mv /var/lib/docker /data/docker

二.MySQL安装
mkdir -p /data/mysql/lib
mkdir -p /data/mysql/conf

#mysql5.7
docker run --name mysql --restart=always -p3306:3306 -v /data/mysql/lib:/var/lib/mysql -v /data/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=Sunsea@2021
-e TZ=Asia/Shanghai
-d mysql:5.7

#mysq8.0
docker run --name mysql --restart=always -p3306:3306 -v /data/mysql/lib:/var/lib/mysql -v /data/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=Sunsea@2021
-e TZ=Asia/Shanghai
-d mysql:8.0.24

#导出数据库
docker exec mysql sh -c 'exec mysqldump --all-databases -uroot -p"Sunsea@2021"' > /some/path/on/your/host/all-databases.sql
#恢复数据库
docker exec -i mysql sh -c 'exec mysql -uroot -p"Sunsea@2021"' < /some/path/on/your/host/all-databases.sql

三.Redis安装
mkdir -p /data/redis

docker run --name redis --restart=always -p 6379:6379 -v /data/redis:/data -d redis:5.0.4 --appendonly yes --requirepass homewell

四.Mongodb安装
mkdir -p /data/mongodb

docker run -d --name mongodb
--restart=always
-p 27017:27017
-v /data/mongodb:/data/db
-e MONGO_INITDB_ROOT_USERNAME=root
-e MONGO_INITDB_ROOT_PASSWORD=Sunsea@2021
mongo:4.0

#需要注意这是超级管理员用户和密码,需要用上述密码连接客户端然后 创建新的库和用户名密码

#进入容器
docker exec -it mongodb /bin/bash
#进入客户端
mongo

use admin
db.auth("root","Sunsea@2021")

use sunsea_warehouse
db.createUser({user: "root", pwd: "Sunsea@2021", roles: [{ role: "dbOwner", db: "sunsea_warehouse" }]})
db.auth("root","Sunsea@2021")

五.fastdfs安装
#提供的环境变量ENV FASTDFS_PATH=/opt/fdfs FASTDFS_BASE_PATH=/var/fdfs PORT= GROUP_NAME= TRACKER_SERVER=

mkdir -p /data/dfs/tracker
mkdir -p /data/dfs/storage

docker run -dti --network=host --restart=always --name tracker -v /data/dfs/tracker:/var/fdfs -v /etc/localtime:/etc/localtime delron/fastdfs tracker

docker run -dti --network=host --restart=always --name storage -e TRACKER_SERVER=192.168.1.150:22122 -v /data/dfs/storage:/var/fdfs -v /etc/localtime:/etc/localtime delron/fastdfs storage

六.zookeeper安装
docker run --name zookeeper --restart=always -d -p2181:2181 zookeeper:3.4.14

七.dubbo-admin安装
docker run --name dubbo-admin -d
-p 8080:8080
-e dubbo.registry.address=zookeeper://192.168.0.190:2181
-e dubbo.admin.root.password=root
-e dubbo.admin.guest.password=Sunsea@2021
chenchuxin/dubbo-admin

八.jenkins安装
mkdir -p /data/jenkins

docker run --name jenkins --restart=always --privileged=true -u root -d -p 9999:8080 -p 50000:50000 -v /data/jenkins:/var/jenkins_home -v /etc/localtime:/etc/localtime -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean:1.24.6 --prefix=/jenkins

docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword #查看初始密码
admin Sunsea@2021

修改maven私服位置 /data/jenkins/tools/xxxxxmaven/conf/setting.xml
docker restart jenkins