jeecg 服务器详细部署实操(linux)

一.环境搭建

1.安装mysql

//参考的https://blog.csdn.net/wohiusdashi/article/details/89358071

//查看是否安装过mysql
rpm -qa | grep mysql
//下载yum repo配置文件
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
//进行repo的安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm

/**进入到 /etc/yum.repos.d/目录后执行以下脚本*/
//安装,期间输入Y
yum install mysql-server
//启动
systemctl start mysqld
//假如报错Failed to start mysqld.service: Unit not found.
yum install mysql-server --nogpgcheck
//获取临时密码
grep 'temporary password' /var/log/mysqld.log
//假如获取失败,下面语句,重新启动后重新获取临时密码
rm -rf /var/lib/mysql
//登录mysql
mysql -u root -p
//修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '设置的密码'; 
//开启远程控制
show databases;
use mysql;
show tables;
select Host, User from user;
update user set Host='%' where User='root';
flush privileges;
//查看版本
select version();
//退出
exit
//配置默认编码为utf8
vi /etc/my.cnf 
//摁i 添加 [mysqld] 
character_set_server=utf8 
init_connect='SET NAMES utf8'
//大小写不敏感 添加
lower_case_table_names=1
//退出 摁esc后输入:wq!

/**常用指令*/
//关闭mysql
systemctl stop mysqld 
//启动mysql
systemctl restart mysqld 
//查看mysql运行状态
systemctl status mysqld
//设置开机启动
systemctl enable mysqld 
//关闭开机启动
systemctl disable mysqld
//切忌关服务器前先停掉mysql,否则重启可能启动报错!!!

/**彻底删除mysql*/
rpm -qa | grep -i mysql
//查出的包挨个删
rpm -ev mysql-community-libs-5.7.27-1.el6.x86_64 --nodeps
//查文件
find / -name mysql
//查出的文件挨个删
rm -rf /var/lib/mysql
//查看是否全部删除
rpm -qa | grep -i mysql

2.安装redis

//参考https://www.cnblogs.com/zuidongfeng/p/8032505.html

//下载redis安装包
wget http://download.redis.io/releases/redis-4.0.6.tar.gz
//解压压缩包
tar -zxvf redis-4.0.6.tar.gz
//yum安装gcc依赖
yum install gcc
//跳转到解压目录下
cd redis-4.0.6
//编译安装
make MALLOC=libc
//将/usr/local/redis-4.0.6/src目录下的文件加到/usr/local/bin目录
cd src && make install

/**后台启动redis*/
//修改redis.conf,进入到解压目录下
vi redis.conf
//摁 i 将daemonize no改为yes
//摁 esc 输入:wq! 退出
//指定redis.conf 启动,redis.conf位置按自己的位置来
cd src
./redis-server /usr/local/redis-4.0.6/redis.conf 
//关闭redis
ps -aux | grep redis
kill 进程id
//进入etc新建redis目录
cd etc
mkdir redis
//将redis-4.0.6/redis.conf文件复制一份到/etc/redis目录下,并命名为6379.conf
cp /project/redis/redis-4.0.6/redis.conf /etc/redis/6379.conf
//将redis的启动脚本复制一份放到/etc/init.d目录下
cp /project/redis/redis-4.0.6/utils/redis_init_script /etc/init.d/redisd
//切换到/etc/init.d目录下
cd /etc/init.d
//执行
chkconfig redisd on
//提示服务 redisd 不支持 chkconfig
vim redisd
//第二行加入后重新操作
# chkconfig:   2345 90 10
# description:  Redis is a persistent key-value database
//服务方式启动
service redisd start 
//关闭
service redisd stop

3.安装nginx

//参考https://blog.csdn.net/qq_37345604/article/details/90034424

//查看gcc版本
gcc -v
//假如没有 安装gcc
yum -y install gcc
//pcre、pcre-devel安装
yum install -y pcre pcre-devel
//zlib安装
yum install -y zlib zlib-devel
//openssl安装
yum install -y openssl openssl-devel
//下载nginx
wget http://nginx.org/download/nginx-1.9.9.tar.gz  
//解压nginx
tar -zxvf  nginx-1.9.9.tar.gz
//进入解压目录
cd nginx-1.9.9/
//执行
./configure
make
make install
//修改配置文件nginx.conf 修改成自己的端口
nginx.conf在/usr/local/nginx/conf目录下才生效
//启动nginx,切换目录到/usr/local/nginx/sbin
cd /usr/local/nginx/sbin
./nginx
//重启nginx
./nginx -s reload
//查看nginx是否启动成功
ps -ef | grep nginx

nginx.conf 配置,注意conf的位置/usr/local/nginx/下的,html也是这个位置下的!不是解压包目录下的!

#user  nobody;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
	
	#gzip config
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 9;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
           root   html;
           index  index.html index.htm;
		   if (!-e $request_filename) {
				rewrite ^(.*)$ /index.html?s=$1 last;
				break;
			}
        }
		
		location ^~ /jeecg-boot {
			proxy_pass  http://服务器ip:8080/jeecg-boot/;
		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

4.安装jdk1.8

linux版下载地址
链接: https://pan.baidu.com/s/1Foxgvn_Khlu2htZm1wexgg?pwd=6eaa 提取码: 6eaa 复制这段内容后打开百度网盘手机App,操作更方便哦

//使用工具上传到服务器
//解压
tar -zxvf /project/jdk/jdk-8u144-linux-x64.tar.gz
//配置环境变量
vim /etc/profile.d/java.sh
//加入
export JAVA_HOME=/project/jdk/jdk1.8.0_11
export PATH=$PATH:$JAVA_HOME/bin
//更新profile文件
source /etc/profile
//查看是否配置成功
解压目录下输入 jps 若command not found 查看配置文件目录是不是自己对应目录
//查看java版本
java -version

二.前后端打包

https://www.kancloud.cn/zhangdaiscott/jeecg-boot/2043886#jeecgbootJAR_10

三.上传并启动

//启动jar包
nohup java -jar jeecg-boot-module-system-2.4.5.jar >catalina.out 2>&1 &
//查看jar包状态
ps -ef|grep java

四.注意

打完后端包后,本地idea启动不起来解决方法 选择dev方式,parent中重新双击install

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值