安装CRM服务器的过程

1、安装CENTOS7.9

下载CentOS-7-x86_64-DVD-2009.iso镜像文件,用FedoraMediaWriter-win32-latest.exe制作启动U盘,选择basic web server环境。(因为默认的java环境是1.7,需要安装java8,所有只能改称最小化安装,通过rpm -e --nodeps卸载的话会对使许多软件缺少依赖http://www.voidcn.com/article/p-mjnbwvfn-bra.html)

配置网卡参考:

https://www.cnblogs.com/congcongdi/p/10149925.html

centos防火墙开放8080端口:

https://www.cnblogs.com/wq-9/articles/16455628.html

firewall-cmd --zone=public --add-port=8080/tcp --permanent

firewall-cmd --reload

netstat -ntlp(查端口)

 

安装vim:yum -y install vim*

https://www.cnblogs.com/syncmr/p/10740201.html

1.1 安装java环境

下载oracle官网rpm包https://download.oracle.com/otn/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.rpm

rpm -ivh jdk-8u281-linux-x64.rpm

https://blog.csdn.net/zhengjie19/article/details/49100873

注意补充JRE_HOME

(https://blog.csdn.net/JackNaDa/article/details/102694782)

 

原版openjdk安装位置:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/jre/bin/

https://www.cnblogs.com/lenmom/p/9494877.html

但是因为centos自带的java环境全,不能编译java代码,需要重装jdk(不用卸载原来的openjdk),重新指定JAVA_HOME和PATH 即可。

[root@bogon installer]# rpm -ivh jdk-8u361-linux-x64.rpm
警告:jdk-8u361-linux-x64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:jdk1.8-2000:1.8.0_361-fcs        ################################# [100%]
Unpacking JAR files...
        tools.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...
[root@bogon installer]# cd /usr/java/jdk1.8.0_361-amd64/
[root@bogon jdk1.8.0_361-amd64]# vim /etc/profile.d/javahome.sh
[root@bogon jdk1.8.0_361-amd64]# cat /etc/profile.d/javahome.sh
#!/bin/bash
JAVA_HOME=/usr/java/jdk1.8.0_361-amd64/
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
export CLASSPATH=.

[root@bogon jdk1.8.0_361-amd64]# chmod +x /etc/profile.d/javahome.sh

[root@bogon profile.d]# source /etc/profile.d/javahome.sh
[root@bogon profile.d]# whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/java/jdk1.8.0_361-amd64/bin/java /usr/share/man/man1/java.1.gz

[root@bogon profile.d]# 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)

 

 需要配置的系统环境变量:

# /etc/profile.d/wkcrm.sh
export JAVA_HOME=/usr/java/jdk1.8.0_361-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${CLASSPATH}
export CATALINA_HOME=/home/crm/apache-tomcat-9.0.73
export MAVEN_HOME=/home/crm/apache-maven-3.9.0
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${CATALINA_HOME}/bin:${MAVEN_HOME}/bin:${PATH}

source /opt/rh/devtoolset-9/enable
 

 注意路径要复制,比对每个字符是否一致。

 

 

1.2安装tomcat

下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.43/bin/apache-tomcat-9.0.43.tar.gz

安装方法还是参考:https://blog.csdn.net/JackNaDa/article/details/102694782

添加开机启动服务

[root@localhost bin]# vim /etc/systemd/system/tomcat.service

给tomcat设置开机自动启动:

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

[Service]
Type=forking
ExecStart=/home/tomcat/apache-tomcat-9.0.43/bin/startup.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

 

systemctl daemon-reload
systemctl start tomcat.service
systemctl enable tomcat.service

安装netstat:yum install net-tools

 

[root@bogon profile.d]# vim /etc/systemd/system/tomcat.service

[root@bogon profile.d]# cat /etc/systemd/system/tomcat.service
[Unit]
Description=tomcat-server
After=network.target

[Service]
Type=forking
ExecStart=/home/crm/apache-tomcat-9.0.73/bin/startup.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target
[root@bogon profile.d]# systemctl daemon-reload
[root@bogon profile.d]# systemctl start tomcat.service
[root@bogon profile.d]# systemctl enable tomcat.service
Created symlink from /etc/systemd/system/multi-user.target.wants/tomcat.service to /etc/systemd/system/tomcat.service.
[root@bogon profile.d]# systemctl status tomcat.service
● tomcat.service - tomcat-server
   Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 2023-03-22 13:33:55 CST; 14s ago
 Main PID: 6286 (java)
   CGroup: /system.slice/tomcat.service
           └─6286 /usr/bin/java -Djava.util.logging.config.file=/home/crm/apache-tomcat-9.0.73/conf/logging.properties -Djava.util.logging.manager=org.ap...

3月 22 13:33:55 bogon systemd[1]: Starting tomcat-server...
3月 22 13:33:55 bogon startup.sh[6272]: Tomcat started.
3月 22 13:33:55 bogon systemd[1]: Started tomcat-server.
[root@bogon profile.d]# netstat -antp | grep 8080
tcp6       0      0 :::8080                 :::*                    LISTEN      6286/java
[root@bogon profile.d]# ps -ef | grep tomcat
root      6286     1  5 13:33 ?        00:00:04 /usr/bin/java -Djava.util.logging.config.file=/home/crm/apache-tomcat-9.0.73/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /home/crm/apache-tomcat-9.0.73/bin/bootstrap.jar:/home/crm/apache-tomcat-9.0.73/bin/tomcat-juli.jar -Dcatalina.base=/home/crm/apache-tomcat-9.0.73 -Dcatalina.home=/home/crm/apache-tomcat-9.0.73 -Djava.io.tmpdir=/home/crm/apache-tomcat-9.0.73/temp org.apache.catalina.startup.Bootstrap start
root      6913 30357  0 13:35 pts/3    00:00:00 grep --color=auto tomcat
[root@bogon profile.d]# tail -f /home/tomcat/apache-tomcat-9.0.73/logs/catalina.out
tail: 无法打开"/home/tomcat/apache-tomcat-9.0.73/logs/catalina.out" 读取数据: 没有那个文件或目录
tail: 没有剩余文件
[root@bogon profile.d]# tail -f /home/crm/apache-tomcat-9.0.73/logs/catalina.out
22-Mar-2023 13:34:02.743 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/crm/apache-tomcat-9.0.73/webapps/docs]
22-Mar-2023 13:34:02.763 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/crm/apache-tomcat-9.0.73/webapps/docs]的部署已在[20]毫秒内完成
22-Mar-2023 13:34:02.763 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/crm/apache-tomcat-9.0.73/webapps/examples]
22-Mar-2023 13:34:02.956 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/crm/apache-tomcat-9.0.73/webapps/examples]的部署已在[193]毫秒内完成
22-Mar-2023 13:34:02.956 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/crm/apache-tomcat-9.0.73/webapps/host-manager]
22-Mar-2023 13:34:02.972 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/crm/apache-tomcat-9.0.73/webapps/host-manager]的部署已在[16]毫秒内完成
22-Mar-2023 13:34:02.973 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/crm/apache-tomcat-9.0.73/webapps/manager]
22-Mar-2023 13:34:03.000 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/crm/apache-tomcat-9.0.73/webapps/manager]的部署已在[27]毫秒内完成
22-Mar-2023 13:34:03.004 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"]
22-Mar-2023 13:34:03.047 信息 [main] org.apache.catalina.startup.Catalina.start [5049]毫秒后服务器启动

