jdk安装
查看jdk
java -version
检测jdk安装包
rpm -qa | grep java
卸载openjdk
yum remove *openjdk*
(如果显示 You need to be root to perform this command.说明没有root的权限)
则输入 su 然后输入密码即可
卸载完成之后 java -version 则无jdk
创建jdk文件
mkdir -p /usr/java
jdk 链接:https://pan.baidu.com/s/1kz5IIWu-xpdgUDPhfPH-VQ
提取码:4tiw
chmod 777 java
解压jdk
tar -zxvf jdk-1.8
设置环境变量
[root@localhost software]# vim /etc/profile
在最前面添加:
export JAVA_HOME=/usr/java/jdk1.8.0_151 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
执行profile文件
[root@localhost software]# source /etc/profile
bash: /usr/java/jdk1.8.0_151/bin/java: cannot execute binary file
(表示安装的jdk和系统的位数不匹配)
#如何下面不可用可以配置命令软连接
ln -s /data/java/jdk1.8.0_151/bin/java /usr/bin
检查新安装的jdk
[root@localhost software]# java -version
设置服务器重启执行profile文件
cd ~
vim .bashrc
在最后一排加上 source /etc/profile
zookeeper安装配置
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
修改conf中的zoo_sample.conf名称为zoo.cfg 到conf中 看一下文件中的路径是否和安装路径对应
写入
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/zookeeper-3.4.14/data
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.14/logs
clientPort=2181
- 1. 启动ZK服务: ./zkServer.sh start
- 2. 查看ZK服务状态: ./zkServer.sh status
- 3. 停止ZK服务: ./zkServer.sh stop
- 4. 重启ZK服务: ./zkServer.sh restart
ps -ef|grep zookeeper 查看
redis安装配置
mkdir /usr/redis
wget http://download.redis.io/releases/redis-2.8.3.tar.gz
tar xzf redis-2.8.3.tar.gz
cd redis-2.8.3
make
如果出现一下错误使用 make MALLOC=libc
cp redis.conf /usr/redis(注意更改redis的密码)
cd src/
cp redis-server /usr/redis
cp redis-benchmark /usr/redis
cp redis-cli /usr/redis
启动:
./redis-server redis.conf &
错误解决:
1. 如果提示:
[root@zengmg redis-2.8.3]# make
cd src && make all
make[1]: Entering directory `/usr/redis/redis-2.8.3/src'
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] 错误 127
make[1]: Leaving directory `/usr/redis/redis-2.8.3/src'
make: *** [all] 错误 2
[root@zengmg redis-2.8.3]# cd src/
[root@zengmg src]# make
CC adlist.o
/bin/sh: cc: command not found
make: *** [adlist.o] 错误 127
提示gcc命令未找到,这是因为redis没有安装gcc编译器没安装
这时候只要安装编译器即可
yum install -y gcc g++ gcc-c++ make
即可
2.权限不够chmod 777 redis或者chmod u+x redis-*
3.提示"libc.so.6: version `GLIBC_2.14' not found",原因是系统的glibc版本太低,软件编译时使用了较高版本的glibc引起的,查看CentOS 安装redis2.8.13 提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低 - 若水xp - 博客园解决
4.make: *** No targets specified and no makefile found. Stop.解决方法如下
1、wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
2.、tar zxvf ncurses-5.6.tar.gz
cd zxvf ncurses-5.6
3、 ./configure -prefix=/usr/local -with-shared-without-debug
4、make
5、make install
如果执行以上第3部的时候出现configure: error: no acceptable cc found in $PATH
则执行yum install gcc gcc-c++ gcc-g77
5.以下问题 使用 make MALLOC=libc 编译
nginx安装配置(手动编译,离线安装)
nginx、pcre、pcre环境资源:https://pan.baidu.com/s/17FVr7YdXpxkkmYgAYxf6OQ
提取码:zq1a
其他版本nginx下载地址:Index of /download/
解压 tar -zxvf nginx-1.9.12.tar.gz
cd /usr/local/nginx/
tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
yum install -y gcc gcc-c++
./configure
make
make install
cd ..
tar -xvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
tar -xvf nginx-1.9.12.tar.gz
vi nginx-1.9.12/conf/nginx.conf
cd ..
cd nginx-1.9.12
./configure
make
make install
cd ..
cd conf/
vim nginx.conf 修改nginx配置文件(注意配置文件中的静态路径的修改)
cd ..
cd sbin/
/usr/local/nginx/sbin/nginx -t (测试 nginx 是否正确)
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (启动)
ps -ef|grep nginx
vim /etc/profile
可配置nginx环境变量,直接调用nginx命令无需加路径
export PATH=$PATH:/usr/local/nginx/sbin
然后
source /etc/bashrc
(SSL配置教程:Nginx-SSL 多https证书配置 以及nginx常用配置、高可用负载均衡_ccyy-Csdn的博客-CSDN博客)
如果使用ssh配置
可能出现了以下错误:
错误为:./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题
yum -y install pcre-devel
还有可能出现:
错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
解决办法:
yum -y install openssl openssl-devel
nginx安装配置(yum在线安装)
1、添加Nginx源
第一种方式: 需要先安装epel-release 因为Nginx并不在官方的yum源中,需要第三方的yum源
#我们在Centos下使用yum安装时往往找不到rpm的情况,官方的rpm repository提供的rpm包也不够丰富,
#很多时候需要自己编译很痛苦,而EPEL恰恰可以解决这两方面的问题
yum -y install epel-release
#更新yum源
yum -y update
第二种方式: Nginx官网提供了Centos的源地址,可以如下执行命令添加源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2、 安装Nginx
yum install -y nginx
3、验证nginx安装是否成功
#查看nginx安装版本,-V可以看到nginx的安装的文件路径
nginx -V
# 查看安装的nginx的版本
rpm -qa | grep nginx
systemctl start nginx
systemctl enable nginx
systemctl status nginx
systemctl stop nginx
环境检查和部署安装:
1、java -version 如果没有可用jdk 则执行source /etc/profile 然后再看一下java -version
2、ps -ef|grep zookeeper 如果没有线程运行 则 运行/usr/local/zookeeper/zookeeper-3.4.14/bin/zkServer.sh start然后再看一下ps -ef|grep zookeeper
3、ps -ef|grep redis 如果没有线程运行 则/usr/redis/redis-server /usr/redis/redis.conf & 然后再看一下ps -ef|grep redis
4、ps -ef|grep nginx 如果没有线程运行 则运行/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf然后再看一下ps -ef|grep nginx
5、查看 MySQL Server 状态
systemctl status mysqld
如果没有启动就:
启动 MySQL Server
systemctl start mysqld
最后进入jar包目录 依次启动项目jar包
jar包启动命令如下:
注意:如果是生产,则 –spring.profiles.active=prod
nohup java -Xms10m -Xmx200m -jar xxx.jar
这个参数是java命令的参数,其他详细的细节可以看java的doc或者百度了。
nohup java -jar test-system-provider.jar --spring.profiles.active=stage > test-system-provider-temp.txt &
nohup java -jar test-scheduler-provider.jar--spring.profiles.active=stage > test-scheduler-provider-temp.txt &
nohup java -jar test-peixun-provider.jar--spring.profiles.active=stage > test-peixun-provider-temp.txt &
nohup java -jar test-system-web.jar--spring.profiles.active=stage > test-system-web-temp.txt &
nohup java -jar test-scheduler-web.jar--spring.profiles.active=stage > test-scheduler-web-temp.txt &
nohup java -jar test-general-web.jar –spring.profiles.active=stage > test-general-web.jar-temp.txt &
nohup java -jar test-peixun-web.jar--spring.profiles.active=stage > test-peixun-web-temp.txt &