installation.sh

MikoĊ‚aj Szewczyk, 17 Apr 2018 09:17

Download (2.42 KB)

 
1
#!/bin/bash
2
inforex_dir = $PWD
3
echo -e "Updating System..."
4
sudo add-apt-repository ppa:ondrej/php -y
5
sudo apt-get update -y && sudo apt-get upgrade -y
6

    
7
sudo apt-get install vim -y
8
sudo apt-get install git -y
9
#git clone git@svn.clarin-pl.eu:inforex.git
10

    
11

    
12
echo -e "\n Installing Apache2..."
13
sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert -y
14

    
15
echo -e "\n Installing PHP..."
16
sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-dev php-pear -y
17

    
18
#Installing pear modules
19
sudo pear install Auth HTML_Common MDB2-2.5.0b5 MDB2_Driver_mysql-1.4.1 MDB2_TableBrowser-0.1.3 HTTP_Session2-0.7.3 Text_Diff
20

    
21
#Installing re2c library
22
sudo apt-get install re2c -y
23

    
24
#Installing libxdiff library
25
wget http://www.xmailserver.org/libxdiff-0.23.tar.gz
26
tar -xvf libxdiff-0.23.tar.gz
27
cd libxdiff-0.23
28
./configure
29
make
30
sudo make install
31
sudo ldconfig
32
cd $inforex_dir
33

    
34
#MySQL installation
35
echo -e "\n Installing MySQL "
36
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password password'
37
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password password'
38
sudo apt-get install mysql-server mysql-client -y
39

    
40
sudo service apache2 reload
41

    
42
#Create the database
43
mysql --host=localhost --user=root --password=password << END
44
CREATE DATABASE inforex;
45
CREATE USER 'inforex'@'localhost' IDENTIFIED BY 'password';
46
GRANT ALL PRIVILEGES ON inforex.* to inforex@localhost ;
47
END
48

    
49
sudo mkdir ~/inforex/engine/templates_c
50
sudo chmod g+rwx ~/inforex/engine/templates_c
51
sudo chown :www-data ~/inforex/engine/templates_c
52

    
53
echo -e "\n\n Here..."
54

    
55
#Setting up virtual host
56
echo "  Alias /inforex $PWD/inforex/public_html
57
  <Directory $PWD/inforex/public_html>
58
    Require all granted
59
  </Directory>
60
" | sudo tee /etc/apache2/sites-available/inforex.conf
61

    
62
#Set up symbolinc link
63
cd /etc/apache2/sites-enabled/
64
sudo ln -s ../sites-available/inforex.conf inforex.conf
65

    
66
#Configure MySQL
67
echo 'sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"' | sudo tee -a /etc/mysql/mysql.conf.d/mysqld.cnf
68

    
69
#Create local config
70
echo "<?php
71

    
72
$config->dsn = array(
73
    'phptype'  => 'mysql',
74
    'username' => 'inforex',
75
    'password' => 'password',
76
    'hostspec' => 'localhost',
77
    'database' => 'inforex',
78
);" | sudo tee $PWD/inforex/engine/config.local.php
79

    
80

    
81
sudo service mysql restart
82
sudo service apache2 restart
83