Version at: 02/05/2015, 18:12 vs. version at: 02/05/2015, 18:16
11# How to Install Tatoeba
22
33Introduction
44---------------
55
66Unless you are a Windows user, we recommend that you use [IMOUTO](https://github.com/Tatoeba/admin) to install Tatoeba so that you do not have to configure everything manually.
77
88If you are a Windows user or if for some reason you have issues with IMOUTO, you can still try to set things up manually. This article will try to guide you in doing that.
99
1010
1111Required tools
1212------------------
1313
1414You will need to install the following:
1515
1616* Apache
1717* PHP 5.3
1818* MySQL
1919* Git client
2020
2121#### Windows users
2222
2323* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL. But you may need to use version **1.7.7** of XAMPP rather than the latest version, because Tatoeba currently uses PHP 5.3.
2424* You can use [Github for Windows](https://windows.github.com/) as your Git client.
2525
2626#### Mac or Linux users
2727
2828* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.
2929
3030
3131Source code
3232--------------
3333
34Clone our [Git repository](https://github.com/Tatoeba/tatoeba2).
34Clone our [Git repository](https://github.com/Tatoeba/tatoeba2). You can use the GitHub GUI or this command:
3535
3636 git clone https://github.com/Tatoeba/tatoeba2.git
37
38On Windows, make sure that your local repository is stored under xampp\htdocs (for example, c:\xampp\htdocs). Otherwise, you will not have access to it.
3739
3840Virtual host
3941---------------
4042
4143If you already have some other websites set up on your machine, you will need to set up a virtual host. The point is that instead of going to something like **http://localhost/tatoeba2**, you go to some custom URL. I personally use **http://tatoeba.dev/**.
4244
4345The reason is because CakePHP will not handle the URL rewriting properly if you try to browse through a subdirectory. You will get some error saying something like "The action tatoeba2 is not defined in controller PagesController".
4446
4547If you don't know how to set up a virtual host, you should be able to find tutorial by googling it. Here are some links.
4648
4749On Mac using XAMPP:
4850
4951* [http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)
5052
5153On Windows using XAMPP:
5254
5355* [http://sawmac.com/xampp/virtualhosts/](http://sawmac.com/xampp/virtualhosts/)
5456* [http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)
5557* [https://www.youtube.com/watch?v=n9BB_-VLoaY](https://www.youtube.com/watch?v=n9BB_-VLoaY)
5658
5759Briefly, you will need to edit your httpd-vhosts.conf and hosts files.
5860
5961You will add a section like this to the end of the httpd-vhosts.conf file:
6062
6163
6264 <VirtualHost *:80>
6365 DocumentRoot "C:\xampp\htdocs"
6466 ServerName localhost
6567 </VirtualHost>
6668
6769 <VirtualHost *:80>
6870 DocumentRoot "C:\xampp\htdocs\tatoeba2"
6971 ServerName tatoeba.dev
7072 <Directory "C:\xampp\htdocs\tatoeba2">
7173 Order allow,deny
7274 Allow from all
7375 </Directory>
7476 </VirtualHost>
7577
7678
7779To edit your hosts file on Windows, make sure that:
7880
7981* your folder view options are not set up to hide system files (or you won't be able to see the hosts file)
8082* you are editing as administrator (or you won't be able to save your changes)
8183
8284Note that you will need to make sure that your hosts file contains the domain name that you want to use for your virtual host. For instance:
8385
8486 127.0.0.1 tatoeba.dev
8587
8688
8789Create the config files
8890--------------------------
8991
9092### core.php
9193
9294Copy the file `app/config/core.php.template` and name it `core.php`.
9395
9496Make sure you have the search and autotranscription disabled.
9597
9698 Configure::write('Search.enabled', false);
9799 Configure::write('AutoTranscriptions.enabled', false);
98100
99101
100102### database.php
101103
102104Copy the file `app/config/database.php.template` and name it `database.php`.
103105
104106In the file `app/config/database.php`, set your login, password and database in the $default array. If you want, you can set the value of 'password' to an empty string.
105107
106108 var $default = array(
107109 'driver' => 'mysql',
108110 'persistent' => false,
109111 'host' => 'localhost',
110112 'login' => 'root',
111113 'password' => 'somepassword',
112114 'database' => 'tatoeba',
113115 'prefix' => '',
114116 'encoding' => 'utf8'
115117 );
116118
117119You don't have to worry about the rest of the file at this stage.
118120
119121
120122
121123Database
122124-------------------
123125
124126### Create the database
125127
126128First, create the database. Make sure the name you use here is the name you've set in `app/core/database.php`. I'll name it `tatoeba`.
127129
128130Make sure you have started Apache and MySQL from the XAMPP Control Panel. Now you can issue "mysql -u root" to start MySQL from a prompt. Issue these commands:
129131
130132 CREATE DATABASE tatoeba;
131133 USE tatoeba;
132134
133135### Create the tables and import the data
134136
135137#### From Trang's database
136138
137139The easiest solution is to download the copy of [Trang's local database](https://dl.dropboxusercontent.com/u/953908/tatoeba/tatoeba_database.zip) (**69 MB**). It contains data from 2010, that is around 600k sentences.
138140
139141You can import the database with the command, which takes several minutes to run:
140142
141143 mysql -u username [-p] database_name < tatoeba_database.sql
142144
143145Within this database, the passwords for all users have been set to `123`.
144146
145147You may need to execute some of the scripts in docs/database/updates if they have not been executed since the last time that Trang exported her database. Ask her.
146148
147149#### From the scripts in docs/database
148150
149151Another solution is to execute all the scripts in this order:
150152
151153* scripts in `docs/database/tables`
152154* scripts in `docs/database/triggers`
153155* scripts in `docs/database/import`
154156
155157From there you will be able to log in with `123456` with one of the following usernames:
156158
157159* admin
158160* corpus_maintainer
159161* advanced_contributor
160162* contributor
161163* inactive
162164* spammer
163165
164166
165167Other things you may have to configure
166168----------------------------------------------
167169    
168170### tmp folder writable
169171
170172Make sure your `/app/tmp/cache` and all folders in it (models, persistent, views) are writable.
171173
172174### thread_stack for XAMPP on a Mac
173175
174176You'll need to up the default thread_stack from 64K to 256K.
175177`/Applications/XAMPP/xamppfiles/etc/my.cnf`
176178`thread_stack = 256K`
177179
178180### short_open_tag = On
179181
180182Make sure `<?` is allowed as an open tag. In your `php.ini`, check that you have:
181183
182184 short_open_tag = On
183185
184186Other Things to Install
185187--------------------------
186188
187189These can be ignored for local development of the code, but need to be installed in order to get the app fully operational.
188190
189191* imagick (for resizing images for profile avatars)
190192* Sphinx search engine
191193* Furigana
192194* autocompletion for tags is based on suggestd (TODO put link an explanation on how to compile/use it)
193195* for Chinese/Cantonese the transliteration is generated by sinoparserd (TODO add more explanation)
194196* language autodetection is based on tatodetect
diff view generated by jsdifflib

Version at: 02/05/2015, 18:12

# How to Install Tatoeba

Introduction
---------------

Unless you are a Windows user, we recommend that you use [IMOUTO](https://github.com/Tatoeba/admin) to install Tatoeba so that you do not have to configure everything manually.

If you are a Windows user or if for some reason you have issues with IMOUTO, you can still try to set things up manually. This article will try to guide you in doing that.


Required tools
------------------

You will need to install the following:

* Apache
* PHP 5.3
* MySQL
* Git client

#### Windows users

* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL. But you may need to use version **1.7.7** of XAMPP rather than the latest version, because Tatoeba currently uses PHP 5.3.
* You can use [Github for Windows](https://windows.github.com/) as your Git client.

#### Mac or Linux users

* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.


Source code
--------------

Clone our [Git repository](https://github.com/Tatoeba/tatoeba2).

    git clone https://github.com/Tatoeba/tatoeba2.git

Virtual host
---------------

If you already have some other websites set up on your machine, you will need to set up a virtual host. The point is that instead of going to something like **http://localhost/tatoeba2**, you go to some custom URL. I personally use **http://tatoeba.dev/**.

The reason is because CakePHP will not handle the URL rewriting properly if you try to browse through a subdirectory. You will get some error saying something like "The action tatoeba2 is not defined in controller PagesController".

If you don't know how to set up a virtual host, you should be able to find tutorial by googling it. Here are some links.

On Mac using XAMPP:

* [http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)

On Windows using XAMPP:

* [http://sawmac.com/xampp/virtualhosts/](http://sawmac.com/xampp/virtualhosts/)
* [http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)
* [https://www.youtube.com/watch?v=n9BB_-VLoaY](https://www.youtube.com/watch?v=n9BB_-VLoaY)

Briefly, you will need to edit your httpd-vhosts.conf and hosts files. 

You will add a section like this to the end of the httpd-vhosts.conf file:


    <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs"
        ServerName localhost
    </VirtualHost>
 
    <VirtualHost *:80>
      DocumentRoot "C:\xampp\htdocs\tatoeba2"
      ServerName tatoeba.dev
      <Directory "C:\xampp\htdocs\tatoeba2">
        Order allow,deny
        Allow from all
      </Directory>
    </VirtualHost>


To edit your hosts file on Windows, make sure that:

* your folder view options are not set up to hide system files (or you won't be able to see the hosts file)
* you are editing as administrator (or you won't be able to save your changes) 

Note that you will need to make sure that your hosts file contains the domain name that you want to use for your virtual host. For instance:

    127.0.0.1    tatoeba.dev


Create the config files
--------------------------

### core.php

Copy the file `app/config/core.php.template` and name it `core.php`.

Make sure you have the search and autotranscription disabled.

    Configure::write('Search.enabled', false);
    Configure::write('AutoTranscriptions.enabled', false);


### database.php

Copy the file `app/config/database.php.template` and name it `database.php`.

In the file `app/config/database.php`, set your login, password and database in the $default array. If you want, you can set the value of 'password' to an empty string.

    var $default = array(
        'driver' => 'mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => 'somepassword',
        'database' => 'tatoeba',
        'prefix' => '',
        'encoding' => 'utf8'
    );

You don't have to worry about the rest of the file at this stage.



Database
-------------------

### Create the database

First, create the database. Make sure the name you use here is the name you've set in `app/core/database.php`. I'll name it `tatoeba`. 

Make sure you have started Apache and MySQL from the XAMPP Control Panel. Now you can issue "mysql -u root" to start MySQL from a prompt. Issue these commands:

    CREATE DATABASE tatoeba;
    USE tatoeba;

### Create the tables and import the data

#### From Trang's database

The easiest solution is to download the copy of [Trang's local database](https://dl.dropboxusercontent.com/u/953908/tatoeba/tatoeba_database.zip) (**69 MB**). It contains data from 2010, that is around 600k sentences.

You can import the database with the command, which takes several minutes to run:

    mysql -u username [-p] database_name < tatoeba_database.sql

Within this database, the passwords for all users have been set to `123`.

You may need to execute some of the scripts in docs/database/updates if they have not been executed since the last time that Trang exported her database. Ask her.

#### From the scripts in docs/database

Another solution is to execute all the scripts in this order:

* scripts in `docs/database/tables`
* scripts in `docs/database/triggers`
* scripts in `docs/database/import`

From there you will be able to log in with `123456` with one of the following usernames: 

* admin
* corpus_maintainer
* advanced_contributor
* contributor
* inactive
* spammer


Other things you may have to configure
----------------------------------------------
	
### tmp folder writable

Make sure your `/app/tmp/cache` and all folders in it (models, persistent, views) are writable. 

### thread_stack for XAMPP on a Mac

You'll need to up the default thread_stack from 64K to 256K.
`/Applications/XAMPP/xamppfiles/etc/my.cnf`
`thread_stack = 256K`

### short_open_tag = On

Make sure `<?` is allowed as an open tag. In your `php.ini`, check that you have:

    short_open_tag = On

Other Things to Install
--------------------------

These can be ignored for local development of the code, but need to be installed in order to get the app fully operational.

* imagick (for resizing images for profile avatars)
* Sphinx search engine
* Furigana
* autocompletion for tags is based on suggestd (TODO put link an explanation on how to compile/use it)
* for Chinese/Cantonese the transliteration is generated by sinoparserd (TODO add more explanation)
* language autodetection is based on tatodetect 

version at: 02/05/2015, 18:16

# How to Install Tatoeba

Introduction
---------------

Unless you are a Windows user, we recommend that you use [IMOUTO](https://github.com/Tatoeba/admin) to install Tatoeba so that you do not have to configure everything manually.

If you are a Windows user or if for some reason you have issues with IMOUTO, you can still try to set things up manually. This article will try to guide you in doing that.


Required tools
------------------

You will need to install the following:

* Apache
* PHP 5.3
* MySQL
* Git client

#### Windows users

* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL. But you may need to use version **1.7.7** of XAMPP rather than the latest version, because Tatoeba currently uses PHP 5.3.
* You can use [Github for Windows](https://windows.github.com/) as your Git client.

#### Mac or Linux users

* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.


Source code
--------------

Clone our [Git repository](https://github.com/Tatoeba/tatoeba2). You can use the GitHub GUI or this command:

    git clone https://github.com/Tatoeba/tatoeba2.git

On Windows, make sure that your local repository is stored under xampp\htdocs (for example, c:\xampp\htdocs). Otherwise, you will not have access to it. 

Virtual host
---------------

If you already have some other websites set up on your machine, you will need to set up a virtual host. The point is that instead of going to something like **http://localhost/tatoeba2**, you go to some custom URL. I personally use **http://tatoeba.dev/**.

The reason is because CakePHP will not handle the URL rewriting properly if you try to browse through a subdirectory. You will get some error saying something like "The action tatoeba2 is not defined in controller PagesController".

If you don't know how to set up a virtual host, you should be able to find tutorial by googling it. Here are some links.

On Mac using XAMPP:

* [http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)

On Windows using XAMPP:

* [http://sawmac.com/xampp/virtualhosts/](http://sawmac.com/xampp/virtualhosts/)
* [http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)
* [https://www.youtube.com/watch?v=n9BB_-VLoaY](https://www.youtube.com/watch?v=n9BB_-VLoaY)

Briefly, you will need to edit your httpd-vhosts.conf and hosts files. 

You will add a section like this to the end of the httpd-vhosts.conf file:


    <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs"
        ServerName localhost
    </VirtualHost>
 
    <VirtualHost *:80>
      DocumentRoot "C:\xampp\htdocs\tatoeba2"
      ServerName tatoeba.dev
      <Directory "C:\xampp\htdocs\tatoeba2">
        Order allow,deny
        Allow from all
      </Directory>
    </VirtualHost>


To edit your hosts file on Windows, make sure that:

* your folder view options are not set up to hide system files (or you won't be able to see the hosts file)
* you are editing as administrator (or you won't be able to save your changes) 

Note that you will need to make sure that your hosts file contains the domain name that you want to use for your virtual host. For instance:

    127.0.0.1    tatoeba.dev


Create the config files
--------------------------

### core.php

Copy the file `app/config/core.php.template` and name it `core.php`.

Make sure you have the search and autotranscription disabled.

    Configure::write('Search.enabled', false);
    Configure::write('AutoTranscriptions.enabled', false);


### database.php

Copy the file `app/config/database.php.template` and name it `database.php`.

In the file `app/config/database.php`, set your login, password and database in the $default array. If you want, you can set the value of 'password' to an empty string.

    var $default = array(
        'driver' => 'mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => 'somepassword',
        'database' => 'tatoeba',
        'prefix' => '',
        'encoding' => 'utf8'
    );

You don't have to worry about the rest of the file at this stage.



Database
-------------------

### Create the database

First, create the database. Make sure the name you use here is the name you've set in `app/core/database.php`. I'll name it `tatoeba`. 

Make sure you have started Apache and MySQL from the XAMPP Control Panel. Now you can issue "mysql -u root" to start MySQL from a prompt. Issue these commands:

    CREATE DATABASE tatoeba;
    USE tatoeba;

### Create the tables and import the data

#### From Trang's database

The easiest solution is to download the copy of [Trang's local database](https://dl.dropboxusercontent.com/u/953908/tatoeba/tatoeba_database.zip) (**69 MB**). It contains data from 2010, that is around 600k sentences.

You can import the database with the command, which takes several minutes to run:

    mysql -u username [-p] database_name < tatoeba_database.sql

Within this database, the passwords for all users have been set to `123`.

You may need to execute some of the scripts in docs/database/updates if they have not been executed since the last time that Trang exported her database. Ask her.

#### From the scripts in docs/database

Another solution is to execute all the scripts in this order:

* scripts in `docs/database/tables`
* scripts in `docs/database/triggers`
* scripts in `docs/database/import`

From there you will be able to log in with `123456` with one of the following usernames: 

* admin
* corpus_maintainer
* advanced_contributor
* contributor
* inactive
* spammer


Other things you may have to configure
----------------------------------------------
	
### tmp folder writable

Make sure your `/app/tmp/cache` and all folders in it (models, persistent, views) are writable. 

### thread_stack for XAMPP on a Mac

You'll need to up the default thread_stack from 64K to 256K.
`/Applications/XAMPP/xamppfiles/etc/my.cnf`
`thread_stack = 256K`

### short_open_tag = On

Make sure `<?` is allowed as an open tag. In your `php.ini`, check that you have:

    short_open_tag = On

Other Things to Install
--------------------------

These can be ignored for local development of the code, but need to be installed in order to get the app fully operational.

* imagick (for resizing images for profile avatars)
* Sphinx search engine
* Furigana
* autocompletion for tags is based on suggestd (TODO put link an explanation on how to compile/use it)
* for Chinese/Cantonese the transliteration is generated by sinoparserd (TODO add more explanation)
* language autodetection is based on tatodetect 

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.