一、说明

我开始的目的是开发前端,但是我们需要后端,所以我先安装一个后端项目作为我们开发的测试环境,选择可能是ruoyi-vue-pro,我们先安装环境,我的目的是直接在centos上编译,部署,后端不需要开发,所以就不要eclipse 什么的了

二、jdk 安装

下载jdk-8u381-linux-x64.rpm

安装rpm -ivh jdk-8u381-linux-x64.rpm

[root@localhost tools]# java -version
java version "1.8.0_381"
Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)
 

三、Maven安装 

tar -zxvf apache-maven-3.6.1-bin.tar.gz

配置环境变量

vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0-x64
MAVEN_HOME=/home/tools/apache-maven-3.9.6
PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
#wq!保存退出,并更新
source /etc/profile

[root@localhost apache-maven-3.9.6]# mvn -version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /home/tools/apache-maven-3.9.6
Java version: 1.8.0_381, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-1.8-oracle-x64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.71.1.el7.x86_64", arch: "amd64", family: "unix"
 

四、安装Nginx

Index of /download/ (nginx.org)icon-default.png?t=N7T8http://nginx.org/download/

 1、安装依赖

yum install -y  pcre pcre-devel zlib zlib-devel openssl openssl-devel

yum -y install gcc gcc-c++ autoconf automake make

 2、解压

tar -zxvf nginx-1.25.4.tar.gz

 3、编译安装

cd nginx-1.25.4
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install

4、启动

/usr/local/nginx/sbin/nginx

5、测试

打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功

6、具体需要部署时再配置

 五、mysql安装

1、先查看是否有mysql被安装 我是新装的机器,肯定没有

yum list installed | grep mysql
如果有,就先全部卸载,命令如下:
 yum -y remove mysql-community-client.x86_64
rpm -qa | grep -i mysql
find / -name mysql
rm -rf /var/lib/mysql /usr/share/mysql /usr/lib64/mysql /usr/bin/mysql /etc/logrotate.d/mysql /etc/selinux/targeted/active/modules/100/mysql /var/lib/mysql/mysql

2、卸载mariadb

sudo yum remove mariadb mariadb-server

3、MySQL官方的Yum Repository:

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

4、添加MySQL Yum Repository到你的系统

sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm 

5、软件包的公钥

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 

6、安装MySQL服务器:

 sudo yum install mysql-community-server

7、启动MySQL服务:

 sudo systemctl start mysqld

8、查找临时生成的root密码

sudo grep 'temporary password' /var/log/mysqld.log 

sudo grep 'temporary password' /var/log/mysqld.log
2024-04-03T04:05:06.872432Z 1 [Note] A temporary password is generated for root@localhost: pE1Et?t766?t

 

9、安全设置MySQL(包括设置root密码等):

sudo mysql_secure_installation

10、自启MySQL服务 

 sudo systemctl enable mysqld

六、git 安装

rpm -qa|grep git

rpm -e --nodeps git

yum install git

七、redis安装

1、下载

wget http://download.redis.io/releases/redis-6.2.9.tar.gz

2、解压

tar -zxvf redis-6.2.9.tar.gz

3、安装

cd redis-6.2.9

make install PREFIX=/usr/local/redis

 4、修改配置

cd  redis-6.2.9

cp /home/tools/redis-6.2.9/redis.conf /usr/local/redis/bin/
cd /usr/local/redis/bin/
vi redis.conf
将 daemonize no 改成  daemonize yes

5、启动

cd /usr/local/redis/bin/

./redis-server redis.conf

6、测试

 redis-cli -h localhost -p 6379
set my '123'

get my 显示123

7、开机自启动

先杀死redis进程,要不有可能会出错,不知道原因

[root@localhost ~]# ps -ef |grep redis
root       940     1  0 11:35 ?        00:00:01 /usr/local/redis/bin/redis-server 127.0.0.1:6379
root      2280  2105  0 11:50 pts/0    00:00:00 grep --color=auto redis
[root@localhost ~]# kill -9 940

cd /lib/systemd/system/

创建redis.service文件

vi redis.service

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target

设置开机自启动

systemctl enable redis.service

systemctl start redis.service

# 查看服务状态
systemctl status redis.service
# 停止服务
systemctl stop redis.service
# 取消开机自动启动(卸载服务)
systemctl disabled redis.service
 

Logo

快速构建 Web 应用程序

更多推荐