在网上看到chemex的时候,感觉适合我们这种公司不大的IT管理人员,动手的时候发现博主只发表了AppNode的安装方式,由于公司内部的服务器上还有几个网站,不得已,自己东拼西凑出来的安装方法
原博主原文链接:Chemex: ☕ 咖啡壶是一个免费、开源、高效且漂亮的运维资产管理平台。软硬件资产管理、归属/使用者追溯、盘点以及可靠的服务器状态管理面板。基于优雅的Laravel框架和DcatAdmin开发。
1.更新源
sudo apt -y install software-properties-common apt-transport-https lsb-release ca-certificates
sudo add-apt-repository ppa:ondrej/php
sudo apt update
2.安装php和nginx (已安装的额忽略)
sudo apt-get install php8.0-mbstring php8.0-bz2 php8.0-bcmath php8.0-soap php8.0-gd php8.0-mysql php8.0-xmlrpc php8.0-dev php8.0-curl php8.0-xml php8.0-xsl php8.0-zip php8.0-fpm php8.0-gmp php8.0-cli php8.0-opcache nginx
3.安装 mysql
sudo apt-get install mariadb-server-10.3
4.创建数据库与用户
sudo mysql -uroot -p
CREATE DATABASE chemex;
GRANT ALL PRIVILEGES ON chemex.* TO chemex@"%" IDENTIFIED BY "chemed";
5.将从博主那里下载的zip包。上传到你服务器上,我为了好找,传到了/home下
xu@ubuntu:~$ ls
chemex-main chemex-main.zip Desktop Documents Downloads Music Pictures Public Templates Videos
xu@ubuntu:~$ pwd
/home/xu
xu@ubuntu:~$
6. 解压就不说了吧。zip 格式解压就好了。进到目录下,将chemex-main下的.env.example重新命名为.env
cd chemex-main/
sudo cp .env.example .env
7.编辑.env 文件,将名称,用户和密码改到与上面数据库一致的
sudo vim .env
### 第一步:数据库配置
DB_CONNECTION=mysql #数据库类型,不需要修改(兼容mariadb)
DB_HOST=127.0.0.1 # 数据库地址
DB_PORT=3306 # 数据库端口号
DB_DATABASE=chemex # 数据库名称
DB_USERNAME=chemex # 数据库用户名
DB_PASSWORD=chemex # 数据库密码
8.将chemex-main目录改为777权限,虽然不安全,但是后面会有log目录权限不足,
sudo chmod -R 777 chemex-main
9.在 chemex-main目录下运行
sudo php artisan migrate
sudo php artisan chemex:install
10.完成之后,会有提示admin的默认账号与密码。admin admin ,如有错误,参考第一步。
11.新建虚拟机,到nginx的目录在/etc/nginx/conf.d。创建目录test.conf
xu@ubuntu:~/chemex-main$ cd /etc/nginx/conf.d/
xu@ubuntu:/etc/nginx/conf.d$ ls
test.conf
xu@ubuntu:/etc/nginx/conf.d$
server {
listen 8090; #监听8090端口,接收http请求
server_name 192.168.70.48; #就是网站地址
index index.php index.html index.htm default.php default.htm default.html;
root /home/xu/chemex-main/public; # 路径指到/public下
#伪静态
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
#将nginx与php结合使用
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.0-fpm.sock; #php-fpm监听路径,可在/etc/php/8.0/fpm/pool.d/www.conf,查看。
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #也可以在/etc/nginx/下在fastcgi_param中增加。
include fastcgi_params;
}
}
12.重启服务
sudo service nginx restart
sudo service php8.0-fpm restart
13.登陆输入内网网址,与test.conf 里面的端口号。如:192.168.x.x:8090 。默认账号admin admin