Ubuntu安装snipe-it笔记

Ubuntu安装snipe-it笔记
环境:

Ubuntu24.04.2,php8.3,IP:192.168.110.33  lsb_release -a查看版本

sudo -i进入root

sudo apt update 更新apt

apt upgrade   y同意    更新所有软件包

安装PHP8.3

安装PHP8.3所需的扩展(sudo apt install php8.3 -y)(php -v验证版本)

安装composer(安装程序脚本)

apt install -y

php-{bcmath,common,ctype,curl,fileinfo,fpm,gd,iconv,intl,mbstring,mysql,soap,xml,xsl,zip,cli}

wget-O composer-setup.php https://getcomposer.org/installer  #php snipeit是基于laravel的框架,依赖composer-setup.php管理器

php composer-setup.php --install-dir=/usr/local/bin --filename=composer此命令将告诉composer-s etup.php如何以及在何处安装composer 安放在/usr/local/bin下使得在终端的任何位置运行composer 使得其他的安装过程变得容易 composer -V验证安装

安装mariaDB服务器

apt install mariadb-server 从默认存储库安装mariaDB服务器  是否继续  y   

mysql_secure_installation    mysql的安全设置  切换到unix_socket身份验证  n等等太多了放截图

mysql进入mysql创建数据库用户   create database snipeit;     

grant all on snipeit.* to snipeit@localhost identified by ‘密码’;

flush privileges; 刷新数据库    exit;

安装nginx和相关必要配置

apt install nginx 安装nginx    y  接下来为nginx创建snipeit服务

nano /etc/nginx/conf.d/snipeit.conf

server {

    listen 80;

    server_name 192.168.110.33/snipeit.yourdomain.com;  #重点修改对象

    root /var/www/html/snipe-it/public;

     

    index index.php;

         

    location / {

        try_files $uri $uri/ /index.php?$query_string;

    }

     

    location ~ \.php$ {

 include fastcgi.conf;

        include snippets/fastcgi-php.conf;

        fastcgi_pass unix:/run/php/php8.3-fpm.sock;

 fastcgi_split_path_info ^(.+\.php)(/.+)$;

     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

     include fastcgi_params;

    }

} 写入退出即可

sudo nginx -t此命令告诉nginx在重新加载或重新启动前无需重新启动服务即可测试配置文件中是否存在任何语法问题,具体问题可以查看相关配置文件的语法

systemctl restart nginx重启nginx

下载安装snipe-it

sudo apt install git安装git   验证 git -v

git clone https://github.com/snipe/snipe-it snipe-it从github克隆源码

如果碰到某些安装不行,则可能是DNS解析有问题,需要修改/etc/hosts文件 在其中添加140.82.114.9(具有时效性)  (两个空格)https://codeload.github.com   若有其他网站解析有问题可以在网站https://www.ipaddress.com/查询IP

snipe-it的配置文件

接下来修改另一个重要的文件

cd /var/www/html/snipe-it进入snipe-it目录

cp .env.example .env复制example文件为.env

nano .env编辑

需要修改

APP_URL=http://192.168.110.33或者域名

APP_TIMEZONE=’Asia/Shanghai’

APP_LOCALE=’zh-CN’

DB_CONNECTION=mysql

DB_DATABASE=snipeit

DB_USERNAME=snipeit

DB_PASSWORD=你的密码

写入退出即可

设置系统的用户

接下来设置www-data可以访问更改这些设置

chown -R www-data: /var/www/html/snipe-it

chmod -R 755 /var/www/html/snipe-it

运行composer

接下来更新并安装插件和其他依赖项

composer update --no-plugins --no-scripts

composer install --no-dev --prefer-source --no-plugins --no-scripts

生成密钥

生成密钥nginx访问snipe-it的必要一步

php artisan key:generate

补充:

接下来就可以进入网站正常设置了,但是如果显示为英文且设置中的语言更改也不好使,则可以去数据库和php看看是否有问题

cd /etc/php/8.3/fpm/

nano php.ini查找default_charset = “UTF-8”   mbstring.language = Chinese

存储并离开,接下来去数据库看看用户的语言偏好

mysql

select id,username,first_name,last_name,locale from users;查找用户如果locale不是zh-CN就修改它

update users set locale=’zh-CN’ where id=用户名;

最后更新配置并重启服务

systemctl daemon-reload

systemctl restart nginx

可选做:

安装网站的ssl证书

sudo apt install certbot python3-certbot-nginx

sudo cerbot --nginx -d snipeit,zacs-tech.com     会提示你输入邮箱

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值