Ubuntu 16.04
Prérequis
Pour utiliser Communecter vous devez avoir
-
Apache 2 & PHP 5.6 (Attention, ne fonctionne pas sur PHP 7)
-
sudo apt-get install apache2 php5.6
-
Pour passer de la version 7 à 5.6 vous pouvez suivre la solution suivante : https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
-
Certains modules doivent être installé
- rewrite
sudo a2enmod rewrite
- curl
sudo apt-get install php5.6-curl
- mcrypt
sudo apt-get install php5.6-mcrypt
- gd
sudo apt-get install php5.6-gd
- mongo
sudo apt-get install php5.6-mongo
- dom
sudo apt-get install php5.6-dom
- rewrite
-
Pour vérifier votre version de PHP
php -v
-
-
MongoDB 3.4 (Ne fonctionne pas avec la 3.6) :
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
Install
Clone from GitHub :
mkdir ~/dev && mkdir ~/dev/communecter
mkdir ~/dev/communecter/modules
cd /var/www/html/
sudo ln -s ~/communecter communecter
cd ~/dev/communecter
git clone https://github.com/pixelhumain/pixelhumain.git
cd modules/
git clone https://github.com/pixelhumain/citizenToolKit.git
git clone https://github.com/pixelhumain/co2.git
ln -s co2 network
git clone https://github.com/pixelhumain/api
git clone https://github.com/pixelhumain/graph.git
git clone https://github.com/pixelhumain/classifieds.git
git clone https://github.com/pixelhumain/ressources.git
git clone https://github.com/pixelhumain/places.git
git clone https://github.com/pixelhumain/chat.git
git clone https://github.com/pixelhumain/learn.git
git clone https://github.com/pixelhumain/survey.git
git clone https://github.com/pixelhumain/interop.git
git clone https://github.com/pixelhumain/cotools.git
git clone https://github.com/pixelhumain/eco.git
cd ../
Installer les dépendances avec Composer :
sudo apt install composer
cd pixelhumain/ph/
composer update
composer install
Rename the dbconfig file :
cd protected/
cp config/dbconfig.exemple.php config/dbconfig.php
Si le fichier dbconfig.php
n'existe pas, créer le : nano config/dbconfig.php
<?php
$dbconfig = array(
'class' => 'mongoYii.EMongoClient',
'server' => 'mongodb://127.0.0.1:27017/',
'db' => 'pixelhumain',
);
?>
Création du dossier runtime et assets
mkdir runtime
sudo chmod -R 775 runtime/
cd ../
mkdir assets
sudo chmod -R 775 assets/
cd ../../
sudo chown -R [votreUser]:www-data pixelhumain
sudo chown -R [votreUser]:www-data modules
Configuration
And configure Apache vhost : edit /etc/apache2/sites-available/communecter.conf
:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
Activate the new vhost :
sudo a2ensite communecter
sudo a2enmod rewrite
sudo service apache2 reload
Configurer MongoDB
#Making the Data folder for MongoDB
mkdir data/
mkdir data/db
Import les données :
cd modules/co2/data
unzip cities.json.zip
mongoimport --db pixelhumain --collection cities --file cities.json
Ajouter MongoDB au démarrage et faire le script d’utilisation : sudo nano /etc/init.d/communecterdb
Ajouter ceci :
#!/bin/sh
#
### BEGIN INIT INFO
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Provides: unattended-upgrade-shutdown-check
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: Check if unattended upgrades are being applied
# Description: Check if unattended upgrades are being applied
# and wait for them to finish
### END INIT INFO
Sauvegardez :
sudo chmod +x /etc/init.d/communecterdb
update-rc.d communecterdb defaults
update-rc.d communecterdb enable
Alternative : créer le script communecterdb.sh
, le rendre exécutable et l’ajouter dans /etc/rc.local
Vérifier que tous les composants sont installés
Accéder a l’url suivant : http://127.0.0.1/ph/test
Et réglez tout les points rouges.
C’est bon vous pouvez utiliser COMMUNECTER
Accédez à cette adresse : http://127.0.0.1/ph/
Optionnel
Interface Mongo
Si vous souhaitez avoir une interface pour géré MongoDB vous pouvez télécharger Robo3T : https://robomongo.org/download
Email service to cron
Add
crontab -e
: */2 * * * * curl https://127.0.0.1/ph/co2/test/docron
Use
Communecter is now available : http://127.0.0.1/ph/
To try the email service, go to http://127.0.0.1/ph/co2/test/docron
To use in production mode, edit index.php
Update
Create /var/www/html/communecter/update.sh
containing :
red=`tput setaf 1`
green=`tput setaf 2`
blue=`tput setaf 0`
bgWhite=`tput setab 7`
reset=`tput sgr0`
Make it executable and launch it.