INSTALL.en.md 7.49 KB
Newer Older
1
This procedure is meant for Ubuntu et Debian GNU/Linux 
2

3

4
# Necessary packages :
5

Meusburger's avatar
Meusburger committed
6
##  Ubuntu Trusty
7
```
8
apt-get install python-software-properties php5 php5-gd php5-imagick php5-xdebug php-pear php5-mysqlnd php5-xhprof graphviz apache2 mysql-server libapache2-mod-php5 git php5-mcrypt php5-curl yaz
9 10
```

Meusburger's avatar
Meusburger committed
11
## Debian Wheezy
12
```
13
apt-get install php5 php5-gd php5-imagick php5-xdebug php-pear php5-mysqlnd graphviz apache2 mysql-server libapache2-mod-php5 git php5-mcrypt php5-curl yaz
14 15 16 17
```		

## ArchLinux
```
18
yaourt -S php php-gd php-imagick xdebug php-pear apache mariadb php-apache php-xhprof graphviz git
19 20 21 22 23
```

## CentOS
```
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm
llaffont's avatar
llaffont committed
24
yum install php54w php54w-gd php54w-pear php54w-mysql php54w-pecl-xdebug php54w-xml php54w-soap php54w-mbstring
25 26
```

llaffont's avatar
llaffont committed
27 28
You need to build Imagick extension from scratch

29

30
# Install PHPUnit (Account root / sudo):
31 32 33 34 35

```
  cd /usr/local/bin
  wget https://phar.phpunit.de/phpunit.phar
  mv phpunit.phar phpunit
36 37
```

38
# Downloading source code
39 40
```
cd /var/www
41
git clone http://git.afi-sa.fr/afi/opacce.git opacce
42
```
43

44
Launch update.sh script
Laurent's avatar
Laurent committed
45

46
```
Laurent's avatar
Laurent committed
47 48
cd opacce
./update.sh
49 50
```

Laurent's avatar
Laurent committed
51 52


Patrick Barroca's avatar
Patrick Barroca committed
53
#  Apache webserver:
54

55
## Activate the following modules :
56

57 58
### Debian
```
llaffont's avatar
llaffont committed
59
a2enmod headers rewrite php5
60 61
```
### ArchLinux:
62

63
Modify /etc/httpd/conf/http.conf and add the line: 
Laurent's avatar
Laurent committed
64

65 66 67 68
```
LoadModule php5_module modules/libphp5.so
```

