0 install jdk8
Download and install jdk8
https://www.oracle.com/java/technologies/jdk8-downloads.html
Example, the jdk is located at /usr/lib/jvm/java-8-openjdk-amd64
1 install maven
1) for linux, like ubuntu, you can run
sudo apt-get install maven
/usr/share/maven/
2) for windows
please refer baidu/google/bing
3)configuration
11) # 解压maven
cd /usr/local
tar zxvf apache-maven-3.3.9-bin.tar.gz
22) # 设置环境变量
vi /etc/profile #增加下列配置
export MAVEN_HOME=/usr/local/apache-maven-3.3.9
export PATH=${MAVEN_HOME}/bin:${PATH}
33) # 配置好maven仓库,这里推荐一个阿里云的maven镜像
vi /usr/local/apache-maven-3.3.9/conf/settings.xml
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
2 config environment
1) for linux
Vi ~/.bashrc
Add below data to ~/.bashrc
export MAVEN_HOME=/usr/share/maven
export PATH=${MAVEN_HOME}/bin:${PATH}
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${JAVA_HOME}/bin:${PATH}
2)for windows
please refer baidu/google/bing
3 install phantomjs
Get and download from
https://phantomjs.org/download.html
4 install and start tomcat
- Download from https://tomcat.apache.org/download-90.cgi
- tar -xzvf apache-tomcat-9.0.24.tar.gz
- cd apache-tomcat-9.0.24/bin
- sudo ./startup.sh
- Check localhost:8080
sudo ./shutdown.sh to stop tomcat
vi apache-tomcat-9.0.24/conf/server.xml to change the port 8080 to others
For windows, only need to use startup.bat/shutdown.bat
CBoard日志乱码问题:
修改 tomcat/conf/logging.properties
- 将配置UTF-8那一行配置删除(这样应该就是采用操作系统默认编码,Windows下即为GBK)
- 或者 将UTF-8改为GBK
5 install mysql5.7 and start
5.1 linux
Follow https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ to install and start
1) login mysql (http://blog.sina.com.cn/s/blog_7c987bee0102yz76.html)
> sudo mysql -uroot -p
2) change password
format:mysql> set password for [email protected] = password(‘new password’);
example:mysql> set password for [email protected] = password(‘123’);
3) import sql files
> source /local/cboard/CBoard/sql/mysql/mysql.sql
5.2 windows
install mysql
refer to https://blog.csdn.net/fengchen0123456789/article/details/78604987
注意:第三步时,要在bin的上级目录执行
第四步时,my.ini 要放在data目录所在的目录
第五步,要以管理员身份起到cmd
E:\web\mysql-5.7.27-winx64\bin>net stop mysql
net start mysql
6 install and start redis
if you want to use redis, you can install redis
# > Sudo apt-get install redis
Start redis
#> service redis start
#> service redis status
7 download and install cboard
7.1 get code
#> git clone https://github.com/yzhang921/CBoard.git
git checkout branch-0.4.2
7.2 build
refer to https://juejin.im/post/5b4ee1c2f265da0f5d4cc978
- 修改配置文件
vi src/main/resources/config.properties
validationQuery=SELECT 1
jdbc_url=jdbc:mysql://localhost:3306/cboard
//jdbc:mysql://localhost:3306/bookstore?serverTimezone=UTC
// jdbc:mysql://localhost:3306/bookstore?useUnicode=true&characterEncoding=UTF-8
jdbc_username=root
jdbc_password=123
##mysql 的用户名和密码
#因为不用sqlserver, 注释掉即可
#jdbc_url=jdbc:sqlserver://192.168.86.156:1433;databaseName=CBoard_Test
#jdbc_username=uapp_cboard
#jdbc_password=uapp_cboard
# Service configuration
dataprovider.resultLimit=1000000
admin_user_id=1
phantomjs_path=E:\web\phantomjs-2.1.1-windows\bin\phantomjs.exe
## 设置为phantomjs所在的路径
# Cache Properties 如果不用redis, 注释掉即可
#cache.redis.hostName=127.0.0.1
#cache.redis.port=6379
- 设置平台默认语言
vi src/main/resources/config.properties
# 修改参数为cn
// CBoard settings
var settings = {
preferredLanguage: "en" // 可选值en/cn: cn切换中文
}
3) 删除sqlserver的jdbc驱动
vi pom.xml
删除下面的内容
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
4)build
mvn clean package
生成的package在 CBoard/target/cboard.war
7.3 start
copy CBoard\target\cboard.war to tomat 的webapps目录
apache-tomcat-9.0.24/webapps
and restart tomcat
E:\web\apache-tomcat-9.0.24\bin> shutdown.bat; startup.bat
8 使用cboard
Login http://localhost:8080/cboard in chrome browser
默认登录用户名和密码: admin/root123
登录后,页面如下图所示