centos7搭建cachecloud

安装cachecloud

环境需求

jdk 7+(oracle jdk)(cachecloud使用java语言开发)
maven 3 (cachecloud使用maven 3 作为开发构建工具)
mysql 5.5+ (cachecloud需要redis的相关元信息进行持久化)
redis3.0以上

1.java安装

把安装包放到/opt,解压

配置环境变量

vi /etc/profile

export JAVA_HOME=/opt/jdk1.8
export CLASSPATH=.:$JAVA_HOME/lib

export PATH= $ JAVA_HOME/bin:$PATH

chmod -R 755 jdk1.8

source /etc/profile

java -version (如果正确显示jdk版本说明安装成功)

  1. 安装maven

下载安装包

wget http://apache.fayea.com/maven/maven-3/3.5.0/binaries/apache-maven-3.5.4-bin.tar.gz

tar xvf apache-maven-3.5.0-bin.tar.gz

vi /etc/profile

export MAVEN_HOME=/usr/local/maven/apache-maven-3.5.4
export PATH=$ JAVA_HOME/bin:$ MAVEN_HOME/bin:$PATH

source /etc/profile

mvn -version

  1. 安装mysql

先检查有没有安装mysql和mariadb

rpm -qa | grep mariadb

rpm -qa | grep -i mysql

有的话卸载(rpm -e --nodeps mariadb)

yum install libaio net-tools

rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm

启动mysql数据库

systemctl start mysqld.service

#找到进入数据库的初始密码

cat /var/log/mysqld.log | grep ‘password’

进入数据库

mysql -u root -p

修改密码策略(mysql5.7密码最低8位,包含大小写字母,特殊字符,数字等)

set global validate_password_policy=0;(修改密码策略为低级low)

set global validate_password_mixed_case_count=0;(密码至少要包含的小写字母个数和大写字母个数)

set global validate_password_special_char_count=0;(密码至少要包含的特殊字符数)

set global validate_password_length=3;(密码最小长度)

修改root密码

set password=password(“root”);

exit

安装cachecloud
https://www.cnblogs.com/wsl222000/p/6410233.html
http://www.cnblogs.com/cuchadanfan/p/7169919.html)

cd /opt/

git clone https://github.com/sohutv/cachecloud.git

表结构导入:
mysql> create database cachecloud character set utf8;
mysql> grant all on cachecloud.* to ‘admin’@‘localhost’ identified by ‘admin’;
mysql> flush privileges;
mysql> use cachecloud;
mysql> source /opt/cachecloud/script/cachecloud.sql;

exit

安装cachecloud
1.修改程序配置文件

cat /opt/cachecloud/cachecloud-open-web/src/main/resources/cachecloud-web.conf

PID_FOLDER=/opt/cachecloud-web
LOG_FOLDER=/opt/cachecloud-web/logs
LOG_FILENAME=cachecloud-web.log
APP_NAME=cachecloud-web
RUN_ARGS=
JAVA_HOME=/opt/jdk1.8
JAVA_OPTS="-server -Xmx1g -Xms1g -Xss256k -XX:MaxDirectMemorySize=1G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:G1ReservePercent=25
-XX:InitiatingHeapOccupancyPercent=40 -XX:+PrintGCDateStamps -Xloggc:/opt/cachecloud-web/logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/cachecloud-web/logs/java.hprof -XX:+DisableExplicitGC -XX:-OmitStackTraceInFastThrow
-XX:+PrintCommandLineFlags -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djava.util.Arrays.useLegacyMergeSort=true
-Dfile.encoding=UTF-8 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=22099 -Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

cat /opt/cachecloud/cachecloud-open-web/src/main/swap/online.properties

cachecloud.db.url = jdbc:mysql://本机ip:3306/cachecloud
cachecloud.db.user = admin
cachecloud.db.password = admin
cachecloud.maxPoolSize = 20

isClustered = true
isDebug = false
spring-file=classpath:spring/spring-online.xml
log_base=/opt/cachecloud-web/logs
web.port=8585
log.level=WARN

maven打包

在项目的根目录运行maven命令,该命令会进行项目的构建

pwd (/opt/cachecloud)

mvn clean compile install -Ponline

部署

sh /opt/cachecloud/script/deploy.sh /opt (cachecloud根目录在哪就写哪)

启动

# cd /opt/cachecloud-web/

sh start.sh

Starting the cachecloud …OK!
PID: 2643
STDOUT: /opt/cachecloud-web/logs/cachecloud-web.log

启动后可以执行如下操作观察启动日志

tail -f /opt/cachecloud-web/logs/cachecloud-web.log

注意需要将start.sh文件中程序的内存分配根据实际的情况分配,我这边是调整是1G的程序内存。
如果程序启动成功在浏览输入:http://本机ip:8585 进行访问,默认帐号密码都是admin。

你可能感兴趣的:(centos7搭建cachecloud)