一、安装 JDK

官网下载地址:https://www.oracle.com/java/technologies/downloads

# 创建目录
mkdir /usr/local/java/

# 解压
tar -zxvf jdk-8u333-linux-x64.tar.gz -C /usr/local/java/

# 配置环境变量
vim /etc/profile
 
export export JAVA_HOME=/usr/local/java/jdk1.8.0_211
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

# 环境变量生效
source /etc/profile

# 添加软连接
ln -sf /usr/local/java/jdk1.8.0_211/bin/java /usr/bin/java

# 检查版本
java -version

二、安装 Maven

# 下载
wget https://archive.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz

# 创建目录
mkdir /usr/local/maven/

# 解压
tar -zxvf apache-maven-3.5.4-bin.tar.gz -C /usr/local/maven/

# 配置环境变量
vim /etc/profile
 
export MAVEN_HOME=/usr/local/maven/apache-maven-3.5.4
export PATH=${PATH}:${MAVEN_HOME}/bin

# 环境变量生效
source /etc/profile

# 检查版本
mvn -v

三、安装 Git 

通过源码编译安装,下载地址:https://github.com/git/git/tags

# 下载
wget ttps://github.com/git/git/archive/refs/tags/v2.44.0.tar.gz

# 创建目录
mkdir /usr/local/git/

# 安装依赖
yum install curl-devel expat-devel openssl-devel zlib-devel gcc-c++ 
yum install perl-ExtUtils-MakeMaker automake autoconf libtool make

# 解压
tar -zxvf git-2.44.0.tar.gz -C /usr/local/git/

# 编译安装
cd /usr/local/git/git-2.44.0

make prefix=/usr/local/git all
make profix=/usr/local/git install

# 配置环境变量
vim /etc/profile

export PATH="/usr/local/git/bin:$PATH"

# 环境变量生效
source /etc/profile

# 检查版本
git --version

# 卸载
yum remove git

四、安装 MySQL

1、MySQL5.7 安装

下载地址:https://www.mysql.com/downloads

# 创建 mysql 帐号
groupadd mysql
useradd -r -g mysql -s /bin/false mysql

# 创建目录
mkdir /usr/local/mysql/

# 解压
tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /usr/local/

