Difference between revisions of "Installing GLPI"
From Notes_Wiki
(Created page with "<yambe:breadcrumb>Glpi|Glpi</yambe:breadcrumb> =Installing GLPI= ==Manual installation== To manually install GLPI on a machine use following steps: #Download latest stable G...") |
m |
||
| Line 29: | Line 29: | ||
- name: Download and install glpi | - name: Download and install glpi | ||
hosts: glpi_servers | hosts: glpi_servers | ||
remote_user: root | |||
vars: | vars: | ||
| Line 107: | Line 107: | ||
- name: Remove install/install.php from glpi | - name: Remove install/install.php from glpi | ||
hosts: glpi_servers | hosts: glpi_servers | ||
remote_user: root | |||
vars: | vars: | ||
Revision as of 14:07, 14 March 2015
<yambe:breadcrumb>Glpi|Glpi</yambe:breadcrumb>
Installing GLPI
Manual installation
To manually install GLPI on a machine use following steps:
- Download latest stable GLPI from Internet ( https://forge.indepnet.net/attachments/download/1954/glpi-0.85.2.tar.gz at time of this writing)
- Install httpd, mod_ssl, php, php-ldap, mysql-server, php-mysql, php-mbstring, php-gd and MySQL-python packages
- Extract glpi sources in /var/www/html so that various files are in /var/www/html/glpi
- Create /var/www/html/index.html to redirect to glpi as explained at Redirecting_site_using_apache_configuration#Redirect_using_HTML_META_refresh
- chown -R apache:apache /var/www/html
- service httpd start; chkconfig httpd on
- service mysqld start; chkconfig mysqld on
- Start mysql using 'mysql' command and use following:
- create database glpi;
- grant all on glpi.* to glpi@localhost identified by '<password>'
-
- where <password> can be replaced suitably.
- Visit http://<server>/glpi and setup GLPI
- Login using username glpi and password glpi
Automated installation
For automated installation of glpi use following ansible script ('glpi.yaml'):
---
- name: Download and install glpi
hosts: glpi_servers
remote_user: root
vars:
glpi_download_url: https://forge.indepnet.net/attachments/download/1954/glpi-0.85.2.tar.gz
glpi_local_path: /root/glpi.tar.bz2
httpd_document_root: /var/www/html/
mysql_glpi_password: rekall123
tasks:
- name: Download GLPI from Internet
get_url: url="{{ glpi_download_url }}" dest="{{ glpi_local_path }}"
- name: Install apache, mod_ssl, php, php-ldap, mysql-server, php-mysql, php-mbstring, php-gd
yum: name={{ item }} state=present
with_items:
- httpd
- mod_ssl
- php
- php-ldap
- mysql-server
- php-mysql
- php-mbstring
- php-gd
- MySQL-python
notify:
- restart apache
- name: Extract glpi downloaded sources in /var/www/html
unarchive: copy=no src="{{ glpi_local_path }}" dest="{{ httpd_document_root }}" owner=apache group=apache #creates="{{ httpd_document_root }}"/index.html
- name: Copy index.html file to documentroot
copy: src=index.html dest="{{ httpd_document_root }}" owner=apache group=apache
- name: Ensure files are owned by apache user
file: dest="{{ httpd_document_root }}" owner=apache group=apache recurse=yes
- name: Start and Enable httpd, mysqld
service: name={{ item }} state=started enabled=yes
with_items:
- httpd
- mysqld
- name: Create glpi database in mysql
mysql_db: name=glpi
- name: Create glpi user and give all permissions on glpi database
mysql_user: name=glpi password="{{ mysql_glpi_password }}" priv=glpi.*:ALL
- name: Print web instructions
debug: msg="Please visit http://{{ ansible_default_ipv4.address }} and setup glpi using MySQL username glpi, password {{ mysql_glpi_password }} and host localhost. Login using glpi:glpi"
- name: Print post setup instructions
debug: msg="After setup is complete also run glpi_postsetup.yaml playbook to remove install/install.php file from glpi server"
handlers:
- name: restart apache
service: name=httpd state=restarted
The ansible script assumes availability of index.html with following content:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <meta http-equiv="Refresh" content="0; URL=glpi" /> </head> <body> </body> </html>
in same folder
Once installation is complete use following script for post-installation setup ('glpi_postsetup.yaml'):
---
- name: Remove install/install.php from glpi
hosts: glpi_servers
remote_user: root
vars:
httpd_document_root: /var/www/html/
tasks:
- name: Remove install/install.php file
file: path="{{ httpd_document_root }}"glpi/install/install.php state=absent