安装mysql
#!/bin/bash
#yum
wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum -y install mysql80-community-release-el7-3.noarch.rpm
#mysql8.0
yum -y install mysql-community-server
systemctl enable --now mysqld.service
#mysql初始化
passwd=`grep password /var/log/mysqld.log | cut -d " " -f 13`
passwd2=Lang@zuo123.
passwd3=123456
echo $passwd
sleep 2
mysql --connect-expired-password -uroot -p${passwd} -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lang@zuo123.';"
mysql --connect-expired-password -uroot -p${passwd2} -e "set global validate_password.policy=0;set global validate_password.length=1;"
mysql --connect-expired-password -uroot -p${passwd2} -e "use mysql;ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';"
mysql --connect-expired-password -uroot -p${passwd3} -e "use mysql;update user set host = '%' where user = 'root';"
mysql --connect-expired-password -uroot -p${passwd3} -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';"
mysql -uroot -p${passwd3} -e "create database halodb character set utf8mb4 collate utf8mb4_bin;"
echo "mysql密码为passwd3"
安装nginx
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y install nginx
systemctl start nginx
systemctl enable nginx
Nginx的访问
#!/bin/bash
while echo 1 &>/dev/null ;do
cat /var/log/nginx/access.log | cut -d " " -f1 | sort | uniq -c | sort -nr >> /opt/nginx_ac.log
sleep 20m;
done
编辑
upstream halo {
server 127.0.0.1:8090 weight=1;
}
server {
listen 80;
listen [::]:80;
server_name www.yourdomain.com;
client_max_body_size 1024m;
location / {
proxy_pass http://halo;
index index.html index.html;
}
}
在 Linux 环境部署
CentOS
sudo yum install java-11-openjdk -y
检查版本:
java -version
如果输出以下类似内容即代表成功
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9-LTS, mixed mode, sharing)
安装
1.创建存放 运行包 的目录,这里以 ~/app
为例
mkdir ~/app && cd ~/app
2.下载运行包
wget https://dl.halo.run/release/halo-1.4.12.jar -O halo.jar
3.创建 工作目录
mkdir ~/.halo && cd ~/.halo
4.下载示例配置文件到 工作目录
wget https://dl.halo.run/config/application-template.yaml -O ./application.yaml
5.编辑配置文件,配置数据库或者端口等,如需配置请参考 参考配置
vim application.yaml
6.测试运行 Halo
cd ~/app
nohup java -jar halo.jar &
7.如看到类似以下日志输出,则代表启动成功。
run.halo.app.listener.StartedListener : Halo started at http://127.0.0.1:8090
run.halo.app.listener.StartedListener : Halo admin started at http://127.0.0.1:8090/admin
run.halo.app.listener.StartedListener : Halo has started successfully!
打开 http://ip: 端口号
即可看到安装引导界面。