[root@bogon profile.d]#

 

 

 

 

 

2、安装Mysql

下载mysql server

https://downloads.mysql.com/archives/community/

wget -c https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar

 

https://www.cnblogs.com/raicho/p/12511998.html

rpm -qa|grep mariadb
rpm –qa 其中:
–a选项是查询所有已经安装的软件包。    
-q是查询一个包是否安装(https://blog.csdn.net/weixin_43837883/article/details/89492409)
  • -v : verbose mode - Display more information about errors and warnings.默认为关闭。
[root@localhost bin]# rpm -qa|grep mysql
[root@localhost bin]# rpm -qa|grep MySQL
[root@localhost bin]# rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@localhost bin]# rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64
错误:依赖检测失败:
        libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
        libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
[root@localhost bin]# rpm -ev postfix-2:2.10.1-6.el7.x86_64
软件包准备中...
postfix-2:2.10.1-6.el7.x86_64
[root@localhost bin]# rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64

https://blog.csdn.net/qq1226546902/article/details/126440296

https://blog.csdn.net/weixin_39839018/article/details/110514621

 
[root@bogon installer]# cd mysqlinstaller/
[root@bogon mysqlinstaller]# ls
mysql-5.7.40-1.el7.x86_64.rpm-bundle.tar                 mysql-community-embedded-devel-5.7.40-1.el7.x86_64.rpm
mysql-community-client-5.7.40-1.el7.x86_64.rpm           mysql-community-libs-5.7.40-1.el7.x86_64.rpm
mysql-community-common-5.7.40-1.el7.x86_64.rpm           mysql-community-libs-compat-5.7.40-1.el7.x86_64.rpm
mysql-community-devel-5.7.40-1.el7.x86_64.rpm            mysql-community-server-5.7.40-1.el7.x86_64.rpm
mysql-community-embedded-5.7.40-1.el7.x86_64.rpm         mysql-community-test-5.7.40-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.40-1.el7.x86_64.rpm
[root@bogon mysqlinstaller]# rpm -ivh mysql-community-common-5.7.40-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.7.40-1.e################################# [100%]
[root@bogon mysqlinstaller]# rpm -ivh mysql-community-libs-5.7.40-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-libs-5.7.40-1.el7################################# [100%]
[root@bogon mysqlinstaller]# rpm -ivh mysql-community-client-5.7.40-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-client-5.7.40-1.e################################# [100%]
[root@bogon mysqlinstaller]# rpm -ivh mysql-community-server-5.7.40-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.40-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-server-5.7.40-1.e################################# [100%]

 

启动mysql:

[root@bogon mysqlinstaller]# systemctl start mysqld.service
[root@bogon mysqlinstaller]# service mysqld status
Redirecting to /bin/systemctl status  mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 2023-03-22 14:09:16 CST; 11s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 19544 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 19361 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 19546 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─19546 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

3月 22 14:08:56 bogon systemd[1]: Starting MySQL Server...
3月 22 14:09:16 bogon systemd[1]: Started MySQL Server.

 

 

 

mysql设置root初始密码

use mysql;

update user set authentication_string=password('123456') where user='root';

https://www.jb51.net/article/84146.htm

修改密码:

alter user 'root'@'localhost' identified by 'password';(password是实际的密码,比如123456,但是由于mysql5.7密码策略要求,必须包含大写字母、小写字母,数字和符号)

 

[root@bogon mysqlinstaller]# grep password /var/log/mysqld.log
2023-03-22T06:09:01.203883Z 1 [Note] A temporary password is generated for root@localhost: 5(;XeJn(BI()
[root@bogon mysqlinstaller]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.40

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '*******************(密码隐藏)';
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

 

 

https://www.cnblogs.com/wtxkui/p/11618505.html

导入sql脚本时遇到的navicat小问题,不选中在每个运行中运行多个查询等选项:

https://zhidao.baidu.com/question/525156367906044565.html

 

2、安装redis:

下载redis:https://download.redis.io/releases/redis-6.0.10.tar.gz

https://www.cnblogs.com/heqiuyong/p/10463334.html

redis6.0+需要的gcc版本为5.3及以上,Centos7.9需要升级gcc

[root@bogon redis-7.0.9]# yum install -y gcc

[root@bogon redis-7.0.9]# yum -y install centos-release-scl

[root@bogon redis-7.0.9]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

 

[root@bogon redis-7.0.9]# scl enable devtoolset-9 bash

[root@bogon redis-7.0.9]# make

https://blog.csdn.net/P_Top/article/details/106143693

make编译遇到报错:zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: 没有那个文件或目录时,

尝试:https://blog.csdn.net/weixin_35757704/article/details/119280758

[root@bogon redis-7.0.9]# make
cd src && make all
which: no python3 in (/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/java/jdk1.8.0_361-amd64//jre/bin:/home/wkcrm/apache-tomcat-9.0.73//bin:/home/wkcrm/apache-maven-3.9.0//bin:/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录“/root/installer/redis-7.0.9/src”
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: 没有那个文件或目录
   50 | #include <jemalloc/jemalloc.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [adlist.o] 错误 1
make[1]: 离开目录“/root/installer/redis-7.0.9/src”
make: *** [all] 错误 2
[root@bogon redis-7.0.9]# make MALLOC=libc
cd src && make all
which: no python3 in (/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/java/jdk1.8.0_361-amd64//jre/bin:/home/wkcrm/apache-tomcat-9.0.73//bin:/home/wkcrm/apache-maven-3.9.0//bin:/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录“/root/installer/redis-7.0.9/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep
rm -f adlist.d quicklist.d ae.d anet.d dict.d server.d sds.d zmalloc.d lzf_c.d lzf_d.d pqsort.d zipmap.d sha1.d ziplist.d release.d networking.d util.d object.d db.d replication.d rdb.d t_string.d t_list.d t_set.d t_zset.d t_hash.d config.d aof.d pubsub.d multi.d debug.d sort.d intset.d syncio.d cluster.d crc16.d endianconv.d slowlog.d eval.d bio.d rio.d rand.d memtest.d syscheck.d crcspeed.d crc64.d bitops.d sentinel.d notify.d setproctitle.d blocked.d hyperloglog.d latency.d sparkline.d redis-check-rdb.d redis-check-aof.d geo.d lazyfree.d module.d evict.d expire.d geohash.d geohash_helper.d childinfo.d defrag.d siphash.d rax.d t_stream.d listpack.d localtime.d lolwut.d lolwut5.d lolwut6.d acl.d tracking.d connection.d tls.d sha256.d timeout.d setcpuaffinity.d monotonic.d mt19937-64.d resp_parser.d call_reply.d script_lua.d script.d functions.d function_lua.d commands.d anet.d adlist.d dict.d redis-cli.d zmalloc.d release.d ae.d redisassert.d crcspeed.d crc64.d siphash.d crc16.d monotonic.d cli_common.d mt19937-64.d ae.d anet.d redis-benchmark.d adlist.d dict.d zmalloc.d redisassert.d release.d crcspeed.d crc64.d siphash.d crc16.d monotonic.d cli_common.d mt19937-64.d
(cd ../deps && make distclean)
make[2]: 进入目录“/root/installer/redis-7.0.9/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(cd hdr_histogram && make clean) > /dev/null || true
(rm -f .make-*)
make[2]: 离开目录“/root/installer/redis-7.0.9/deps”
(cd modules && make clean)
make[2]: 进入目录“/root/installer/redis-7.0.9/src/modules”
rm -rf *.xo *.so
make[2]: 离开目录“/root/installer/redis-7.0.9/src/modules”
(cd ../tests/modules && make clean)
make[2]: 进入目录“/root/installer/redis-7.0.9/tests/modules”
rm -f commandfilter.so basics.so testrdb.so fork.so infotest.so propagate.so misc.so hooks.so blockonkeys.so blockonbackground.so scan.so datatype.so datatype2.so auth.so keyspace_events.so blockedclient.so getkeys.so getchannels.so test_lazyfree.so timer.so defragtest.so keyspecs.so hash.so zset.so stream.so mallocsize.so aclcheck.so list.so subcommands.so reply.so cmdintrospection.so eventloop.so moduleconfigs.so moduleconfigstwo.so publish.so usercall.so commandfilter.xo basics.xo testrdb.xo fork.xo infotest.xo propagate.xo misc.xo hooks.xo blockonkeys.xo blockonbackground.xo scan.xo datatype.xo datatype2.xo auth.xo keyspace_events.xo blockedclient.xo getkeys.xo getchannels.xo test_lazyfree.xo timer.xo defragtest.xo keyspecs.xo hash.xo zset.xo stream.xo mallocsize.xo aclcheck.xo list.xo subcommands.xo reply.xo cmdintrospection.xo eventloop.xo moduleconfigs.xo moduleconfigstwo.xo publish.xo usercall.xo
make[2]: 离开目录“/root/installer/redis-7.0.9/tests/modules”
(rm -f .make-*)
echo STD=-pedantic -DREDIS_STATIC= -std=c99 >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=libc >> .make-settings
echo BUILD_TLS= >> .make-settings
echo USE_SYSTEMD= >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-pedantic -DREDIS_STATIC= -std=c99 -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua hdr_histogram)
make[2]: 进入目录“/root/installer/redis-7.0.9/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(cd hdr_histogram && make clean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: 进入目录“/root/installer/redis-7.0.9/deps/hiredis”
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic alloc.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic net.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic hiredis.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic sds.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic async.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic read.c
cc -std=c99 -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb -pedantic sockcompat.c
ar rcs libhiredis.a alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
make[3]: 离开目录“/root/installer/redis-7.0.9/deps/hiredis”
MAKE linenoise
cd linenoise && make
make[3]: 进入目录“/root/installer/redis-7.0.9/deps/linenoise”
cc  -Wall -Os -g  -c linenoise.c
make[3]: 离开目录“/root/installer/redis-7.0.9/deps/linenoise”
MAKE lua
cd lua/src && make all CFLAGS="-Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2 " MYLDFLAGS="" AR="ar rc"
make[3]: 进入目录“/root/installer/redis-7.0.9/deps/lua/src”
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lapi.o lapi.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lcode.o lcode.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ldebug.o ldebug.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ldo.o ldo.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ldump.o ldump.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lfunc.o lfunc.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lgc.o lgc.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o llex.o llex.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lmem.o lmem.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lobject.o lobject.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lopcodes.o lopcodes.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lparser.o lparser.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lstate.o lstate.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lstring.o lstring.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ltable.o ltable.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ltm.o ltm.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lundump.o lundump.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lvm.o lvm.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lzio.o lzio.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o strbuf.o strbuf.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o fpconv.o fpconv.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lauxlib.o lauxlib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lbaselib.o lbaselib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ldblib.o ldblib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o liolib.o liolib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lmathlib.o lmathlib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o loslib.o loslib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o ltablib.o ltablib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lstrlib.o lstrlib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o loadlib.o loadlib.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o linit.o linit.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lua_cjson.o lua_cjson.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lua_struct.o lua_struct.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lua_cmsgpack.o lua_cmsgpack.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lua_bit.o lua_bit.c
ar rc liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o fpconv.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o lua_bit.o   # DLL needs all object files
ranlib liblua.a
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o lua.o lua.c
cc -o lua  lua.o liblua.a -lm
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o luac.o luac.c
cc -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP  -O2    -c -o print.o print.c
cc -o luac  luac.o print.o liblua.a -lm
make[3]: 离开目录“/root/installer/redis-7.0.9/deps/lua/src”
MAKE hdr_histogram
cd hdr_histogram && make
make[3]: 进入目录“/root/installer/redis-7.0.9/deps/hdr_histogram”
cc -std=c99 -Wall -Os -g  -DHDR_MALLOC_INCLUDE=\"hdr_redis_malloc.h\" -c  hdr_histogram.c
ar rcs libhdrhistogram.a hdr_histogram.o
make[3]: 离开目录“/root/installer/redis-7.0.9/deps/hdr_histogram”
make[2]: 离开目录“/root/installer/redis-7.0.9/deps”
    CC adlist.o
    CC quicklist.o
    CC ae.o
    CC anet.o
    CC dict.o
    CC server.o
    CC sds.o
    CC zmalloc.o
    CC lzf_c.o
    CC lzf_d.o
    CC pqsort.o
    CC zipmap.o
    CC sha1.o
    CC ziplist.o
    CC release.o
    CC networking.o
    CC util.o
    CC object.o
    CC db.o
    CC replication.o
    CC rdb.o
    CC t_string.o
    CC t_list.o
    CC t_set.o
    CC t_zset.o
    CC t_hash.o
    CC config.o
    CC aof.o
    CC pubsub.o
    CC multi.o
    CC debug.o
    CC sort.o
    CC intset.o
    CC syncio.o
    CC cluster.o
    CC crc16.o
    CC endianconv.o
    CC slowlog.o
    CC eval.o
    CC bio.o
    CC rio.o
    CC rand.o
    CC memtest.o
    CC syscheck.o
    CC crcspeed.o
    CC crc64.o
    CC bitops.o
    CC sentinel.o
    CC notify.o
    CC setproctitle.o
    CC blocked.o
    CC hyperloglog.o
    CC latency.o
    CC sparkline.o
    CC redis-check-rdb.o
    CC redis-check-aof.o
    CC geo.o
    CC lazyfree.o
    CC module.o
    CC evict.o
    CC expire.o
    CC geohash.o
    CC geohash_helper.o
    CC childinfo.o
    CC defrag.o
    CC siphash.o
    CC rax.o
    CC t_stream.o
    CC listpack.o
    CC localtime.o
    CC lolwut.o
    CC lolwut5.o
    CC lolwut6.o
    CC acl.o
    CC tracking.o
    CC connection.o
    CC tls.o
    CC sha256.o
    CC timeout.o
    CC setcpuaffinity.o
    CC monotonic.o
    CC mt19937-64.o
    CC resp_parser.o
    CC call_reply.o
    CC script_lua.o
    CC script.o
    CC functions.o
    CC function_lua.o
    CC commands.o
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    CC redisassert.o
    CC cli_common.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: 离开目录“/root/installer/redis-7.0.9/src”
[root@bogon redis-7.0.9]#

 安装编译后的文件:

[root@bogon redis-7.0.9]# make install PREFIX=/usr/local/redis
cd src && make install
which: no python3 in (/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/java/jdk1.8.0_361-amd64//jre/bin:/home/wkcrm/apache-tomcat-9.0.73//bin:/home/wkcrm/apache-maven-3.9.0//bin:/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录“/root/installer/redis-7.0.9/src”
    CC Makefile.dep
make[1]: 离开目录“/root/installer/redis-7.0.9/src”
which: no python3 in (/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/java/jdk1.8.0_361-amd64//jre/bin:/home/wkcrm/apache-tomcat-9.0.73//bin:/home/wkcrm/apache-maven-3.9.0//bin:/opt/rh/devtoolset-9/root/usr/bin:/usr/java/jdk1.8.0_361-amd64//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
make[1]: 进入目录“/root/installer/redis-7.0.9/src”

Hint: It's a good idea to run 'make test' ;)

    INSTALL redis-server
    INSTALL redis-benchmark
    INSTALL redis-cli
make[1]: 离开目录“/root/installer/redis-7.0.9/src”

修改redis配置,设置后台启动:

[root@bogon local]# cp /root/installer/redis-7.0.9/redis.conf /usr/local/redis/bin/
[root@bogon local]# cd redis/bin/
[root@bogon bin]# ls
dump.rdb  redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis.conf  redis-sentinel  redis-server
[root@bogon bin]# vim redis.conf
[root@bogon bin]# ./redis-server redis.conf
[root@bogon bin]# ps -ef|grep redis
root     11122     1  0 15:09 ?        00:00:00 ./redis-server 127.0.0.1:6379
root     11193  5149  0 15:09 pts/1    00:00:00 grep --color=auto redis
[root@bogon bin]# vim /etc/systemd/system/redis.service
[root@bogon bin]# cat /etc/systemd/system/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

启动redis:

[root@bogon bin]# systemctl daemon-reload
[root@bogon bin]# systemctl start redis.service
[root@bogon bin]# systemctl enable redis.service
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /etc/systemd/system/redis.service.
[root@bogon bin]# systemctl status redis.service
● redis.service - redis-server
   Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 2023-03-22 15:14:40 CST; 16s ago
 Main PID: 13146 (redis-server)
   CGroup: /system.slice/redis.service
           └─13146 /usr/local/redis/bin/redis-server 127.0.0.1:6379

3月 22 15:14:40 bogon systemd[1]: Starting redis-server...
3月 22 15:14:40 bogon systemd[1]: Started redis-server.

设置软连接,测试redis:

[root@bogon bin]# ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
[root@bogon bin]# redis
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> quit

 

 

 

 

3、安装maven:

下载地址:https://mirrors.bfsu.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

安装方法:https://blog.csdn.net/JackNaDa/article/details/102694782

如果maven仓库下载慢,应设置maven的国内镜像服务器,修改/home/crm/apache-maven-3.9.0/conf/settings.xml

    <mirror>
      <id>alimaven</id>
      <mirrorOf>*</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>

 

 

 

 

CentOs7安装unzip:yum install -y unzip zip

 

4.编译72crm-java-master源码并将war文件部署到tomcat

4.1导入数据库脚本

[root@bogon crm]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.40 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database crm9;
Query OK, 1 row affected (0.00 sec)

mysql> use crm9;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> source /home/crm/72crm-java-master/docs/crm9.sql;
Query OK, 0 rows affected (0.00 sec)

4.2修改src配置

src/main/resources/config/crm9-config.txt

src/main/resources/config/redis.json

src/main/resources/config/undertow.txt

pom.xml

src/main/java/com/kakarote/crm9/Application.java

 4.3在/home/crm/72crm-java-master/下 执行mvn clean package打包,将生成的war包放置到tomcat前端路径中

[crm@bogon 72crm-java-master]$ cp target/ROOT.war /home/crm/apache-tomcat-9.0.73/webapps/

 

 

 

5.注意:如果无法通过其他终端访问服务器ip:8080,需要设置防火墙开防8080端口:

firewall-cmd --zone=public --add-port=8080/tcp --permanent

firewall-cmd --reload

 

6.验证

访问http://服务器真实ip:8080

如果启动失败,查看/home/crm/apache-tomcat-9.0.73/logs/catalina.out,检查数据库连接是否正常等

 

2023-03-22 16:31:36,839 [ERROR][Druid-ConnectionPool-Create-324529712][DruidDataSource.java:2103] create connection error, url: jdbc:mysql://127.0.0.1:3306/crm?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false, errorCode 1049, state 42000
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'crm'

 

遇到的问题:

1、使用mvn 打包时,阿里云镜像也存在连接不稳定的情况,遇到报错,多执行几次就过了。

Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/maven-plugin-api/3.0/maven-plugin-api-3.0.jar
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/org/sonatype/aether/aether-spi/1.7/aether-spi-1.7.jar
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/org/sonatype/sisu/sisu-inject-plexus/1.4.2/sisu-inject-plexus-1.4.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.139 s
[INFO] Finished at: 2023-03-22T16:22:09+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project crm9: Execution default-compile of                     goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile failed: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.6.1 or one of its dependen                    cies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:3.0, org.sonatype.sisu:sisu-inject-plexus:j                    ar:1.4.2, org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7, org.sonatype.aether:aether-spi:jar:1.7: Could not transfer artifact org.apache.maven:maven-plugin-ap                    i:jar:3.0 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com: Unknown host maven.aliyun.com -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[crm@bogon 72crm-java-master]$ mvn clean package

 

2、尽量不要修改数据库名称等配置项,会增加出错机率,启动异常还很难查原因。其他服务器改过数据库名称(crm),结果用了其他服务器的配置,和新服务器的数据库名(crm9)不匹配。

3、tomcat、maven安装路径尽量固定到/home/crm下,配置PATH等系统环境变量时复制粘贴路径,避免手敲出错。我遇到了maven的path路径配置成其他服务器的路径(/home/wkcrm/...),结果输入mvn命令系统提示未知命令。

4、可以centos复制磁盘的命令dd 克隆系统,这样就不用重复安装了。

 

posted on 2021-02-04 15:15  梓沂  阅读(241)  评论(0编辑  收藏  举报