Install snipe-it on CentOS 7
南宫俊逸2019-11-12服务部署1356 浏览
Install snipe-it on CentOS 7
Introduction:
Snipe-IT is a free open source IT asset management web application. It is a free open source IT asset management system based on Laravel 5.4. Snipe-IT is used for IT asset management, which allows IT departments to track who owns laptops, when they buy, which software licenses and available accessories. Key features: Hosted on cloud hosts, powerful REST APIs, fast updates, secure APP and Platform, one-click backup, LDAP login/user synchronization.
Environmental preparation:
1. the operating system:
Centos7.6: CentOS Linux release 7.6.1810 (Core)
2. Apache
This system is built using Apache2.4.6
3. PHP
This system is built using PHP7.2
4. Database
The database version used by this system is: Mariadb5.5.60
Start install:
1.Update system
$sudo yum update -y
2.Install Apache 2.4.6 using yum
$sudo yum install -y httpd httpd-devel
View the installation version
$sudo httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Aug 8 2019 11:41:18
3.Install the Mariadb database using yum
$sudo yum install -y mariadb mariadb-server
4.Source code to install PHP, configure Apache support
The dependency environment required to install PHP:
$sudo yum install -y make gcc wget openssl readline-devel openssl-devel libxslt-devel gmp-devel bzip2-devel freetype-devel libjpeg-devel php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel
Download the PHP source package and extract it:
$sudo cd /usr/local/src/
$sudo wget http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror
$sudo tar zxvf mirror
$ cd php-7.2.3
Check the configuration:
$sudo ./configure --prefix=/usr/local/php7.2.3 --with-config-file-path=/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-apxs2=/usr/bin/apxs --with-libxml-dir --with-xmlrpc --with-openssl --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache
After the above check has no errors, the following installation and compilation are started:
$sudo make && make install
After waiting for the above installation, you need to configure the php environment variable:
$sudo vim /etc/profile
Add the following information at the bottom of the file:
PATH=$PATH:/usr/local/php7.2.3/bin
export PATH
Make its environment variables take effect:
$sudo source /etc/profile
Configure php-fpm:
$sudo cd /usr/local/usr/php-7.2.3
$sudo cp php.ini-production /etc/php.ini
$sudo cp /usr/local/php7.2.3/etc/php-fpm.conf.default /usr/local/php7.2.3/etc/php-fpm.conf
$sudo cp /usr/local/php7.2.3/etc/php-fpm.d/www.conf.default /usr/local/php7.2.3/etc/php-fpm.d/www.conf
$sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
$sudo chmod +x /etc/init.d/php-fpm
Start php-fpm
$sudo service php-fpm start
Modify the httpd.conf file:
$sudo vim /etc/httpd/conf/httpd.conf
The information that needs to be modified is as follows:
(1) Add the following line after AddType application*
AddType application/x-httpd-php .php .phtml
(2) Add index.php to DirectoryIndex index.html
DirectoryIndex index.php index.html
(3) Make sure that the following fields are included in the httd.conf file. If it is not included, add this field (existing, there is no need to add)
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
Restart the httpd service
$sudo service httpd restart
Install Snipe-IT:
1.initialize and create a snipeit database
$sudo service mariadb start # start maraidb service
$sudo mysql_secure_installation #Initialize database service
Create a snipe-it database
mysql> create database snipeit;
mysql> grant all on snipeit.* to 'snipeit'@'%' identified by 'password';
mysql> flush privileges;
mysql> exit
Install composer:
What is a composer:
Composer is a command-line tool created by Jordi Boggiano and Nils Aderman. Its mission is to help you automatically install the development kits you rely on for your projects. Many of the ideas in Composer are borrowed from npm and Bundler, and if you know about these two tools, they will be found in composer. Composer includes a dependency resolver that handles complex dependencies between development packages; it also includes interesting things like downloaders, installers, and more.
Download and install compose:
$sudo curl -sS https://getcomposer.org/installer | php
$sudo mv /root/composer.phar /usr/bin/composer
Install snipeit:
$sudo cd /var/www
$sudo yum install -y git
$sudo git clone https://github.com/snipe/snipe-it snipe-it
Edit configuration file:
$sudo cd /var/www/snipe-it
$sudo cp .env.example .env
$sudo vim .env
APP_URL=192.168.201.102 #fill in the address
APP_TIMEZONE='Asia/Shanghai' #fill in the country address
DB_DATABASE=snipeit #database name
DB_USERNAME=snipeit #database username
DB_PASSWORD=password #database password
In addition
APP_DEBUG=false
Please change to true when debugging
Change directory permissions:
$sudo chown -R apache:apache storage public/uploads
$sudo chmod -R 755 storage
$sudo chmod -R 755 public/uploads
Use composer to install PHP dependencies:
$sudo composer install --no-dev --prefer-source
Generate app_key:
$sudo php artisan key:generate
Modify the Apache configuration file to create a virtual host:
$sudo vim /etc/httpd/conf.d/snipeit.example.com.conf
The specific configuration information is as follows:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/snipe-it/public
<Directory /var/www/snipe-it/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Restart httpd and access the installation address:
$sudo systemctl restart httpd
$sudo systemctl enable httpd
$sudo systemctl status httpd
发表评论