http://www.commentcamarche.net/
http://www.commentcamarche.net/download/
http://www.clubic.com/telecharger/
https://openclassrooms.com/courses
voir pj
GLPI (GESTION LIBRE DE PARC INFORMATIQUE) http://glpi-project.org/
J’utilise une VM Ubuntu 16.04 LTS serveur avec juste le minimum d’installé.
sudo su
sudo apt-get install apache2 apache2-utils
Apache devrait être démarré automatiquement. Vérifiez son statut avec systemctl:
root@Glpi:/home/ritek# systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since dim. 2016-06-19 21:10:09 CEST; 2min 44s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/apache2.service
├─20559 /usr/sbin/apache2 -k start
├─20562 /usr/sbin/apache2 -k start
└─20563 /usr/sbin/apache2 -k start
juin 19 21:10:08 Glpi systemd[1]: Starting LSB: Apache2 web server...
juin 19 21:10:08 Glpi apache2[20534]: * Starting Apache httpd web server apache2
juin 19 21:10:09 Glpi apache2[20534]: *
juin 19 21:10:09 Glpi systemd[1]: Started LSB: Apache2 web server.
S’il n’est pas démarré, on utilise systemctl pour le lancer :
root@Glpi:/home/ritek# systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since dim. 2016-06-19 21:10:09 CEST; 2min 44s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/apache2.service
├─20559 /usr/sbin/apache2 -k start
├─20562 /usr/sbin/apache2 -k start
└─20563 /usr/sbin/apache2 -k start
juin 19 21:10:08 Glpi systemd[1]: Starting LSB: Apache2 web server...
juin 19 21:10:08 Glpi apache2[20534]: * Starting Apache httpd web server apache2
juin 19 21:10:09 Glpi apache2[20534]: *
juin 19 21:10:09 Glpi systemd[1]: Started LSB: Apache2 web server.
Par la même occasion on active le démarrage auto au reboot
root@Glpi:/home/ritek# systemctl enable apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable apache2
apt-get install mariadb-server mariadb-client
systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: active (running) since dim. 2016-06-19 22:39:15 CEST; 3min 2s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/mysql.service
├─22586 /bin/bash /usr/bin/mysqld_safe
├─22587 logger -p daemon err -t /etc/init.d/mysql -i
├─22731 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-fil
└─22732 logger -t mysqld -p daemon error
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.column_stats OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.columns_priv OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.db OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.event OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.func OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.gtid_slave_pos OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.help_category OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.help_keyword OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22783]: mysql.help_relation OK
juin 19 22:39:16 Glpi /etc/mysql/debian-start[22837]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
Pour activer le démarrage de MariaDB au boot :
root@Glpi:/home/ritek# systemctl enable mysql
mysql.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable mysql
root@Glpi:/home/ritek# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 50
Server version: 10.0.25-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> create database glpi;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON `glpi` .* TO 'glpiuser'@'localhost' IDENTIFIED BY 'pwdglpiuser';
MariaDB [(none)]> quit;
apt-get install php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-opcache php7.0-readline php7.0-mysql php7.0-gd libapache2-mod-php7.0 php-mbstring php7.0-curl php7.0-ldap php7.0-imap php-xml
On voit passer ca :
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0
qui rassure et qui évite l’erreur suivante :
Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed
httpd.service: control process exited, code=exited status=1
si vous avez cette erreur
sudo a2dismod mpm_event
et on active prefork
sudo a2enmod mpm_prefork
root@Glpi:/home/ritek# systemctl status php7.0-fpm
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since dim. 2016-06-19 23:13:47 CEST; 3min 43s ago
Process: 997 ExecStartPre=/usr/lib/php/php7.0-fpm-checkconf (code=exited, status=0/SUCCESS)
Main PID: 1006 (php-fpm7.0)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 3
Memory: 24.3M
CPU: 128ms
CGroup: /system.slice/php7.0-fpm.service
├─1006 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
├─1010 php-fpm: pool www
└─1011 php-fpm: pool www
juin 19 23:13:47 Glpi systemd[1]: Stopped The PHP 7.0 FastCGI Process Manager.
juin 19 23:13:47 Glpi systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
juin 19 23:13:47 Glpi systemd[1]: Started The PHP 7.0 FastCGI Process Manager.
root@Glpi:/home/ritek# php --version
PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
cd /var/www
wget -c https://github.com/glpi-project/glpi/releases/download/0.90.3/glpi-0.90.3.tar.gz
tar -xvzf glpi-0.90.3.tar.gz
root@Glpi:/var/www# chown -R www-data:www-data /var/www/glpi
root@Glpi:/var/www# cd /etc/apache2/sites-available
root@Glpi:/etc/apache2/sites-available# cp 000-default.conf glpi.conf
root@Glpi:/etc/apache2/sites-available# vim glpi.conf
et vous changez DocumentRoot /var/www/html par
DocumentRoot /var/www/
root@Glpi:/etc/apache2/sites-available# a2dissite 000-default.conf
Site 000-default disabled.
To activate the new configuration, you need to run:
service apache2 reload
root@Glpi:/etc/apache2/sites-available# a2ensite glpi.conf
Enabling site glpi.
To activate the new configuration, you need to run:
service apache2 reload
root@Glpi:/etc/apache2/sites-available# service apache2 reload
On fait un peu le ménage et on optimise quelques bricoles.
Pour des raisons de sécurité, veuillez supprimer le fichier : install/install.php
Aller directement à la fin des métadonnées
Aller au début des métadonnées
Cet IPBX basé sur Asterisk permet de configurer votre serveur facilement et rapidement.
Sommaire :
Pour suivre ce guide, il vous faut :
Votre serveur est déjà installé. Nous utilisons Debian 7 dans ce guide et partons du principe que vous avez déjà suivi et appliqué les recommandations de la partie sécurisation.
Pour installer Xivo :
Une fois l’installation terminée, l’interface web est accessible via : http://ip_de_votre_serveur/
Il faut effectuer la première partie de l’assistant afin de sécuriser l’accès à l’interface Web :
Validez le dernier formulaire pour que la configuration soit effective.
Pour enregistrer votre trunk sur Xivo :
Le formulaire est divisé en plusieurs onglets :
Pour vérifier que votre trunk est bien enregistré :
vps123*CLI> sip show registry Host dnsmgr Username Refresh State Reg.Time siptrunk.ovh.net:5060 N 003397232069 1785 Registered Tue, 24 Mar 2015 09:20:24 1 SIP registrations. |
Vous obtenez alors l’information du REGISTER :
Dans ce guide, nous créons les extensions 100 et 110. Pour ce faire :
Cliquez sur « Sauvegarder » pour confirmer la configuration.
Il faut dans un premier temps déclarer les SDA sur le contexte des appels entrants :
Si vous ne possédez qu’un seul DDI, indiquez le uniquement dans le champ « Début de l’intervalle de numéros« .
La configuration du routage de l’appel sur un service ou une extension du DDI appelé se gère via ces étapes :
La règle pour les appels sortants permet de définir le dialplan pour utiliser le trunk :
Extension
|
Description
|
---|---|
0[1-7]XXXXXXXX | Autorise les appels sur les numéros de 10 chiffres où les deux premiers chiffres sont entre 01 et 07. |
09XXXXXXXX | Autoriser les appels sur les numéros de 10 chiffres où les deux premiers chiffres sont 09. |
Keeping records of personal communications for long periods may be subject to local legislation, to avoid personal data retention. Also, keeping too many records may become resource intensive for the server. To ease the removal of such records, xivo-purge-db
is a process that removes old log entries from the database. This allows keeping records for a maximum period and deleting older ones.
By default, xivo-purge-db removes all logs older than a year (365 days). xivo-purge-db is run nightly.
Note
Please check the laws applicable to your country and modify days_to_keep
(see below) in the configuration file accordingly.
The following features are impacted by xivo-purge-db:
More technically, the tables purged by xivo-purge-db
are:
call_log
cel
queue_log
stat_agent_periodic
stat_call_on_queue
stat_queue_periodic
stat_switchboard_queue
We recommend to override the setting days_to_keep
from /etc/xivo-purge-db/config.yml
in a new file in /etc/xivo-purge-db/conf.d/
.
Warning
Setting days_to_keep
to 0 will NOT disable xivo-purge-db
, and will remove ALL logs from your system.
See Configuration priority and /etc/xivo-purge-db/config.yml
for more details.
It is possible to purge logs manually. To do so, log on to the target XiVO server and run:
xivo-purge-db
You can specify the number of days of logs to keep. For example, to purge entries older than 365 days:
xivo-purge-db -d 365
Usage of xivo-purge-db
:
usage: xivo-purge-db [-h] [-d DAYS_TO_KEEP]
optional arguments:
-h, --help show this help message and exit
-d DAYS_TO_KEEP, --days_to_keep DAYS_TO_KEEP
Number of days data will be kept in tables
After an execution of xivo-purge-db
, postgresql’s Autovacuum Daemon should perform a VACUUM ANALYZE automatically (after 1 minute). This command marks memory as reusable but does not actually free disk space, which is fine if your disk is not getting full. In the case when xivo-purge-db
hasn’t run for a long time (e.g. upgrading to 15.11 or when days_to_keep is decreased), some administrator may want to perform a VACUUM FULL to recover disk space.
Warning
VACUUM FULL will require a service interruption. This may take several hours depending on the size of purged database.
You need to:
$ xivo-service stop
$ sudo -u postgres psql asterisk -c "VACUUM (FULL)"
$ xivo-service start
In the case you want to keep archives of the logs removed by xivo-purge-db, you may install plugins to xivo-purge-db that will be run before the purge.
XiVO does not provide any archive plugin. You will need to develop plugins for your own need. If you want to share your plugins, please open a pull request.
Each plugin is a Python callable (function or class constructor), that takes a dictionary of configuration as argument. The keys of this dictionary are the keys taken from the configuration file. This allows you to add plugin-specific configuration in /etc/xivo-purge-db/conf.d/
.
There is an example plugin in the xivo-purge-db git repo.
Archive name: sample
Purpose: demonstrate how to create your own archive plugin.
Each plugin needs to be explicitly enabled in the configuration of xivo-purge-db
. Here is an example of file added in /etc/xivo-purge-db/conf.d/
:
1 2 3 |
enabled_plugins:
archives:
- sample
|
The following example will be save a file in /tmp/xivo_purge_db.sample
with the following content:
Save tables before purge. 365 days to keep!
1 2 3 4 5 |
sample_file = '/tmp/xivo_purge_db.sample'
def sample_plugin(config):
with open(sample_file, 'w') as output:
output.write('Save tables before purge. {0} days to keep!'.format(config['days_to_keep']))
|
The following setup.py
shows an example of a python library that adds a plugin to xivo-purge-db:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from setuptools import find_packages
setup(
name='xivo-purge-db-sample-plugin',
version='0.0.1',
description='An example program',
packages=find_packages(),
entry_points={
'xivo_purge_db.archives': [
'sample = xivo_purge_db_sample.sample:sample_plugin',
],
}
)
|
xivo-sysconfd is the system configuration server for XiVO. It does quite a few different things; here’s a non exhaustive list:
Default location: /etc/xivo/sysconfd.conf
. Format: INI.
The default location may be overwritten by the command line options.
Here’s an example of the configuration file:
[general]
xivo_config_path = /etc/xivo
templates_path = /usr/share/xivo-sysconfd/templates
custom_templates_path = /etc/xivo/sysconfd/custom-templates
backup_path = /var/backups/xivo-sysconfd
[resolvconf]
hostname_file = /etc/hostname
hostname_update_cmd = /etc/init.d/hostname.sh start
hosts_file = /etc/hosts
resolvconf_file = /etc/resolv.conf
[network]
interfaces_file = /etc/network/interfaces
[wizard]
templates_path = /usr/share/xivo-config/templates
custom_templates_path = /etc/xivo/custom-templates
[commonconf]
commonconf_file = /etc/xivo/common.conf
commonconf_cmd = /usr/sbin/xivo-update-config
commonconf_monit = /usr/sbin/xivo-monitoring-update
[openssl]
certsdir = /var/lib/xivo/certificates
[monit]
monit_checks_dir = /usr/share/xivo-monitoring/checks
monit_conf_dir = /etc/monit/conf.d
[request_handlers]
synchronous = true
[bus]
username = guest
password = guest
host = localhost
port = 5672
exchange_name = xivo
exchange_type = topic
exchange_durable = true
If this option is true, when xivo-sysconfd receives a request to reload the dialplan for example, it will wait for the dialplan reload to complete before replying to the request.
When this option is false, xivo-sysconfd reply to the request immediately.
Setting this option to false will speed up some operation (for example, editing a user from the web interface or from xivo-confd), but this means that there will be a small delay (up to a few seconds in the worst case) between the time you create your user and the time you can dial successfully its extension.
XiVO has many running services. To restart the whole stack, the xivo-service command can be used to make sure the service is restarted in the right order.
Show all services status:
xivo-service status
Stop XiVO services:
xivo-service stop
Start XiVO services:
xivo-service start
Restart XiVO services:
xivo-service restart
The commands above will only act upon XiVO services. Appending an argument all
will also act upon nginx
and postgresql
. Example:
xivo-service restart all
UDP port 5060 will be closed while services are restarting.
If you use XiVO behind an HTTP proxy, you must do a couple of manipulations for it to work correctly.
Create the /etc/apt/apt.conf.d/90proxy
file with the following content:
Acquire::http::Proxy "http://domain\username:password@proxyip:proxyport";
Proxy information is set via the
page.This step is needed if you use the DHCP server of the XiVO. Otherwise the DHCP configuration won’t be correct.
Proxy information is set via the /etc/xivo/dhcpd-update.conf
file.
Edit the file and look for the [proxy]
section.
This step is not needed if you don’t use xivo-fetchfw.
Proxy information is set via the /etc/xivo/xivo-fetchfw.conf
file.
Edit the file and look for the [proxy]
section.
XiVO has a NTP server, that must be synchronized to a reference server. This can be a public one or customized for specific target networking architecture. XiVO’s NTP server is used by default as NTP server for the devices time reference.
Show NTP service status:
service ntp status
Stop NTP service:
service ntp stop
Start NTP service:
service ntp start
Restart NTP service:
service ntp restart
Show NTP synchronization status:
ntpq -p
Edit /etc/ntp.conf
Give your NTP reference servers:
server 192.168.0.1 # LAN existing NTP Server
server 0.debian.pool.ntp.org iburst dynamic # default in ntp.conf
server 1.debian.pool.ntp.org iburst dynamic # default in ntp.conf
If no reference server to synchronize to, add this to synchronize locally:
server 127.127.1.0 # local clock (LCL)
fudge 127.127.1.0 stratum 10 # LCL is not very reliable
Restart NTP service
Check NTP synchronization status.
Warning
If #5 shows that NTP doesn’t use NTP configuration in /etc/ntp.conf
, maybe have you done a dhclient
for one of your network interface and the dhcp server that gave the IP address also gave a NTP server address. Thus you might check if the file /var/lib/ntp/ntp.conf.dhcp
exists, if yes, this is used for NTP configuration prior to /etc/ntp.conf
. Remove it and restart NTP, check NTP synchronization status, then it should work.
Every XiVO service has its own log file, placed in /var/log
.
The Asterisk log files are managed by logrotate.
It’s configuration files /etc/logrotate.d/asterisk
and /etc/asterisk/logger.conf
The message log level is enabled by default in logger.conf
and contains notices, warnings and errors. The full log entry is commented in logger.conf
and should only be enabled when verbose debugging is required. Using this option in production would produce VERY large log files.
/var/log/asterisk/*
/var/log/xivo-agentd.log
/etc/logrotate.d/xivo-agentd
/var/log/xivo-agid.log
/etc/logrotate.d/xivo-agid
/var/log/xivo-amid.log
/etc/logrotate.d/xivo-amid
/var/log/xivo-auth.log
/etc/logrotate.d/xivo-auth
/var/log/xivo-call-logd.log
/etc/logrotate.d/xivo-call-logd
/var/log/xivo-confd.log
/etc/logrotate.d/xivo-confd
The xivo-confgend daemon output is sent to the file specified with the --logfile
parameter when launched with twistd.
The file location can be changed by customizing the xivo-confgend.service unit file.
/var/log/xivo-confgend.log
/etc/logrotate.d/xivo-confgend
/var/log/xivo-ctid.log
/etc/logrotate.d/xivo-ctid
/var/log/xivo-ctid-ng.log
/etc/logrotate.d/xivo-ctid-ng
/var/log/xivo-dird.log
/etc/logrotate.d/xivo-dird
/var/log/xivo-dird-phoned.log
/etc/logrotate.d/xivo-dird-phoned
/var/log/xivo-dxtora.log
/etc/logrotate.d/xivo-dxtora
/var/log/xivo-provd.log
/etc/logrotate.d/xivo-provd
/var/log/xivo-purge-db.log
/etc/logrotate.d/xivo-purge-db
/var/log/xivo-stat.log
/etc/logrotate.d/xivo-stat
/var/log/xivo-sysconfd.log
/etc/logrotate.d/xivo-sysconfd
/var/log/xivo-upgrade.log
/etc/logrotate.d/xivo-upgrade
/var/log/xivo-web-interface/*.log
/etc/logrotate.d/xivo-web-interface
/var/log/xivo-websocketd.log
/etc/logrotate.d/xivo-websocketd
A backup of the database and the data are launched every day with a logrotate task. It is run at 06:25 a.m. and backups are kept for 7 days.
Logrotate task:
/etc/logrotate.d/xivo-backup
Logrotate cron:
/etc/cron.daily/logrotate
You can retrieve the backup from the web-interface in
page.Otherwise, with shell access, you can retrieve them in /var/backups/xivo
. In this directory you will find db.tgz
and data.tgz
files for the database and data backups.
Backup scripts:
/usr/sbin/xivo-backup
Backup location:
/var/backups/xivo
Here is the list of folders and files that are backed-up:
/etc/asterisk/
/etc/consul/
/etc/crontab
/etc/dahdi/
/etc/dhcp/
/etc/hostname
/etc/hosts
/etc/ldap/
/etc/network/if-up.d/xivo-routes
/etc/network/interfaces
/etc/ntp.conf
/etc/profile.d/xivo_uuid.sh
/etc/resolv.conf
/etc/ssl/
/etc/systemd/
/etc/wanpipe/
/etc/xivo-agentd/
/etc/xivo-agid/
/etc/xivo-amid/
/etc/xivo-auth/
/etc/xivo-call-logd/
/etc/xivo-confd/
/etc/xivo-confgend-client/
/etc/xivo-ctid/
/etc/xivo-ctid-ng/
/etc/xivo-dird/
/etc/xivo-dird-phoned/
/etc/xivo-dxtora/
/etc/xivo-purge-db/
/etc/xivo-websocketd/
/etc/xivo/
/usr/local/bin/
/usr/local/sbin/
/usr/share/xivo/XIVO-VERSION
/var/lib/asterisk/
/var/lib/consul/
/var/lib/xivo-provd/
/var/lib/xivo/
/var/log/asterisk/
/var/spool/asterisk/
/var/spool/cron/crontabs/
The following files/folders are excluded from this backup:
/var/lib/consul/checks
/var/lib/consul/raft
/var/lib/consul/serf
/var/lib/consul/services
/var/lib/xivo-provd/plugins/*/var/cache/*
/var/spool/asterisk/monitor/
/var/spool/asterisk/meetme/
/var/lib/xivo-provd/plugins/xivo-polycom*/var/tftpboot/*.ld
/var/lib/xivo/sounds/
/var/lib/asterisk/sounds/custom/
/var/lib/asterisk/moh/
/var/spool/asterisk/voicemail/
/var/spool/asterisk/monitor/
The database asterisk
from PostgreSQL is backed up. This include almost everything that is configured via the web interface.
Warning
A backup file may take a lot of space on the disk. You should check the free space on the partition before creating one.
You can manually create a database backup file named db-manual.tgz
in /var/tmp
by issuing the following commands:
xivo-backup db /var/tmp/db-manual
You can manually create a data backup file named data-manual.tgz
in /var/tmp
by issuing the following commands:
xivo-backup data /var/tmp/data-manual
A backup of both the configuration files and the database used by a XiVO installation is done automatically every day. These backups are created in the /var/backups/xivo
directory and are kept for 7 days.
i386
or amd64
– may differ)Warning
Before restoring a XiVO on a fresh install you have to setup XiVO using the wizard (see Running the Wizard section).
Stop monit and all the xivo services:
xivo-service stop
If you want to restore XiVO < 2017.06 that was configured for XiVO CC, you must create PostgreSQL user stats before restoring the database. See Creating user stats.
System files are stored in the data.tgz file located in the /var/backups/xivo
directory.
This file contains for example, voicemail files, musics, voice guides, phone sets firmwares, provisioning server configuration database.
To restore the file
tar xvfp /var/backups/xivo/data.tgz -C /
Warning
Database backups are created as db.tgz
files in the /var/backups/xivo
directory. These tarballs contains a dump of the database used in XiVO.
In this example, we’ll restore the database from a backup file named db.tgz
placed in the home directory of root.
First, extract the content of the db.tgz
file into the /var/tmp
directory and go inside the newly created directory:
tar xvf db.tgz -C /var/tmp
cd /var/tmp/pg-backup
Drop the asterisk database and restore it with the one from the backup:
sudo -u postgres dropdb asterisk
sudo -u postgres pg_restore -C -d postgres asterisk-*.dump
To finalize the restore, see After Restoring The System.
When restoring the database, if you encounter problems related to the system locale, see PostgreSQL localization errors.
System configuration like network interfaces is stored in the database. It is possible to keep this configuration and only restore xivo data.
Rename the asterisk database to asterisk_previous:
sudo -u postgres psql -c 'ALTER DATABASE asterisk RENAME TO asterisk_previous'
Restore the asterisk database from the backup:
sudo -u postgres pg_restore -C -d postgres asterisk-*.dump
Restore the system configuration tables from the asterisk_previous database:
sudo -u postgres pg_dump -c -t dhcp -t netiface -t resolvconf asterisk_previous | sudo -u postgres psql asterisk
Drop the asterisk_previous database:
sudo -u postgres dropdb asterisk_previous
Warning
Restoring the data.tgz file also restores system files such as host hostname, network interfaces, etc. You will need to reapply the network configuration if you restore the data.tgz file.
Resynchronize the xivo-auth keys:
xivo-update-keys
Update systemd runtime configuration:
source /etc/profile.d/xivo_uuid.sh
systemctl set-environment XIVO_UUID=$XIVO_UUID
systemctl daemon-reload
Restart the services you stopped in the first step:
xivo-service start
You may also reboot the system.
Tuto de forum:
#Sauvegarde manuel
xivo-backup db /var/backups/xivo/db-manual
xivo-backup data /var/backups/xivo/data-manual
#Restore
avec Fillezilla:
hote:adresse duxivo
identifiant: root
MdP: celui mis lorsde l’installation
port: 22
#deposer les fichier de restore dans:
/var/backups/xivo/
#stoper les services:
xivo-service stop
#restorer les fichiers:
tar zxvfp /var/backups/xivo/data-type.tgz -C /
#restorer les bases de données
tar xvf /var/backups/xivo/db-type.tgz -C /tmp
cd /tmp/pg-backup
#La base asterisk (le nom du *.dump change en fonction de la version de la sauvegarde)
sudo -u postgres dropdb asterisk
sudo -u postgres pg_restore -C -d postgres asterisk-13.12.dump
#La base Xivo (le nom du *.dump change en fonction de la version de la sauvegarde)
sudo -u postgres dropdb xivo
sudo -u postgres pg_restore -C -d postgres xivo-13.12.dump
#Redemarrer les services
xivo-service start
backup manuel dans le bon dossier:
/usr/sbin/xivo-backup data /var/backups/xivo/data
/usr/sbin/xivo-backup db /var/backups/xivo/db