# 解压后的文件移到创建mysql的安装目录下
mv mysql-5.7.21-linux-glibc2.12-x86_64/* /usr/local/mysql/

rm –rf mysql-5.7.21-linux-glibc2.12-x86_64

# 创建数据库保存位置
mkdir /usr/local/mysql/data/

# 设置 mysql 安装目录和数据库保存目录文件权限
chown -R mysql:mysql  /usr/local/mysql
chmod -R 750 /usr/local/mysql

# 初始化数据库,注意:记录好这个临时密码,第一次登录要用到
cd /usr/local/mysql/

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/

# 安装 SSL
cd /usr/local/mysql/

bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data/

# 修改系统配置参数
cp  mysql-log-rotate /etc/my.cnf
cp  mysql.server /etc/init.d/mysql

# 修改 /etc/init.d/mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/

# 修改 /etc/my.cnf , 添加如下配置
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/
socket=/tmp/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/usr/local/mysql/mysqld.pid
# 不区分大小写
lower_case_table_names = 1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
max_connections=5000
default-time_zone = '+8:00'

# 创建 /usr/local/mysql/mysqld.pid 文件:
touch /usr/local/mysql/mysqld.pid

# 创建连接
ln -s /usr/local/mysql/bin/mysql /usr/bin/
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/

# 启动
service mysql start

# 修改密码(输入初始化保存的密码),设置成功后输入 exit 退出
mysql -u root –p

set password=password('root');

# 设置开机启动
chkconfig --list mysql
chkconfig --add mysql
chkconfig mysql on

# 设置环境变量
vim ~/.bash_profile

export MYSQL_HOME=/usr/local/mysql/
export PATH=$MYSQL_HOME/bin:$PATH

# 环境变量生效
source ~/.bash_profile

2、MySQL8.0 安装

# 创建 mysql 帐号
groupadd mysql
useradd -g mysql mysql

# 下载
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.20-linux-glibc2.12-x86_64.tar.xzhttps://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
xz -d mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
tar xvf mysql-8.0.20-linux-glibc2.12-x86_64.tar -C /usr/local/

# 解压后的文件移到创建mysql的安装目录下
mv mysql-8.0.20-linux-glibc2.12-x86_64/* /usr/local/mysql/
rm –rf mysql-8.0.20-linux-glibc2.12-x86_64

# 创建数据库保存位置
mkdir /usr/local/mysql/data/

# 设置 mysql 安装目录和数据库保存目录文件权限
chown -R mysql:mysql  /usr/local/mysql
chmod -R 750 /usr/local/mysql

# 修改 /etc/my.cnf , 添加如下配置:
[mysqld]
user=root
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
port=3306
max_connections=200
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
lower_case_table_names=1
group_concat_max_len=102400
[mysql]
default-character-set=utf8
[client]
port=3306
default-character-set=utf8

# 初始化基础信息,最后一行后面会有个随机的初始密码保存下来一会登录要用(如果忘记了就删掉data重新初始化)
cd /usr/local/mysql/bin
./mysqld --initialize

# 如果提示: ./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
# 就执行下下面这个再执行初始化
yum install -y libaio
yum -y install numactl

./mysqld --initialize

# 添加mysqld服务到系统
cd /usr/local/mysql
cp -a ./support-files/mysql.server /etc/init.d/mysql

# 授权以及添加服务
chmod +x /etc/init.d/mysql
chkconfig --add mysql

# 启动
service mysql start

# 将mysql添加到命令服务
ln -s /usr/local/mysql/bin/mysql /usr/bin

# 修改密码(输入刚刚初始化时生成的密码)
mysql -uroot -p

# 如果提示: mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
cd /usr/local/mysql/bin

ldd mysql
sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5

# 更改root用户密码, 注意语句后的; 执行语句忘记写了 可以补个空的;回车也可以将语句执行
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
mysql> flush privileges;

# 更改root连接权限(远程连接)
mysql> use mysql;
mysql> update user set host='%' where user = 'root';
mysql> flush privileges;
mysql> exit;

 五、安装 Nginx

# 安装 gcc、PCRE pcre-devel、zlib、Open SSL
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel

# 下载
wget http://nginx.org/download/nginx-1.23.0.tar.gz

# 创建文件夹
mkdir nginx

cd /usr/local/nginx

# 解压缩包
tar -xvf nginx-1.23.0.tar.gz

# 安装
cd /usr/local/nginx/nginx-1.23.0 

# 编译 执行命令 考虑到后续安装ssl证书 添加两个模块  如不需要直接执行./configure即可
./configure --with-http_stub_status_module --with-http_ssl_module

# 执行make命令(要是执行不成功请检查最开始安装的四个依赖有没有安装成功)
make

# 执行make install命令
make install

# 启动
cd /usr/local/nginx/sbin
./nginx

# 指定配置文件启动
./nginx -c  /usr/local/nginx/conf/nginx.conf

# 设置开机自启动
vim /etc/rc.local

/usr/local/nginx/sbin/nginx # 最底部增加这一行

# 配置 SSL 证书
# 先申请好证书,在/usr/local/nginx/conf/目录下创建文件夹 cert:
mkdir cert

# 修改 nginx.conf 文件
server {
    listen       443 ssl;
    server_name  www.tansci.com;

    # 证书配置
    ssl_certificate      cert/tansci.com_bundle.crt;
    ssl_certificate_key  cert/tansci.com.key;
    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;

    location / {
        root   /usr/web;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    # 静态文件代理
    location /static {
        root /usr/web;
        autoindex on;
    }

    # api 接口代理
    location /api/ {
        proxy_pass http://localhost:8080/;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST';
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
    }
}

六、安装 FTP 

# 检查是否安装 vsftpd
rpm -qa | grep vsftp

# 安装 vsftpd
yum -y install vsftpd # 如果报错,使用管理员权限执行 sudo yum -y install vsftpd

# 关闭匿名访问 (关闭匿名访问就是将:anonymous_enable=NO)
vim /etc/vsftpd/vsftpd.conf # 如果提示是只读文件,输入命令:sudo vim /etc/vsftpd/vsftpd.conf

# ========== 修改内容 ====start==============
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
# ========== 修改内容 ====end==============

# 启动服务
systemctl start vsftpd.service

# 查看服务状态
systemctl status vsftpd.service # 看到绿色的 active(running),代表着启动成功正在运行中

# 添加 FTP 用户设置密码 (因为在 Linux 上,root 用户是不能登陆 FTP 的。如果你输入的是 root 用户,登陆会失败的)
adduser ftpadmin
passwd ftpadmin # 输入两次密码就 ok 了

# 文件存储地址授权
chmod 777 /app/upload/

七、安装 Minio

# 创建目录
[root@t2 local]# mkdir minio
[root@t2 local]# cd minio
[root@t2 minio]# mkdir data

# 下载
[root@t2 minio]# wget https://dl.min.io/server/minio/release/linux-amd64/minio
[root@t2 minio]# chmod +x minio  # 赋权

# 设置账号密码(minio 默认账号密码为 minioadmin/minioadmin)
[root@t2 minio]# export MINIO_ACCESS_KEY=admin # 设置控制台账号(最少3位)
[root@t2 minio]# export MINIO_SECRET_KEY=12345678 # 设置密码(最少8位)

# 直接设置管理员账号密码 编辑 /etc/profile 文件即可
[root@t2 minio]# vim /etc/profile

# set minio environment
export MINIO_ROOT_USER=admin
export MINIO_ROOT_PASSWORD=admin123

# 启动(进入执行文件目录,自定义端口启动(默认端口:9000))
[root@t2 minio]# nohup /usr/local/minio/minio server --address :9001 --console-address :9002 /usr/local/minio/data >/usr/local/minio/minio.log 2>&1 &

# 设置开机自启动
[root@t2 minio]# cd /etc/rc.d/init.d
[root@t2 init.d]# vim minio.sh # 新建shell脚本文件

#!/bin/bash
#chkconfig: 2345 10 90
#description: ping10
nohup /usr/local/minio/minio server --address :9001 --console-address :9002 /usr/local/minio/data >/usr/local/minio/minio.log 2>&1 &
# 给shell脚本赋权
chmod +x minio.sh
# 添加到开机自启动服务中
chkconfig --add minio.sh
# 设置开机自启动
chkconfig minio.sh on
# 查看是否添加成功
chkconfig --list

八、安装 Redis

下载地址:https://download.redis.io/releases

# 下载
wget http://download.redis.io/releases/redis-6.0.8.tar.gz

# 解压
tar -zxvf redis-6.0.8.tar.gz

# 升级 gcc(redis-6.0 以上需将 gcc 升级至 9.0 以上)
gcc -v

# 升级
yum -y install centos-release-scl

yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

# scl命令启用只是临时的
scl enable devtoolset-9 bash

# 长期生效
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

# make && make install
make

# 修改 redis.conf 配置(远程连接)

daemonize yes # daemonize 修改为 no

bind 127.0.0.1 # 注掉 bind 127.0.0.1

protected-mode no # protected-mode yes 修改为 no

requirepass demo@202403  # 设置密码

# 启动
cd /usr/local/redis/src

./redis-server ../redis.conf

ps -ef | grep redis

九、安装 Elasticsearch

# 创建用户组名
groupadd elsearch  #【添加组】【用户组名】
useradd elsearch -g elsearch -p elsearch #【添加用户】【用户名】-g【用户组名】-p【密码值】

# 下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.2-linux-x86_64.tar.gz

# 解压
tar -zxvf elasticsearch-7.16.2-linux-x86_64.tar.gz

# 设置权限到elsearch用户
chown -R elsearch:elsearch /usr/local/elasticsearch-7.16.2

# 修改配置文件 elasticsearch.yml
cd /usr/local/elasticsearch-7.16.2/config

vim elasticsearch.yml
# ========== 修改内容 ====start==============
# 集群名称(按实际需要配置名称)
cluster.name: my-elasticsearch
# 节点名称
node.name: node-1
# 数据路径(按实际需要配置日志地址)
path.data: /usr/local/elasticsearch-7.16.2/data
# 日志路径(按实际需要配置日志地址)
path.logs: /usr/local/elasticsearch-7.16.2/logs
# 地址(通常使用内网进行配置)
network.host: 127.0.0.1
# 端口号
http.port: 19200
# 节点地址
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
# 集群master
cluster.initial_master_nodes: ["node-1"]
# 跨域(这两项配置手动添加一下)
http.cors.enabled: true 
http.cors.allow-origin: "*"
# ========== 修改内容 ====end==============

# 修改 Elasticsearch 启动脚本(修改 bin 目录下的elasticsearch文件)
vim bin/elasticsearch

# ========== 修改内容 =====start=============
# 配置jdk
export JAVA_HOME=JAVA_HOME=/usr/local/java/jdk1.8.0_211/
export PATH=$JAVA_HOME/bin:$PATH

# 添加jdk判断
if [ -x "$JAVA_HOME/bin/java" ]; then
   JAVA="/usr/local/java/jdk1.8.0_211/bin/java"
else
   JAVA=`which java`
fi
# ========== 修改内容 =====end=============

# 启动,切换到 elsearch 用户
su elsearch

# 后台方式启动
./elasticsearch -d 

# 查看日志,是否启动成功
cd /usr/local/elasticsearch-7.16.2/logs
tail -fn 100 /usr/local/elasticsearch-7.16.2/logs/my-elasticsearch.log

# 安装 Elasticsearch-head 插件
# 下载
wget https://github.com/mobz/elasticsearch-head/archive/master.zip

# 解压
unzip master.zip

# 安装 grunt
cd /usr/local/elasticsearch-head
npm install -g grunt-cli

# 修改所有域名访问,添加 hostname:“*”,进入elasticsearch-head目录
cd elasticsearch-head

# 修改Gruntfile.js
vim Gruntfile.js

# ========== 修改内容 =====start=============
connect: {
    server: {
        options: {
            hostname: '*',
            port: 9100,
            base: '.',
            keepalive: true
        }
    }
}
# ========== 修改内容 =====end=============

# 启动
# 下载依赖
npm install

# 启动
cnpm run start

# 后台启动
nohup ./grunt server >/dev/null 2>&1 &

十、安装 ActiveMQ

ActiveMQ 是依赖 jdk 的,如果没有安装,请先安装。

  • 服务配置文件 activemq.xml,按需修改即可;

  • 前端管理界面配置文件 jetty.xml,在此文件中可修改前端访问端口。

下载地址:https://activemq.apache.org/components/classic/download/

# 下载安装
[root@localhost  local]# wget https://archive.apache.org/dist/activemq/5.16.5/apache-activemq-5.16.5-bin.tar.gz
[root@localhost  local]# tar -zxvf apache-activemq-5.16.5-bin.tar.gz

# 启动activemq
[root@localhost bin]# ./activemq start   # 需在activemq的bin目录执行

# 查看状态
[root@localhost bin]# ./activemq status

# 重启activemq
[root@localhost bin]# ./activemq restart  

# 停止activemq
[root@localhost bin]# ./activemq stop

# 更改admin密码及创建用户
[root@localhost bin]# vim ../conf/jetty-realm.properties

# Defines users thatcan access# userame: password,rolename
# username: password [,rolename ...]
admin: 1QAZxsw2#eDC, admin
user: user, user

# 添加开机启动
# 进入MQ的bin目录,复制activemq到/etc/init.d目录下面
[root@localhost bin]# cp activemq /etc/init.d/

# 进入系统初始化目录
[root@localhost bin]# cd /etc/init.d/activemq

# 编辑/etc/init.d/activemq文件
[root@localhost bin]# vim /etc/init.d/activemq
export JAVA_HOME=/usr/local/jdk1.8.0_144
export ACTIVEMQ_HOME=/usr/local/apache-activemq-5.16.5/

# 将activemq添加至配置文件
[root@localhost local]# chkconfig --add activemq
[root@localhost local]# chkconfig --list 

 十一、安装 OpenCV

下载地址:https://github.com/opencv/opencv/releases

# 安装 cmake 和 opencv 的依赖
[root@localhost local]#  yum -y install gcc gcc-c++ gtk±devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm build-essential ant

# 安装cmake
# 下载
[root@localhost local]# wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
[root@localhost local]# tar xzvf cmake-3.3.2.tar.gz
[root@localhost local]# cd cmake-3.3.2
[root@localhost cmake-3.3.2]# ./bootstrap
[root@localhost cmake-3.3.2]# make install
[root@localhost cmake-3.3.2]# cmake --version  # 查看cmake版本

# 安装OpenCV
# 创建安装目录
[root@localhost local]# mkdir opencv_make
[root@localhost local]# cd opencv_make
[root@localhost opencv_make]# mkdir release

# 解压
[root@localhost opencv_make]# unzip opencv-4.1.1.zip
[root@localhost opencv_make]# cd opencv-4.1.1

# 创建编译目录
[root@localhost opencv-4.1.1]# mkdir build
[root@localhost build]# cd build

# 安装编译
[root@localhost build]# cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv_make/release -DBUILD_TESTS=OFF ..
[root@localhost build]# make -j8 & make

# 安装成功
[root@localhost build]# cd lib

# 编译时间比较长, 请耐心等待;编译中的警告可以忽略。
# 启动应用服务,如果报错 opencv_java411.so 找不到,将 /usr/local/opencv_make/build/lib/ 下的此文件复制到 /usr/lib/ 即可。

[root@localhost lib]# cp /usr/local/opencv_make/build/lib/opencv_java411.so /usr/lib/

十二、安装 Node

下载地址:https://registry.npmmirror.com/binary.html

# 下载
wget https://registry.npmmirror.com/-/binary/node/latest-v14.x/node-v14.18.2-linux-arm64.tar.gz

# 解压
tar -zxvf node-v14.18.2-linux-arm64.tar.gz
mv node-v14.18.2-linux-arm64 /usr/local/node

# 配置环境变量
vim /etc/profile

export PATH=$PATH:/usr/local/node/bin 

# 环境变量生效
source /etc/profile

# 查看版本
node -v

# 配置镜像加速

# 查看镜像配置
npm config get registry
# 设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
# 恢复初始镜像
npm configset registry https://registry.npmjs.org

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部