0%

在Ubuntu下安装Blessing Skin Server

安装环境

操作系统:Ubuntu 20.04.3

“安装环境”还是“安装”环境呢

添加 PHP 8.1.2 相关的软件源

目前 Ubuntu 20.04 的软件源里并没有 8.0 以上版本的 PHP,所以需要添加非官方源

1
2
~# add-apt-repository ppa:ondrej/php
~# add-apt-repository ppa:ondrej/apache2

更新索引并升级

1
2
~# apt update
~# apt upgrade

安装 Apache2 和 PHP 8.1.2

目前 Ubuntu 20.04 的软件源里添加非官方源

1
~# apt install apache2 php8.1

安装必要的 PHP 插件

1
~# apt install php8.1-mysql php8.1-mbstring php8.1-gd php8.1-xml php8.1-zip

启用 RewriteEngine

1
~# a2enmod rewrite

安装并配置 MySQL

安装

1
~# apt install mysql-server mysql-client

为皮肤站创建一个数据库

1
2
~# mysql
mysql> create database blessingskin;

为皮肤站创建一个用户

1
mysql> create user 'blessing'@'localhost' identified by 'blessingskin';

为用户 blessing 分配数据库 blessingskin 的权限

1
mysql> grant all on blessingskin.* to 'blessing'@'localhost';

重新加载权限表

1
mysql> flush privileges;

安装 Blessing Skin Server 6.0.0-rc.2

下载

1
~$ wget https://gitee.com/snowmoonss/blessing-skin-server/attach_files/965315/download/blessing-skin-server-6.0.0-rc.2.zip

解压到 /var/www/bs

1
~# unzip blessing-skin-server-6.0.0-rc.2.zip -d /var/www/bs

复制配置文件

1
2
~$ cd /var/www/bs
/var/www/bs# cp .env.example .env

生成 app key

1
/var/www/bs# php artisan key:generate

更改目录所有者为 Apache2 的运行账户

1
~# chown -R www-data. bs

复制一份示例站点的配置文件并保存为 bs.conf

1
2
/var/www/bs$ cd /etc/apache2/sites-available
/etc/apache2/sites-available# cp 000-default.conf bs.conf

编辑 bs.conf,我这里用的是 vim 编辑器,可以使用自己手熟

1
/etc/apache2/sites-available# vim bs.conf

ServerAdmin 按需修改,服务器出现某些错误的时候会显示在页面上 DocumentRoot 改为 /var/www/bs/public,也就是刚才解压到的文件夹 ErrorLogCustomLog 按需修改 经我测试,AllowOverride FileInfo 会报错(来源)

1
/var/www/bs/public/.htaccess: Options not allowed here

我太菜了,无法得知还需要什么权限,遂 All 了:

1
2
3
<Directory /var/www/bs>
AllowOverride All
</Directory>

最后的配置文件就是这样的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin serveradmin@example.com
DocumentRoot /var/www/bs/public

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error-bs.log
CustomLog ${APACHE_LOG_DIR}/access-bs.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

<Directory /var/www/bs>
AllowOverride All
</Directory>
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

更加进阶的内容还请自行探究

关闭 Apache2 自带的示例站点,启用配置好的 bs.config 并重新加载 Apache2 配置文件

1
2
3
/etc/apache2/sites-available# a2dissite 000-default.conf
/etc/apache2/sites-available# a2ensite bs.conf
/etc/apache2/sites-available# systemctl restart apache2

启动!

第一次打开的界面应该是这样的: 欢迎 此时单击**下一步** 然后填写数据库信息,相信刚才创建数据库的时候有记住都干了些什么吧: 填写数据库信息 按照提示填写就行: 填写信息 恭喜你,安装成功! 安装成功