Solo 博客搭建指南
作者:互联网
相关文档
开发指南:https://hacpai.com/article/1493822943172
hexo 文章导入:https://hacpai.com/article/1498490209748
源码
源码获取
git clone --recurse-submodules https://github.com/b3log/solo.git
建库
CREATE DATABASE solo DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 新增用户密码,%代表所有主机,也可以具体到你的主机ip地址
CREATE USER 'solouser'@'%' IDENTIFIED WITH mysql_native_password BY 'solouser';
CREATE USER 'solouser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'solouser';
-- 查询用户
select user, host, plugin, authentication_string from user;
-- 删除用户
Delete FROM USER Where user='solouser' ;
-- 删除账户及权限:
drop user solouser@'%';
-- 授权
GRANT ALL ON solo.* TO 'solouser'@'%';
GRANT ALL ON solo.* TO 'solouser'@'localhost';
-- 刷新权限,消除缓存的影响
FLUSH PRIVILEGES;
环境准备
JDK,MySQLTomcat,Solo。
Solo war 包下载地址:https://github.com/b3log/solo/releases
Tomcat 下载地址:https://tomcat.apache.org/download-90.cgi
# apt 获取的方式
sudo apt-get update
sudo apt-get install openjdk-8-jdk-headless
java -version
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo netstat -tap | grep mysql
mysql -u root -p
CREATE DATABASE `solo` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'solouser'@'%' identified BY 'solo@pwd';
GRANT ALL ON solo.* TO 'solouser'@'%';
FLUSH PRIVILEGES;
wget https://github.com/b3log/solo/releases/download/v3.6.0/solo-v3.6.0.war
wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.tar.gz
环境搭建
安装 Java
# 下载包的方式
tar -zxvf jdk-10.0.1_linux-x64_bin.tar.gz --directory=/mnt/blog
安装 Tomcat
tar -zxvf apache-tomcat-8.0.23.tar.gz --directory=/mnt/apache
配置环境变量
# 查询 Java 目录
which java
# 结果为:/usr/bin/java
# 查软链接
ls -l /usr/bin/java
# 结果为 lrwxrwxrwx 1 root root 22 Apr 20 19:57 /usr/bin/java -> /etc/alternatives/java
# 查 JDK 目录
ls -l /etc/alternatives/java
# 结果为 lrwxrwxrwx 1 root root 46 Apr 20 19:57 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
# 则 JDK 目录为:/usr/lib/jvm/java-8-openjdk-amd64
echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
echo "export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
echo "export JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
端口号修改
vi ./conf/server.xml
# 修改后需要重启
./bin/shutdown.sh
./bin/startup.sh
# 查看 Tomcat 运行情况 加载db配置失败,会报错在这里
/mnt/apache/apache-tomcat-8.0.23/bin/catalina.sh run
安装 solo 博客
# 关闭 Tomcat
./bin/shutdown.sh
# 复制 Solo war 包到 Tomcat 的 webapps 目录下
cp solo-v3.6.0.war /mnt/apache/apache-tomcat-8.0.23/webapps/solo.war
# 启动 Tomcat
./bin/startup.sh
参考:https://hacpai.com/article/1511246224528?m=0&p=1
https://hacpai.com/article/1511246224528?m=0&p=1
docker 安装
CREATE USER 'solo'@'%' identified BY 'solo';
GRANT ALL ON solo.* TO 'solo'@'%';
FLUSH PRIVILEGES;
# 拉取最新镜像
docker pull b3log/solo
# 安装 solo
docker run --detach --name solo --network=host \
--env RUNTIME_DB="MYSQL" \
--env JDBC_USERNAME="solo" \
--env JDBC_PASSWORD="solo" \
--env JDBC_DRIVER="com.mysql.cj.jdbc.Driver" \
--env JDBC_URL="jdbc:mysql://127.0.0.1:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC" \
b3log/solo --listen_port=80 --server_scheme=http --server_host=yonglun.shop
启动参数说明:
--listen_port:进程监听端口
--server_scheme:最终访问协议,如果反代服务启用了 HTTPS 这里也需要改为 https
--server_host:最终访问域名或公网 IP,不要带端口号
参考:https://github.com/b3log/solo
标签:指南,Solo,java,solo,--,solouser,https,bin,搭建 来源: https://blog.csdn.net/u013129932/article/details/121301877