服务器常用中间件安装

JDK

cd /usr/local

yum install -y lrzsz

1,上传jdk-8u333-linux-x64.tar.gz
2,tar zxf jdk-8u333-linux-x64.tar.gz

mv jdk1.8.0_333 /usr/local/jdk8

4,环境变量

vi /etc/profile

最下面插入:
export JAVA_HOME=/usr/local/jdk8
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

验证:java -version
java version "1.8.0_333"
maven
cd /usr/local

1, wget https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz --no-check-certificate
2, tar zxf apache-maven-3.8.5-bin.tar.gz
3, mv apache-maven-3.8.5 maven


4,环境变量

vi /etc/profile

最下面插入:
export M2_HOME=/usr/local/maven
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin

source /etc/profile

验证:mvn -v

docker

yum remove docker
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo

yum install docker-ce -y

6.设置开机自启
systemctl enable docker
systemctl daemon-reload

7.启动docker

systemctl start docker
8.查看docker信息
docker info
docker容器安装mq
docker pull rabbitmq

mkdir -p /data/rabbitmq/data

docker run -d --restart=always --name rabbitmq -p 5672:5672 -p 25672:25672  -v /data/rabbitmq/data:/var/lib/rabbitmq --hostname myRabbit  -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=at#20220520  -d rabbitmq

docker ps -a

查看mq启动参数 runlike -p rabbitmq

docker ps -a查看部署的mq容器id (192742497b16)
docker exec -it 容器id /bin/bash 进入容器内部在

docker exec -it  192742497b16 /bin/bash
rabbitmq-plugins enable rabbitmq_management

现在可以通过访问http://localhost:15672,访问web界面,这里的用户名和密码默认都是91pay

如果报错:
Error response from daemon: driver failed programming external connectivity on endpoint rabbitmq (c272d325a2dc616bbc46ed9b65baa3ca752465d16406e75f7c4abf93bef8c8c7):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 36845 -j DNAT --to-destination 172.17.0.2:36845 ! -i docker0: iptables: No chain/target/match by that name.
重启docker:
systemctl restart docker

宿主机的网络设置,比如关闭了防火墙,就要重启docker


rabbitmqctl add_user admin at#20220520
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_user_tags admin  administrator

rabbitmqctl add_user mhlevel mhlevel  #添加用户,后面两个参数分别是用户名和密码
rabbitmqctl set_permissions -p / mhlevel ".*" ".*" ".*"  #添加权限
rabbitmqctl set_user_tags mhlevel administrator #修改用户角色
docker容器安装consul 和 nacos
mkdir -p /data/consul/conf
mkdir -p /data/consul/data

docker pull consul


docker run --restart=always --name consul -p 8599:8500 -v /data/consul/conf/:/consul/conf/ -v /data/consul/data/:/consul/data/ --hostname consul  -d  consul  agent -server -bootstrap-expect=1 -ui -client=0.0.0.0

查看日志 docker logs e1707b2e2ba8



NACOS:

docker run --restart=always -d -p 8848:8848 --env MODE=standalone  --name nacos nacos-server:2.0.3
docker容器安装redis
13697
mkdir -p /data/redis/conf
mkdir -p /data/redis/data
mkdir -p /data/redis/logs

echo 1 > /proc/sys/vm/overcommit_memory

docker run --restart=always -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -v /data/redis/data:/data -d --name redis -p 13697:6379 redis:latest  redis-server /etc/redis/redis.conf




docker run --restart=always  -p 13697:6379 --name redis -v /data/redis/logs:/opt/redis.log -v /data/redis/data:/data -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf


密码:at#20220520

查看日志
docker logs redis


重启redis容器
docker restart redis
docker容器安装mongodb
27017
mkdir -p /data/mongodb/backup
mkdir -p /data/mongodb/data
mkdir -p /data/mongodb/conf
mkdir -p /data/mongodb/logs

docker pull mongo:latest


docker run --name mongo --restart=always -p 27017:27017  -v /data/mongodb/data:/data/db -v /data/mongodb/backup:/data/backup -v /data/mongodb/logs:/data/log -v /data/mongodb/conf:/data/conf -d mongo


docker exec -it  367fd9c690c4 /bin/bash

use admin

db.createUser({user:'admin', pwd:'at#20220520', roles:[{role:'root', db:'admin'}]})

db.createUser({user:'admin', pwd:'123456', roles:[{role:'root', db:'admin'}]})

发表评论

邮箱地址不会被公开。