69 70 71
Activate mod_mpm_prefork (see https://wiki.archlinux.org/index.php/Apache_HTTP_Server#PHP).


72
Deactivate negotiation module which is in conflict with Zend Framework on index/index urls:
73

74 75 76 77
```  
a2dismod negotiation
```

78
## Configure Apache
79

80
In Apache conf, delete indexes option (file list) and authorise .htaccess: 
Laurent's avatar
Laurent committed
81

82
```
llaffont's avatar
llaffont committed
83 84 85 86 87 88
<Directory /var/www/>
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>
89 90
```

91
Warning: For apache 2.4
92 93

```
llaffont's avatar
llaffont committed
94 95 96 97 98
<Directory /var/www/>
  Options FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>
99 100
```

Patrick Barroca's avatar
Patrick Barroca committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
# Nginx webserver (experimental)

Using Nginx imply using PHP in PHP-FPM mode.

Recommaded configuration use 2 files.
This provides a mean to have factorised Bokeh configuration and a custom configuration for each Bokeh instance.

## Include file « bokeh.inc », store it for example in /etc/nginx/conf-enabled

```
# Include directives for Bokeh portal

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires 30d;
    log_not_found off;
}

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

# Deny access to sensitive files.
location ~ (\.inc\.php|\.tpl|\.sql|\.tpl\.php|\.db)$ {
    #deny all;
    return 403;
}

location ~ /(\.|\.htaccess|config\.(ini|php)) {
    #deny all;
    return 403;
}

# Path without redirection
location ~ /(xhprof_html|ckeditor|\.well-known) {
}

# Serve PHP
location ~ /cosmogramme/cosmozend {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    #fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME    $document_root/cosmogramme/cosmozend/index.php;
    fastcgi_param  SCRIPT_NAME        /cosmogramme/cosmozend/index.php;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 4k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
    fastcgi_pass bokeh-dock:9000;
}

location ~ (\.php$|/(cosmogramme|exploit/(test\.php|fpm-ping|fpm-status))) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 4k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
    fastcgi_pass bokeh-dock:9000;
}
```
 
## Vhost file, adapt it to your needs (change URL_Bokeh, Path_Bokeh_Dir, Bokeh_Dir, …)

```
server {
    listen  80;
    index  index.php;
    server_name <URL_Bokeh>;
    root        <Path_Bokeh_Dir>/<Bokeh_Dir>;
    access_log  "<Path_Nginx_Log>/<URL_Bokeh>_access.log";
    error_log   "<Path_Nginx_Log>/<URL_Bokeh>_error.log";

    location / {
        try_files $uri $uri/ @rewrite;
    }

    # if the requested file exists, return it immediately
    if (-f $request_filename) {
        break;
    }

    location @rewrite {
        rewrite ^(.*)$ /index.php last;
    }

    include /etc/nginx/conf-enabled/bokeh.inc;
}
```
201

Patrick Barroca's avatar
Patrick Barroca committed
202
## Example content of etc/nginx/fastcgi_params
203

204
```
Patrick Barroca's avatar
Patrick Barroca committed
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
```


# Configure PHP

In /etc/php5/apache2/php.ini (ArchLinux: /etc/php/php.ini), configure the following variables:
```
post_max_size = 10M
upload_max_filesize = 10M
error_reporting  =  E_ALL & ~E_NOTICE & ~E_DEPRECATED
```

Activate the following extensions if they are not already actived (they should be): 
```
php5enmod calendar curl gd gettext iconv mcrypt mysql pdo_mysql openssl soap imagick
```

On Archinux uncomment the corresponding lines.


# Write permission on directories
- userfiles hold all uploaded files and files harvested from digital resources.
- temp hold cache files, edit history and files generated by Bokeh.

Example:
```
chmod -R 777 opacce/userfiles
llaffont's avatar
llaffont committed
256
chmod -R 777 opacce/temp
257
```
Patrick Barroca's avatar
Patrick Barroca committed
258 259 260
If you don't want to give write permission to anybody, you must give it to the user who owns the PHP process at least.


261
# MySQL config
262 263 264 265 266 267 268 269

## Finalise the installation (ArchLinux)

See https://wiki.archlinux.org/index.php/MySQL#Installation


# Configuration

Meusburger's avatar
Meusburger committed
270
Edit /etc/mysql/my.cnf and add to the [mysqld] section the following line (in order to force fulltext indexation from the first letter) 
Laurent's avatar
Laurent committed
271

272
```
llaffont's avatar
llaffont committed
273
ft_min_word_len = 1
274
ft_stopword_list = /dev/null
275
```
276 277

The stopword list can be set to a file in which you can define any word to be ignored.
278
Restart mysql.
llaffont's avatar
llaffont committed
279

280

281
Warning: If you have encoding problems, in Cosmogramme, you can force UTF8 like this:
282 283

```
llaffont's avatar
llaffont committed
284 285
skip-character-set-client-handshake
character-set-server=utf8
286 287
```

Meusburger's avatar
Meusburger committed
288
Connect to mysql and import the database schema
289 290 291 292 293 294 295 296

```
mysql -uroot -ppass
mysql> create database opac;
mysql> connect opac;
mysql> source opacce/scripts/opac2.sql;
```

297
#  OPAC Config
298
  
299
In the opacce directory, copy and configure
300 301

```
llaffont's avatar
llaffont committed
302 303
cp config.ini.default config.ini
touch local.php
304 305
```

306
#  Cosmogramme Config
307
  
308
 In the cosmogramme folder, copy and configure
309 310 311 312

```
cp config.ref.php config.php 
```
313

314
  go to http://localhost/opacce/cosmogramme
315

316
 connnect with the account admin/achanger and click on the patch update link
317 318


Meusburger's avatar
Meusburger committed
319
# Connect to the opac
320
  
321 322
  Use the account compte admin/achanger
go to http://localhost/opacce/admin
323

Meusburger's avatar
Meusburger committed
324
# To run the tests:
325
```
llaffont's avatar
llaffont committed
326 327
cd opacce/tests/
phpunit
Meusburger's avatar
Meusburger committed
328
```