部署snipe-it资源管理系统

 [root@www ~]# ls nginx-1.12.2.tar.gz

nginx-1.12.2.tar.gz

[root@www ~]# yum -y install pcre-devel zlib-devel popt-devel openssl-devel openssl

[root@www ~]# useradd -M -s /sbin/nologin nginx

[root@www ~]#tar zxvf /root/nginx-*.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/nginx-*/

[root@www nginx-1.12.2]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-file-aio --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_ssl_module --with-pcre

[root@www nginx-1.12.2]# make && make install

[root@www nginx-1.12.2]# ls /usr/local/nginx/

conf  html  logs  sbin

[root@www nginx-1.12.2]# cd

[root@www ~]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/

[root@www ~] ln -s /usr/local/nginx/bin/* /usr/local/bin/

[root@www ~]# vi /etc/init.d/nginx

#!/bin/bash

#chkconfig: - 99 20

A="/usr/local/nginx/sbin/nginx"

B="/usr/local/nginx/logs/nginx.pid"

case "$1" in

start)

$A

if [ $? -eq 0 ];then

echo "nginx is start"

else

echo "nginx start bad"

fi

;;

stop)

kill -s QUIT $(cat $B)

if [ $? -eq 0 ];then

echo "nginx is stop"

fi

;;

restart)

kill -s QUIT $(cat $B)

if [ $? -eq 0 ];then

echo "nginx is stop"

fi

$A

if [ $? -eq 0 ];then

echo "nginx is start"

else

echo "nginx start bad"

fi

;;

reload)

 kill -s HUP $(cat $NPF)

    if [ $? -eq 0 ]

    then

      echo "nginx config file is reload! "

    fi

  ;;

*)

 echo "Usage: $0 {start|stop|restart|reload}"

    exit 1

esac

exit 0

:wq

[root@www ~]# chmod +x /etc/init.d/nginx

[root@www ~]# chkconfig --add nginx

[root@www ~]# chkconfig nginx on

[root@www ~]# echo "www.linuxfan.cn" >/usr/local/nginx/html/index.html

[root@www ~]# chmod 755 -R /usr/local/nginx/

[root@www ~]# /etc/init.d/nginx start

nginx is start

[root@www ~]# netstat -utpln |grep 80

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3716/nginx: master

  • 测试访问Nginx服务的静态页面;

 

 

  • 安装Mysql 5.7数据库;

[root@www ~]# yum -y install ncurses ncurses-devel bison libcrypt perl cmake

[root@www ~]# ls boost_1_59_0.tar.gz

boost_1_59_0.tar.gz

[root@www ~]# tar zxvf boost_1_59_0.tar.gz

[root@www ~]# mv boost_1_59_0 /usr/local/boots

[root@www ~]# ls mysql-5.7.12.tar.gz

mysql-5.7.12.tar.gz

[root@www ~]# tar zxvf mysql-5.7.12.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/mysql-5.7.12/

[root@www mysql-5.7.12]# useradd -r mysql

[root@www mysql-5.7.12]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boots -DSYSCONFDIR=/etc

[root@www mysql-5.7.12]# echo $?

0

[root@www mysql-5.7.12]# make && make install

[root@www mysql-5.7.12]# cd

[root@www ~]# ls /usr/local/mysql/

bin  COPYING  docs  include  lib  man  mysql-test  README  share  support-files

  • 初始化配置Mysql5.7数据库;

[root@www ~]# chown mysql:mysql /usr/local/mysql/ -R

[root@www ~]# cp /usr/src/mysql-5.7.12/support-files/my-default.cnf /etc/my.cnf

cp:是否覆盖"/etc/my.cnf"y

[root@www ~]# cp /usr/src/mysql-5.7.12/support-files/mysql.server /etc/init.d/mysqld

[root@www ~]# chmod +x /etc/init.d/mysqld

[root@www ~]# ln -s /usr/local/mysql/bin/* /usr/local/bin/

[root@www ~]# vi /usr/lib/systemd/system/mysqld.service

[Unit]

Description=mysqlapi

After=network.target

[Service]

Type=forking

PIDFile=/usr/local/mysql/logs/mysqld.pid

ExecStart=/etc/init.d/mysqld start

ExecReload=/etc/init.d/mysqld restart

ExecStop=/etc/init.d/mysqld stop

PrivateTmp=Flase

[Install]

WantedBy=multi-user.target

:wq

[root@www ~]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data

[root@www ~]# echo $?

0

[root@www ~]# vi /etc/my.cnf

[mysqld]

basedir = /usr/local/mysql

datadir = /usr/local/mysql/data

port = 3306

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

character_set_server=utf8

init_connect='SET NAMES utf8'

log-error=/usr/local/mysql/logs/mysqld.log

pid-file=/usr/local/mysql/logs/mysqld.pid

:wq

[root@www ~]# mkdir /usr/local/mysql/logs

[root@www ~]# chown mysql:mysql /usr/local/mysql/logs

[root@www ~]# systemctl start mysqld

[root@www ~]# netstat -utpln |grep 3306

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      22756/mysqld

[root@www ~]# mysqladmin -uroot password '123123'

mysqladmin: [Warning] Using a password on the command line interface can be insecure.

Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

[root@www ~]# mysql -uroot -p123123

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or g.

Your MySQL connection id is 3

Server version: 5.7.12 Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> exit

  • 安装PHP的依赖关系;

[root@www ~]# ls mcrypt-2.6.8.tar.gz libmcrypt-2.5.8.tar.gz mhash-0.9.9.9.tar.gz

libmcrypt-2.5.8.tar.gz  mcrypt-2.6.8.tar.gz  mhash-0.9.9.9.tar.gz

[root@www ~]# tar zxvf libmcrypt-2.5.8.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/libmcrypt-2.5.8/

[root@www libmcrypt-2.5.8]# ./configure && make && make install

[root@www libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt* /usr/lib64/

[root@www libmcrypt-2.5.8]# cd

[root@www ~]# tar zxvf mhash-0.9.9.9.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/mhash-0.9.9.9/

[root@www mhash-0.9.9.9]# ./configure && make && make install

[root@www mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.* /usr/lib64/

[root@www mhash-0.9.9.9]# cd

[root@www ~]# tar zxvf mcrypt-2.6.8.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/mcrypt-2.6.8/

[root@www mcrypt-2.6.8]# ./configure && make && make install

[root@www mcrypt-2.6.8]# cd

[root@www ~]# yum -y install libxml2-devel bzip2-devel libmcrypt-devel gd libjpeg libjpeg-devel libpng libpng-devel openssl openssl-devel libcurl libcurl-devel openldap-devel

 

  • 安装并配置PHP程序:

[root@www ~]# ls php-7.1.5.tar.gz

php-7.1.19.tar.gz

[root@www ~]# tar zxvf php-*.tar.gz -C /usr/src/

[root@www ~]# cd /usr/src/php-7.1.19/

[root@www ~]#cp -frp /usr/lib64/libldap* /usr/lib/

[root@www php-7.1.19]# ./configure --prefix=/usr/local/php/ --enable-mysqlnd --with-mysqli --enable-mbstring --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --with-mcrypt --with-config-file-path=/etc --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql --enable-fpm  --with-fpm-user=nginx --with-fpm-group=nginx --with-jpeg-dir=/usr/lib64/ --enable-pdo --enable-libxml --with-openssl --enable-mbstring --with-gd --with-curl=/usr/local/php/  --enable-bcmath  --enable-zip --with-ldap

[root@www php-7.1.19]# make && make install

[root@www php-7.1.19]# vi /usr/src/php-7.1.5/Makefile

110 EXTRA_LIBS = -lcrypt -lz -lresolv -lcrypt -lrt -lmcrypt -lldap -lpng -lz -ljpeg -lcur        l -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcurl -lxml2 -lz -lm -l        dl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm         -ldl -lssl -lcrypto -lcrypt -llber

[root@www php-7.1.19]# make && make install

[root@www php-7.1.19]# cd

[root@www ~]# cp /usr/src/php-7.1.5/php.ini-development /usr/local/php/php.ini

[root@www ~]# vi /usr/local/php/php.ini

    197 short_open_tag = On

   1170 mysqli.default_socket = /tmp/mysql.sock

    939 date.timezone = Asia/Shanghai

:wq

[root@www ~]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

##定义fpm管理器的配置

[root@www ~]# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf ##定义关于网站的cgi管理配置

[root@www ~]#ln -s /usr/local/php/sbin/* /usr/local/sbin/

[root@yy ~]#  ln -s /usr/local/php/bin/* /usr/local/bin/

[root@yy ~]#  php-fpm

[root@www ~]# netstat -utpln |grep php

tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      29073/php-fpm: mast

  • 配置nginx支持php请求页面;

[root@www ~]# vi /usr/local/nginx/conf/nginx.conf

     47         location ~ .php$ {

     48             root   /usr/local/nginx/html;

     49             fastcgi_pass 127.0.0.1:9000;

     50             fastcgi_index index.php;

     51             include fastcgi.conf;

     52         }

:wq

[root@www ~]# ls /usr/local/nginx/conf/fastcgi.conf ##cgi接口的配置文件

/usr/local/nginx/conf/fastcgi.conf

[root@www ~]# /etc/init.d/nginx stop

nginx is stop

[root@www ~]# /etc/init.d/nginx start

nginx is start

[root@www ~]# netstat -utpln |grep 80

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      29086/nginx: master

  • 编辑nginxphp测试网页文件;

[root@www ~]# cat <<END >>/usr/local/nginx/html/index.php

<?php

phpinfo();

?>

END

  • 客户端访问nginxphp网页进行测试;

部署snipe-it

[root@yy ~]# ls

snipe-it-4.7.4.tar.gz

mysql -uroot -p123123

mysql> create database example;

mysql> use example;

grant all privileges on example.* to example@localhost identified by 'example';

flush privileges;

[root@yy ~]# tar xvf snipe-it-4.7.4.tar.gz -C /usr/local/nginx/html/

[root@yy ~]# cd /usr/local/nginx/html/

[root@yy html]# ls

50x.html  index.html  index.php   snipe-it-4.7.4

[ root@yy html]# mv snipe-it-4.7.4/ snipeit

[root@yy html]# cd snipeit/

[root@yy snipeit]# curl -sS https://getcomposer.org/installer | php

[root@yy snipeit]# php composer.phar install --no-dev

[root@yy snipeit]# chown -R nginx:nginx /usr/local/nginx/html/snipeit/

[root@yy snipeit]# chmod -R 777 /usr/local/nginx/html/snipeit/

[root@yy snipeit]# cp .env.example .env

[root@yy snipeit]# vi .env

16 DB_DATABASE=example

17 DB_USERNAME=example

18 DB_PASSWORD=example

 

 

[root@yy snipeit]# php artisan key:generate

**************************************

*     Application In Production!     *

**************************************

 

 Do you really wish to run this command? (yes/no) [no]:

 > yes

 

Application key [base64:aubRnWpGOUCz8G+huWOMShL2EAyql2FV8Q5y3PS86AQ=] set successfully.

vi /usr/local/nginx/conf/nginx.conf

server {

        listen       80;

        server_name  localhost;

         root /usr/local/nginx/html/snipeit/public;

        index index.php index.html index.htm;

        location / {

                try_files $uri $uri/ /index.php$is_args$args;

        }

        location ~ .php$ {

        try_files $uri $uri/ =404;

                fastcgi_pass 127.0.0.1:9000;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        include fastcgi_params;

        }

    }

}

 

这个可以不设置

 

[root@yy snipeit]# vi /usr/local/nginx/html/snipeit/config/app.php

50     'debug' => env('APP_DEBUG', true),

[root@yy snipeit]# vi .env

5 APP_DEBUG=true

 

打开安装网页

 

安装完成后的效果

原文地址:https://www.cnblogs.com/linuxys/p/12987459.html