麒麟操作系统安装中间件

麒麟操作系统安装中间件

安装 Docker (二进制安装 20.10.21版本)

# 安装c++ 编译依赖
yum install -y gcc gcc-c++ 
1263720 * 2 + 2

2527442

1263720 * 2 
# 下载 包
wget -c https://download.docker.com/linux/static/stable/x86_64/docker-20.10.21.tgz

# 解压
tar -zxvf docker-20.10.21.tgz

# 改变权限  如果是root 用户就不需要
chown root:root docker/*

# 复制到/usr/bin/目录  当然也可以自己配置环境变量
cp -p docker/* /usr/bin/

# 创建用户组
groupadd docker

# 编写相关服务配置文件docker.service 、docker.socket、 containerd.service
# vi docker.service


[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=65535
LimitNPROC=65535
LimitCORE=65535
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

# vi docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target

# vi containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target


# cp到/etc/systemd/system下面
sudo cp docker.socket /etc/systemd/system
sudo cp docker.service /etc/systemd/system
sudo cp containerd.service /etc/systemd/system

#  设置可执行权限
chmod a+x /etc/systemd/system/docker.service
chmod a+x /etc/systemd/system/docker.socket
chmod a+x /etc/systemd/system/containerd.service

# 启动服务
systemctl start docker.service

# 设置开机自启动
systemctl enable docker.service

安装 Redis (二进制 6.2.12)

# 下载对应的软件包
tar -zxvf  redis-6.2.12.tar.gz

# 进入
cd redis-6.2.12

# 编译 
make MALLOC=libc PREFIX=/usr/local/redis-6.2.12 install

# 添加环境变量
vi /etc/profile

export REDIS_PATH=/usr/local/redis-6.2.12
export PATH=${PATH}:${REDIS_PATH}/bin

# 执行
source /etc/profile

# 编写redis.conf
vi /etc/reids/redis.conf

# 开启持久化存储
appendonly yes
# 后台运行
daemonize yes
port 6379
# bind 127.0.0.1
# 为了禁止外网访问redis 默认是true
protected-mode no

# 编写 启动服务 
vi /usr/lib/systemd/system/redis.service

[Unit]
Description=Redis
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
#  改成自己redis 安装的目录
ExecStart=/usr/local/redis-6.2.12/bin/redis-server /etc/redis/redis.conf   
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

# 重新加载配置文件
systemctl daemon-reload  
# 启动 redis
systemctl start redis

# 设置开启自启动
systemctl enable redis

安装 Nacos (1.4.7)

1. 安装 jdk (8)

# 下载 jdk 自行百度
 
# 解压
tar -zxvf jdk-8u361-linux-x64.tar.gz 

# 创建文件夹
mkdir -p /usr/local/java

# 移动目录
mv jdk1.8.0_361 /usr/local/java

# 配置环境变量
export JAVA_HOME=/usr/local/java/jdk1.8.0_361
export PATH=${PATH}:${JAVA_HOME}/bin

# 启用
source /etc/profile

# 验证
java -version


java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)

2. 安装 Nacos

# 下载 nacos 二进制包
wget https://github.com/alibaba/nacos/releases/download/1.4.7/nacos-server-1.4.7.tar.gz

# 解压
tar -zxvf nacos-server-1.4.7.tar.gz

# 修改配置文件
cd nacos/conf
vi application.properties
# 修改数据库连接地址  用户名 和 密码

# 导入数据库脚本 注意数据库名称必须是 nacos_config
# 脚本就在 /nacos/conf/nacos-mysql.sql 导入到mysql中

# 导入完成 配置mysql地址信息修改完成 启动服务
cd nacos/bin 
./startup.sh


安装 nginx (1.14.2)

# 这些安装包是在你离线没有网络的情况下安装的
pcre-8.37.tar.gz          rewrite正则相关pcre:URL重写软件,实现伪静态\URL跳转等、SEO优化。

openssl-1.0.1t.tar.gz     https加密访问用它

zlib-1.2.8.tar.gz         提供数据压缩用

nginx-1.14.2.tar.gz

链接:https://pan.baidu.com/s/19IlP0m0UG1_iv6mobcaNwg 
提取码:w3sk 
Nginx 安装包 需要自行下载
#### 下载完成自行解压




## 上面操作做了可以不做下面的操作
# 下载pcre
wget http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz

# 解压
tar -zxvf pcre-8.37.tar.gz

# 编译安装
cd pcre-8.37
./configure
make install # 如果没有make 则 yum install -y make
# 检测是否安装成功
pcre-config --version

# 下载 openssl
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1t/openssl-1.1.1t.tar.gz

# 解压
tar -zxvf openssl-1.1.1t.tar

# 编译安装
./config
make install # 如果没有make 则 yum install -y make

# 安装zlib
yum -y install zlib zlib-devel libtool


# 安装nginx二进制包
wget http://nginx.org/download/nginx-1.14.2.tar.gz

# 解压
tar -zxvf nginx-1.14.2.tar.gz

# 编译安装
./configure --with-http_stub_status_module --with-http_ssl_module  --with-pcre 
make install


# 配置环境变量
vi /ect/profile

export NGINX_HOME=/usr/local/nginx
export PATH="${NGINX_HOME}/sbin:$PATH"

source /ect/profile

# 编写 nginx启动服务
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/bin/rm -f /usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true

[Install]
WantedBy=multi-user.target

# 增加可执行权限
chmod a+x  /usr/lib/systemd/system/nginx.service 

# 启动
systemcl start nginx

安装 MinIO

# 下载文件
wget https://dl.min.io/server/minio/release/linux-amd64/minio

# 增加可执行权限
chmod +x minio

# 移动
mv minio /usr/local/bin/


# 创建服务
vi /usr/lib/systemd/system/minio.service
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio

[Service]
WorkingDirectory=/usr/local

User=root
Group=root
ProtectProc=invisible

EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES

# MinIO发布.2023-05-04T21-44-30Z增加了对Type=notify的支持(https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# 这可能会改进其他服务使用`After=minio.server的systemctl设置`
# 取消注释行以启用功能
# Type=notify

# 让systemd始终重新启动此服务
Restart=always

# 指定此进程可以打开的最大文件描述符编号
LimitNOFILE=65536

# 指定此进程可以创建的最大线程数
TasksMax=infinity

# 禁用超时逻辑并等待进程停止
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})

# ps 默认情况下,该minio.service文件作为minio-user用户和组运行
# groupadd -r minio-user   创建一个用户组
# useradd -M -r -g minio-user minio-user  创建一个名为"minio-user"的系统用户,并将其添加到名为"minio-user"的用户组
# chown minio-user:minio-user /mnt/disk1 /mnt/disk2 /mnt/disk3 /mnt/disk4 更改指定目录 所有者和所属组都设置为"minio-user"

# 创建一个环境变量文件
vi /etc/default/minio

# MINIO_ROOT_USER和MINIO_ROT_PASSWORD设置MINIO服务器的根帐户。
# 此用户具有对部署中的任何资源执行S3和管理API操作的不受限制的权限。
# 省略使用默认值“minioadmin:minioadmin”。
# MinIO建议将非默认值设置为最佳做法,无论环境如何

MINIO_ROOT_USER=dongdong  # 用户名
MINIO_ROOT_PASSWORD=dongdong  # 密码
 
# MINIO_VOLUMES设置要用于MINIO服务器的存储卷或路径.

MINIO_VOLUMES="/data/minio"

#MINIO_OPS设置要传递到MINIO服务器的任何其他命令行选项。
#例如,“--console address:9001”设置MinIO控制台侦听端口
MINIO_OPTS="--console-address :9001"

#MINIO_SERVER_URL设置与MINIO服务器一起使用的本地计算机的主机名
#MinIO假设您的网络控制平面可以正确地将此主机名解析为本地计算机

#取消注释以下行,并将该值替换为本地计算机的正确主机名和MinIO服务器的端口(默认为9000)。

#MINIO_SERVER_URL="http://minio.example.net:9000"


# 启动服务
systemctl start minio
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值