相关文档

开发指南:https://hacpai.com/article/1493822943172
hexo 文章导入:https://hacpai.com/article/1498490209748

源码

源码获取

  1. git clone --recurse-submodules https://github.com/b3log/solo.git

建库

  1. CREATE DATABASE solo DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  2. -- 新增用户密码,%代表所有主机,也可以具体到你的主机ip地址
  3. CREATE USER 'solouser'@'%' IDENTIFIED WITH mysql_native_password BY 'solouser';
  4. CREATE USER 'solouser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'solouser';
  5. -- 查询用户
  6. select user, host, plugin, authentication_string from user;
  7. -- 删除用户
  8. Delete FROM USER Where user='solouser' ;
  9. -- 删除账户及权限:
  10. drop user solouser@'%';
  11. -- 授权
  12. GRANT ALL ON solo.* TO 'solouser'@'%';
  13. GRANT ALL ON solo.* TO 'solouser'@'localhost';
  14. -- 刷新权限,消除缓存的影响
  15. FLUSH PRIVILEGES;

环境准备

JDK,MySQLTomcat,Solo。

Solo war 包下载地址:https://github.com/b3log/solo/releases

Tomcat 下载地址:https://tomcat.apache.org/download-90.cgi

  1. # apt 获取的方式
  2. sudo apt-get update
  3. sudo apt-get install openjdk-8-jdk-headless
  4. java -version
  5. sudo apt-get install mysql-server
  6. sudo apt-get install mysql-client
  7. sudo netstat -tap | grep mysql
  8. mysql -u root -p
  9. CREATE DATABASE `solo` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
  10. CREATE USER 'solouser'@'%' identified BY 'solo@pwd';
  11. GRANT ALL ON solo.* TO 'solouser'@'%';
  12. FLUSH PRIVILEGES;
  13. wget https://github.com/b3log/solo/releases/download/v3.6.0/solo-v3.6.0.war
  14. wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.tar.gz

环境搭建

安装 Java

  1. # 下载包的方式
  2. tar -zxvf jdk-10.0.1_linux-x64_bin.tar.gz --directory=/mnt/blog

安装 Tomcat

  1. tar -zxvf apache-tomcat-8.0.23.tar.gz --directory=/mnt/apache

配置环境变量

  1. # 查询 Java 目录
  2. which java
  3. # 结果为:/usr/bin/java
  4. # 查软链接
  5. ls -l /usr/bin/java
  6. # 结果为 lrwxrwxrwx 1 root root 22 Apr 20 19:57 /usr/bin/java -> /etc/alternatives/java
  7. # 查 JDK 目录
  8. ls -l /etc/alternatives/java
  9. # 结果为 lrwxrwxrwx 1 root root 46 Apr 20 19:57 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
  10. # 则 JDK 目录为:/usr/lib/jvm/java-8-openjdk-amd64
  11. echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
  12. echo "export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
  13. echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
  14. echo "export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc

端口号修改

  1. vi ./conf/server.xml
  2. # 修改后需要重启
  3. ./bin/shutdown.sh
  4. ./bin/startup.sh
  5. # 查看 Tomcat 运行情况 加载db配置失败,会报错在这里
  6. /mnt/apache/apache-tomcat-8.0.23/bin/catalina.sh run

安装 solo 博客

  1. # 关闭 Tomcat
  2. ./bin/shutdown.sh
  3. # 复制 Solo war 包到 Tomcat 的 webapps 目录下
  4. cp solo-v3.6.0.war /mnt/apache/apache-tomcat-8.0.23/webapps/solo.war
  5. # 启动 Tomcat
  6. ./bin/startup.sh

参考:https://hacpai.com/article/1511246224528?m=0&p=1

https://hacpai.com/article/1511246224528?m=0&p=1

docker 安装

  1. CREATE USER 'solo'@'%' identified BY 'solo';
  2. GRANT ALL ON solo.* TO 'solo'@'%';
  3. FLUSH PRIVILEGES;
  1. # 拉取最新镜像
  2. docker pull b3log/solo
  3. # 安装 solo
  4. docker run --detach --name solo --network=host \
  5. --env RUNTIME_DB="MYSQL" \
  6. --env JDBC_USERNAME="solo" \
  7. --env JDBC_PASSWORD="solo" \
  8. --env JDBC_DRIVER="com.mysql.cj.jdbc.Driver" \
  9. --env JDBC_URL="jdbc:mysql://127.0.0.1:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC" \
  10. b3log/solo --listen_port=80 --server_scheme=http --server_host=yonglun.shop
  11. 启动参数说明:
  12. --listen_port:进程监听端口
  13. --server_scheme:最终访问协议,如果反代服务启用了 HTTPS 这里也需要改为 https
  14. --server_host:最终访问域名或公网 IP,不要带端口号

参考:https://github.com/b3log/solo