这里我用的jdk1.8.0_321版本,大家可以从官网下载或从下方网盘下载
jdk1.8.0_321版本下载地址: https://pan.baidu.com/s/1N4KUpTyjxpsWiFCZkWecOg
提取码: in2p
首先创建java文件夹: mkdir /usr/java
进入java文件夹: cd /usr/java/
上传JDK安装包: rz
提示错误:
[root@iZbp1geif6wob8t8yvv02kZ ~]# rz
-bash: rz: command not found
执行命令:
yum install lrzsz
执行安装
解压JDK安装包: tar -zxvf jdk-xxx.tar.gz
[root@localhost usr]# mkdir /usr/java
[root@localhost usr]# cd /usr/java/
[root@localhost java]# rz
[root@localhost java]# tar -zxvf jdk-8u191-linux-x64.tar.gz
编辑profile配置文件: vim /etc/profile
[root@localhost java]# vim /etc/profile
输入i进入编辑模式,在最下面补充配置信息,补充完后按Esc退出编辑模式后,输入:wq进行保存并退出
export JAVA_HOME=/usr/java/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
如下图所示:
配置文件生效: source /etc/profile
查看JDK版本信息: java -version
[root@localhost java]# source /etc/profile
[root@localhost java]# java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
[root@localhost java]#
注意: 有多少版本删除多少
rpm -qa|grep java
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
[root@localhost java]# rpm -qa|grep java
java-1.7.0-openjdk-headless-1.7.0.261-2.6.22.2.el7_8.x86_64
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2020a-1.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64
java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64
[root@localhost java]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.261-2.6.22.2.el7_8.x86_64
[root@localhost java]# rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch
[root@localhost java]# rpm -e --nodeps tzdata-java-2020a-1.el7.noarch
[root@localhost java]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64
[root@localhost java]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64
[root@localhost java]# rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch
[root@localhost java]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64
这里我用的apache-maven-3.1.1版本,大家可以从官网下载或从下方网盘下载
apache-maven-3.1.1版本下载地址: https://pan.baidu.com/s/1V7bzL0LdrA58gja2cgvnlg
提取码: e4hv
首先创建maven文件夹: mkdir /usr/maven
进入maven文件夹: cd /usr/maven/
上传maven安装包: rz
解压maven安装包: tar -zxvf apache-maven-3.1.1-bin.tar.gz
[root@localhost usr]# mkdir /usr/maven
[root@localhost usr]# cd /usr/maven/
[root@localhost maven]# rz
[root@localhost maven]# tar -zxvf apache-maven-3.1.1-bin.tar.gz
编辑profile配置文件: vim /etc/profile
[root@localhost java]# vim /etc/profile
输入i进入编辑模式,在最下面补充配置信息,补充完后按Esc退出编辑模式后,输入:wq进行保存并退出
export M2_HOME=/usr/maven/apache-maven-3.1.1
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
如下图所示:
配置文件生效: source /etc/profile
查看maven版本信息: mvn -v
[root@localhost maven]# source /etc/profile
[root@localhost maven]# mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800)
Maven home: /usr/maven/apache-maven-3.1.1
Java version: 1.8.0_191, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_191/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.el7.x86_64", arch: "amd64", family: "unix"
[root@localhost maven]#
进入maven配置文件conf文件夹: cd /usr/maven/apache-maven-3.1.1/conf/
上传准备好的setting配置文件: rz
[root@localhost maven]# cd /usr/maven/apache-maven-3.1.1/conf/
[root@localhost conf]# rz
这里我用的git-2.17.0版本,大家可以从官网下载或从下方网盘下载
git-2.17.0版本下载地址: https://pan.baidu.com/s/1hE8Yq08ClntNNCr4FIVkKg
提取码: g0n0
首先安装源码所需要的依赖: yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
删除旧版本: yum remove git
创建git文件夹: mkdir /usr/git
进入git文件夹: cd /usr/git/
上传git安装包: rz
解压git安装包: tar -zxvf git-2.17.0.tar.gz
[root@localhost usr]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
[root@localhost usr]# yum remove git
[root@localhost usr]# mkdir /usr/git
[root@localhost usr]# cd /usr/git/
[root@localhost git]# rz
[root@localhost git]# tar -zxvf git-2.17.0.tar.gz
进入git目录: cd /usr/git/git-2.17.0
编译: make prefix=/usr/local/git all
安装: make prefix=/usr/local/git install
[root@localhost git]# cd /usr/git/git-2.17.0
[root@localhost git-2.17.0]# make prefix=/usr/local/git all
[root@localhost git-2.17.0]# make prefix=/usr/local/git install
编辑profile配置文件: vim /etc/profile
[root@localhost java]# vim /etc/profile
输入i进入编辑模式,在最下面补充配置信息,补充完后按Esc退出编辑模式后,输入:wq进行保存并退出
export PATH="/usr/local/git/bin:$PATH"
如下图所示:
配置文件生效: source /etc/profile
查看git版本信息: git --version
[root@localhost git-2.17.0]# source /etc/profile
[root@localhost git-2.17.0]# git --version
git version 2.17.0
[root@localhost git-2.17.0]#
从远程获取redis安装包:
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
[root@localhost soft]# wget http://download.redis.io/releases/redis-4.0.8.tar.gz
解压:
tar -zxvf redis-4.0.8.tar.gz
安装tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
./configure
make
make install
编译和安装redis:
解压redis安装包:
tar -zxvf redis-4.0.8.tar.gz
将解压文件移动到redis目录:
mv /root/soft/redis-4.0.8 /usr/local/redis
cd /usr/local/redis
make
cd src
make install prefix=/usr/local/redis
[root@localhost redis]# wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
[root@localhost redis]# tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
[root@localhost redis]# cd /usr/local/tcl8.6.1/unix/
[root@localhost unix]# ./configure
[root@localhost unix]# make
[root@localhost unix]# make install
[root@localhost unix]# cd /root/soft
[root@localhost soft]# tar -zxvf redis-4.0.8.tar.gz
[root@localhost soft]# mv /root/soft/redis-4.0.8 /usr/local/redis
[root@localhost soft]# cd /usr/local/redis/
[root@localhost soft]# make
[root@localhost soft]# cd src
[root@localhost src]# make install prefix=/usr/local/redis
cd /usr/local/redis
vim redis.conf (建议通过下载redis.conf文件修改后再上传)
找到daemonize no改为yes
找到appendonly no改为yes
找到bind 127.0.0.1 注释掉 # bind 127.0.0.1
找到requirepass 解除注释并设置密码root
[root@localhost unix]# cd /usr/local/redis/redis-4.0.8/
[root@localhost redis-4.0.8]# vim redis.conf
cd /usr/local/redis/src
./redis-server ../redis.conf
cd /usr/local/redis/src
./redis-cli -a root shutdown
连接redis服务:
redis-cli --raw
注意:如果命令后面不加"--raw"会导致获取中文乱码
[root@localhost src]# ./redis-cli
127.0.0.1:6379> auth root
127.0.0.1:6379> set runoob "菜鸟教穧¨‹"
OK
127.0.0.1:6379> get runoob
"\xe8\x8f\x9c\xe9\xb8\x9f\xe6\x95\x99\xe7\xa8\xe7\xa8\x8b"
[root@localhost src]# ./redis-cli --raw
127.0.0.1:6379> auth root
OK
127.0.0.1:6379> set aa "菜鸟教程"
OK
127.0.0.1:6379> get aa
菜鸟教程
127.0.0.1:6379>
验证:
set name zhangsan
提示认证失败,这时需要输入密码:
格式: auth password
重新验证:
set name zhangsan
get name
[root@localhost src]# redis-cli
127.0.0.1:6379> set name zhangsan
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth root
OK
127.0.0.1:6379> set name zhangsan
OK
127.0.0.1:6379> get name
"zhangsan"
127.0.0.1:6379>
创建nginx文件夹:
cd /usr/local/
mkdir nginx
cd nginx
上传nginx安装包:
这里我用的nginx-1.13.7版本,大家可以从官网下载或从下方网盘下载:
nginx-1.13.7版本网盘下载地址: https://pan.baidu.com/s/1Kzk5hg7Nbo3AdtEvyAQazw
提取码: 68r1
[root@localhost ~]# mkdir /usr/local/nginx
[root@localhost ~]# cd /usr/local/nginx/
[root@localhost ~]# rz
[root@localhost nginx]# ll
总用量 968
-rw-r--r--. 1 root root 990836 11月 21 2017 nginx-1.13.7.tar.gz
[root@localhost nginx]#
云安装依赖:
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
[root@localhost nginx]# yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
tar -zxvf nginx-1.13.7.tar.gz
cd nginx-1.13.7
./configure
make
make install
[root@localhost nginx]# tar -zxvf nginx-1.13.7.tar.gz
[root@localhost nginx]# cd nginx-1.13.7
[root@localhost nginx]# ./configure
[root@localhost nginx]# make
[root@localhost nginx]# make install
修改:
vim /usr/local/nginx/conf/nginx.conf
补充下方信息:
location / {
root /root/build/web/dist/;
index index.html index.htm;
}
[root@localhost nginx-1.13.7]# vim /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/sbin
./nginx -c /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/sbin
./nginx -s stop
cd /usr/local/nginx/sbin
./nginx -s reload
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
yum -y install epel-release
yum -y install socat
下载erlang安装包(网盘下载):
网盘地址: https://pan.baidu.com/s/1ZR2KMpX8OdgD3rDO_tVQeA
提取码: osty
安装:
rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm
下载RabbitMQ安装包:
下载方式一(云下载):
https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.7.7
下载方式二(网盘下载):
网盘地址: https://pan.baidu.com/s/1uQt_E1B8NEbz4Hafsw9ybg
提取码: r3rl
这里用的版本是:rabbitmq-server-3.6.10-1.el7.noarch.rpm
rpm -ivh --nodeps rabbitmq-server-3.6.10-1.el7.noarch.rpm
----添加下面的代码到配置文件(vim /etc/profile)中
export PATH=$PATH:/usr/lib/rabbitmq/bin
//执行下面的命令刷新配置:
source /etc/profile
cd /var/
chgrp rabbitmq run/ -R
chown rabbitmq run/ -R
ln -s /usr/local/erlang/bin/erl /usr/bin/erl
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/mnesia/
service rabbitmq-server start
注意出现如下问题解决方式:
1. 如果执行"chgrp rabbitmq run/ -R"时出现该问题: chgrp: 无法访问"run/user/1000/gvfs": 权限不够
则执行: umount /run/user/1000/gvfs
rm -rf /run/user/1000/gvfs
原因是: 官方说这是一个bug——bug#615848. 原因是FUSE文件系统和权限不配的问题,全局搜索时碰到它就会退出报错。顺带跑到目录/run/user/1000/下面查看了下权限,发现出了第一位是d表示gvfs是个目录外,其他表示权限的9位全部是问号。
2. 如果执行"service rabbitmq-server start"时,出现:Redirecting to /bin/systemctl start rabbitmq-server.service Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
则执行: journalctl -xe 下令进一步查看问题
rabbitmq-plugins enable rabbitmq_management
rabbitmqctl add_user admin admin123
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin '.*' '.*' '.*'
http://{IP}:15672/
注意:打开防火墙,开放端口
开放linux系统端口
systemctl start firewalld
firewall-cmd --zone=public --add-port=8087/tcp --permanent
firewall-cmd --reload
mq连接使用信息
重启rabbitmq服务通过两个命令来实现:
rabbitmqctl stop :停止rabbitmq
rabbitmq-server restart : 重启rabbitmq
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
tar -zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /data/mysql
chown mysql:mysql -R /data/mysql
mkdir -p /home/data/mysql
chown mysql:mysql -R /home/data/mysql
vim /etc/my.cnf
"
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/home/data/mysql
socket=/home/data/mysql/mysql.sock
symbolic-links=0
lower_case_table_names = 1
[mysqld_safe]
log-error=/home/data/mysql/mariadb.log
pid-file=/home/data/mysql/mariadb.pid
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true
!includedir /etc/my.cnf.d
"
rpm -qa|grep libaio
yum install libaio-devel.x86_64
cd /usr/local/mysql/bin/
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/home/data/mysql --user=mysql --initialize
//这里一定要保持好初始化的密码,在这个命令执行完毕之后, 会有一个 [Note] A temporary password is generated for root@localhost: geM=Zb5uwffR 其中geM=Zb5uwffR就是初始化密码,千万不要忘记
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
service mysql start
ps -ef|grep mysql //查看进程
cd /usr/local/mysql/bin
ln -s /home/data/mysql/mysql.sock /tmp/mysql.sock
./mysql -u root -p
//需要输入密码:geM=Zb5uwffR
SET PASSWORD = PASSWORD('GqUoAnGm0bo=');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
use mysql
update user set host = '%' where user = 'root'; #使root能再任何host访问
FLUSH PRIVILEGES;
wget https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.gz
tar -zxvf node-v12.16.3-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
mv node-v12.16.3-linux-x64/ nodejs
ln -s /usr/local/nodejs/bin/node /usr/local/bin
ln -s /usr/local/nodejs/bin/npm /usr/local/bin
npm install --unsafe-perm
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm config set registry https://registry.npm.taobao.org
source ~/.profile
安装cnpm
cd /usr/local/
mkdir openoffice
将openoffice的安装包Apache_OpenOffice_4.1.0_Linux_x86-64_install-rpm_zh-CN.tar上传到该目录下面
解压 tar -zxvf Apache_OpenOffice_4.1.0_Linux_x86-64_install-rpm_zh-CN.tar
cd /usr/local/openoffice/zh-cn/RPMS
yum localinstall *.rpm
cd desktop-integration
rpm -ivh openoffice4.1-redhat-menus-4.1-9764.noarch.rpm
默认会安装在/opt目录下。
启动服务
1、/opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard 临时启动
2、nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard & 后台启动
可能报错:
no suitable windowing system found, exiting 执行如下命令:yum groupinstall "X Window System"
netstat -lnp |grep 8100 或者 ps -ef |grep soffice
安装中文字体
cd /usr/share/fonts
创建一个中文文件夹,并进入
mkdir chinese
cd chinese
复制windos字体到linux:通过xshell,复制粘贴到chinese里面
给字体赋予权限并进行一下操作:
chmod 755 *.TTF
chmod 755 *.TTC
mkfontscale (如果提示 mkfontscale: command not found,需自行安装 # yum install mkfontscale)
mkfontdir
fc-cache -fv(如果提示 fc-cache: command not found,则需要安装# yum install fontconfig )
然后中文乱码就解决了,不需要重启linux。
npm install -g cnpm --registry=https://registry.npm.taobao.org
ln -s /root/.npm-global/bin/cnpm /usr/local/bin
systemctl start firewalld
firewall-cmd --zone=public --add-port=8087/tcp --permanent
firewall-cmd --reload
application.yml 开发环境配置文件
application-prod.yml 生产环境配置文件
注意: 将生产环境配置文件中的服务地址都改为对应生产环境服务地址
将master开发分支POM文件中"1.0.0-SNAPSHOT" 改为 "1.0.0-RELEASE"
创建打包脚本文件: build-platform.sh
[root@localhost cqkt_build]# touch build-platform.sh
编辑 build-platform.sh脚本文件:
[root@localhost cqkt_build]# vim build-platform.sh
进入build-platform.sh脚本文件后输入"i"进入编辑模式
echo '*********************build platform start**********************'
cd ~/cqkt_codes/project_platform
git fetch
git checkout $1
git pull origin $1
mvn clean install
cd target
PROCESS=`ps -ef|grep project_platform_cqkt-1.0.0-RELEASE.jar |grep -v grep|grep -v PPID|awk '{ print $2}'`
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
rm -rf ~/cqkt_build/project_platform_cqkt-1.0.0-RELEASE.jar
cp project_platform_cqkt-1.0.0-RELEASE.jar ~/cqkt_build/
cd ~/cqkt_build/
nohup java -jar -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms1024m -Xmx1024m -Xmn512m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC project_platform_cqkt-1.0.0-RELEASE.jar --spring.profiles.active=prod > nohup/platform.out &
echo '**********************build platform end ************************'
编辑完后按"Esc"退出编辑模式,再输入":wq"后回车进行保存和退出
这样生产环境打包脚本文件build-platform.sh就准备好了
发包测试:
[root@localhost cqkt_build]# sh build-platform.sh prod
*********************build platform start**********************
已经位于 'prod'
您的分支与上游分支 'origin/prod' 一致。
来自 https://e.coding.net/coder12345/project_cqkt/project_platform
* branch prod -> FETCH_HEAD
已经是最新的。
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
-------------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.601s
[INFO] Finished at: Thu Apr 21 16:12:46 CST 2022
[INFO] Final Memory: 72M/473M
[INFO] ------------------------------------------------------------------------
Kill the prod process [ 17568 ]
**********************build platform end ************************
打包成功,通过日志查看发包详情,配置信息是按照生产环境配置文件"application-prod.yml"加载的,生产环境打包配置成功
2022-04-21 16:14:04,086 INFO (CachingOperationNameGenerator.java:40)- Generating unique operation named: createTemplateProcessUsingPOST_1
2022-04-21 16:14:04,116 INFO (CachingOperationNameGenerator.java:40)- Generating unique operation named: nodeConnectUsingGET_1
2022-04-21 16:14:04,122 INFO (CachingOperationNameGenerator.java:40)- Generating unique operation named: queryPrevAllNodesUsingGET_1
2022-04-21 16:14:04,298 INFO (Jdk14Logger.java:87)- Attempting to connect to: 127.0.0.1:5672
2022-04-21 16:14:04,477 INFO (Jdk14Logger.java:87)- Created new connection: connectionFactory#62bf65d4:0/SimpleConnection@dfcda3 [delegate=amqp://cqkt@127.0.0.1:5672//cqkt, localPort= 52632]
2022-04-21 16:14:04,715 INFO (Jdk14Logger.java:87)- No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2022-04-21 16:14:04,752 INFO (DirectJDKLog.java:180)- Starting ProtocolHandler ["http-nio-8906"]
2022-04-21 16:14:04,758 INFO (DirectJDKLog.java:180)- Using a shared selector for servlet write/read
2022-04-21 16:14:04,944 INFO (Jdk14Logger.java:87)- Tomcat started on port(s): 8906 (http) with context path ''
2022-04-21 16:14:04,948 INFO (Jdk14Logger.java:87)- Started PlatFormApplication in 76.875 seconds (JVM running for 78.177)
2022-04-21 16:14:05,159 INFO (HikariDataSource.java:110)- HikariPool-1 - Starting...
2022-04-21 16:14:05,995 INFO (HikariDataSource.java:123)- HikariPool-1 - Start completed.
2022-04-21 16:14:06,023 INFO (SqlLogInterceptor.java:58)- Execute SQL : SELECT id,tx_time,icon,up_op,type,version,up_time,password,tx_op,sts,readonly,driver,usr,name,model,addr FROM data_source
2022-04-21 16:14:06,063 INFO (SqlLogInterceptor.java:67)- cost time 42ms
2022-04-21 16:14:06,158 INFO (CommandLineRunnerImpl.java:30)- *********************************************项目启动完成************************************************