医疗网站优化怎么做,化妆品备案查询入口,域名备案信息查询官网,大连哪个企业想做网站文章目录 参考链接一、写在前二、安装操作系统三、安装 PHP四、下载 Snipe-IT五、安装依赖六、安装数据库并创建用户七、安装 Snipe-IT八、安装 Nginx九、Web 继续安装 Snipe-IT补充#xff1a;20250427补充#xff1a; 最后 参考链接
How to Install Snipe-IT on Ubuntu 22… 文章目录 参考链接一、写在前二、安装操作系统三、安装 PHP四、下载 Snipe-IT五、安装依赖六、安装数据库并创建用户七、安装 Snipe-IT八、安装 Nginx九、Web 继续安装 Snipe-IT补充20250427补充 最后 参考链接
How to Install Snipe-IT on Ubuntu 22.04 https://www.rosehosting.com/blog/how-to-install-snipe-it-on-ubuntu-22-04/ 官方手册https://snipe-it.readme.io/v7.1.17/docs/installation IT打工人利器推荐两款开源的公司固定资产管理工具 https://cloud.tencent.com/developer/article/2407425 在安装snipe-it中遇到的坑 https://www.cnblogs.com/mingxi/p/18293822 一、写在前
踩的坑多了悟出的心得 a.安装前一定要先找官方文档查看软件的依赖环境以及软件对应的版本信息 b.我使用的官方教程默认克隆的最新版教程里写的是PHP8.1即可但其实最新版需要的是PHP8.2所以导致安装失败
二、安装操作系统
建议选择最小化安装系统安装过程略
apt install net-tools -y
apt -y install wget
apt install psmisc -y
apt install vim -y
apt install unzip -y
apt install curl -y
apt install git -y
apt update -y查看系统版本
三、安装 PHP
根据Snipe-IT文档页面v7.1.17版本要求PHP版本在8.1及以上。Ubuntu 22.04附带了PHP 8.1.2。在这一步中我们将直接安装PHP 8.1以及所需的扩展。
# apt install php8.1-{bcmath,common,ctype,curl,fileinfo,fpm,gd,iconv,intl,mbstring,mysql,soap,xml,xsl,zip,cli}四、下载 Snipe-IT
使用下面的命令导航到您的Web服务器的根目录。没有就新建
cd /var/www/html然后克隆Snipe-IT GitHub仓库并使用下面的命令将内容保存到snipe-it目录中。
git clone https://github.com/snipe/snipe-it snipe-it
//一定要注意上面克隆的是最新版8.0.3ubuntu版本仓库默认的PHP版本不支持
//使用git回退版本
git clone --branch v7.1.17 https://github.com/snipe/snipe-it.git snipe-it //此操作回退的是标签不能当做安装包使用需要创建分支//创建分支
git switch -c snipe-it-v7.1.17
//有的说回退版本
git checkout v7.1.17 //没尝试五、安装依赖
Composer是一个PHP包管理器它允许我们管理我们在Snipe-IT中使用的各种供应商包的依赖关系。供应商包是其他人编写的PHP库我们在Snipe-IT中使用它。 不需要全局安装composer第一组命令主要用于全局安装 Composer而第二组命令用于项目内安装 Composer 并安装项目依赖。如果你需要在多个项目中使用 Composer全局安装更为方便如果希望每个项目有独立的 Composer 环境避免不同项目之间的依赖冲突项目内安装是更好的选择。
cd /var/www/html/snipeit/
curl -sS https://getcomposer.org/installer -o composer-setup.php
php composer-setup.php --install-dir/usr/local/bin --filenamecomposercd /var/www/html/snipeit/
curl -sS https://getcomposer.org/installer | php
php composer.phar install --no-dev --prefer-source
要检查Composer版本可以运行以下命令
# composer -V六、安装数据库并创建用户
Snipe-IT基于Laravel 8框架。虽然Laravel支持MySQL/MariaDB、PostgreSQL、SQLite和MSSQL但Snipe-IT只支持MySQL/MariaDB。在这一步中我们将从默认存储库安装MariaDB服务器。要安装MariaDB服务器执行以下命令
apt install mariadb-server -y
//创建数据库
mysql
mysql CREATE DATABASE snipeit;
mysql show databases;
mysql create user snipeit;
mysql GRANT ALL ON snipeit.* TO snipeitlocalhost identified by 1qazWSX;
mysql FLUSH PRIVILEGES;
mysql \q七、安装 Snipe-IT
cd /var/www/html/snipe-it
cp .env.example .env
vim .env输入您的应用程序URL和时间区
APP_URLhttp://172.0.0.110
APP_TIMEZONEAsia/Shanghai
APP_LOCALEzh-CN然后在数据库设置下输入您的数据库凭据
DB_CONNECTIONmysql
DB_HOST127.0.0.1
DB_PORT3306
DB_DATABASEsnipeit
DB_USERNAMEsnipeit
DB_PASSWORD1qazWSX
DB_PREFIXnull设置Snipe-IT数据目录的所有权和权限。
# chown -R www-data: /var/www/html/snipe-it
# chmod -R 775 /var/www/html/snipe-it接下来更新Snipe-IT依赖项。
# composer update --no-plugins --no-scripts更新Composer后我们需要执行以下命令来安装所有应用程序依赖。(我对这步表示疑惑但还是执行了)
# composer install --no-dev --prefer-source --no-plugins --no-scripts在/var/www/snipe-it/。使用下面的命令生成Laravel APP Key-value。系统会自动把key填充到.env文件中。
# php artisan key:generate八、安装 Nginx
Laravel支持多种web服务器如Apache、Nginx或Litespeed。在这一步中我们将安装和配置nginx。让我们先安装它然后继续下一步。
# apt install nginx安装后nginx将自动启动并且它已经配置为在重新启动时运行。所以我们可以继续为我们的Snipe-IT网站创建一个新的nginx服务器块。
vim /etc/nginx/conf.d/snipeit.conf在文件中插入以下内容并确保将snipeit.yourdomain.com替换为指向服务器IP地址的实际域名或子域名。
server {listen 80;server_name 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.1-fpm.sock;fastcgi_split_path_info ^(.\.php)(/.)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
}保存文件然后退出。我们需要重新启动nginx来应用我们所做的更改。
# systemctl restart nginx九、Web 继续安装 Snipe-IT
此时我们可以导航到http://172.0.0.110并通过web浏览器继续安装。 这一步如果访问失败页面显示500那大概率是安装包权限问题 新建一个用户useradd snipeit 并刷新安装包权限已反复测试有效
chwon -R snipeit:www-data snipe-it
chmod -R 775 snipe-it/然后重启再尝试 Next 已创建数据库表现在单击Next: Create User继续。 单击下一步保存用户 到这里已安装完毕 至于更精细化的设置LDAP、中文、使用技巧等等。请详询官手册
补充
由于我的英文实在不好这里我选择切换成中文。 切换中文的地方有两处第一处生效了
20250427补充
部署过程中要访问大量的github网站大概率会因网络不同报错。不妨添加下面映射到你的hosts中给github加加速记得取消注释
#185.199.108.154 github.githubassets.com
#140.82.113.22 central.github.com
#185.199.108.133 desktop.githubusercontent.com
#185.199.108.153 assets-cdn.github.com
#185.199.108.133 camo.githubusercontent.com
#185.199.108.133 github.map.fastly.net
#199.232.69.194 github.global.ssl.fastly.net
#140.82.113.3 gist.github.com
#185.199.108.153 github.io
#140.82.114.4 github.com
#140.82.112.6 api.github.com
#185.199.108.133 raw.githubusercontent.com
#185.199.108.133 user-images.githubusercontent.com
#185.199.108.133 favicons.githubusercontent.com
#185.199.108.133 avatars5.githubusercontent.com
#185.199.108.133 avatars4.githubusercontent.com
#185.199.108.133 avatars3.githubusercontent.com
#185.199.108.133 avatars2.githubusercontent.com
#185.199.108.133 avatars1.githubusercontent.com
#185.199.108.133 avatars0.githubusercontent.com
#185.199.108.133 avatars.githubusercontent.com
#140.82.113.9 codeload.github.com
#52.217.88.28 github-cloud.s3.amazonaws.com
#52.216.238.99 github-com.s3.amazonaws.com
#52.216.26.252 github-production-release-asset-2e65be.s3.amazonaws.com
#52.217.101.68 github-production-user-asset-6210df.s3.amazonaws.com
#52.217.48.84 github-production-repository-file-5c1aeb.s3.amazonaws.com
#185.199.108.153 githubstatus.com
#64.71.168.201 github.community
#185.199.108.133 media.githubusercontent.com再或者你可以添加阿里的网站试试
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/如果频繁出现
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head here to retrieve a token:
https://github.com/settings/tokens/new?scopesdescriptionComposeronsnipeit2025-04-270829
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to:
https://github.com/settings/tokens/new?scopesrepodescriptionComposeronsnipeit2025-04-270829
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in /root/.config/composer/auth.json for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):这通常是因为你的项目依赖于私有 GitHub 仓库而 Composer 需要适当的认证信息来访问这些仓库。 生成 GitHub 访问令牌 仅访问公共仓库 访问 GitHub Token 创建页面。 我也不懂跟着感觉选择 点击 “Generate token” 生成令牌。 访问私有仓库 访问 GitHub Token 创建页面。 我也不懂跟着感觉选择 点击 “Generate token” 生成令牌。 composer config --global github-oauth.github.com ghp_********************bTOog2ZT8G4
接着执行即可 最后
上面执行的顺序我有所调整如果你在安装过程中遇到问题请留言。
如果成了给个赞鼓励一下。