Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
zotero_dataserver_setup [2011/07/14 08:06] – created simonth | zotero_dataserver_setup [2017/11/12 19:53] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | This procedure (in 15 steps) is inspired by : https:// | + | < |
+ | in the process of updating the documentation for | ||
+ | <a href="https:// | ||
+ | may be outdated in the meantime. Thanks for your understanding.< | ||
- | __Before starting, here are the packages to setup on your machine (we suppose you have an apache server running and know how to make basic configuration changes to it):__ | ||
- | * PHP (php5) | + | == Deprecated, go to: == |
- | * PHP modules (php5-mysql, | + | http://www.zotero.org/ |
- | * Apache module: mod_rewrite | + | |
- | * MySQL with root access (mysql-server, | + | |
- | * MongoDB\\ (http:// | + | |
- | * Memcached (same as MongoDB but don't add " | + | |
- | * Ability to configure / | + | |
- | * Subversion client | + | |
- | + | ||
- | Now, we can begin. | + | |
- | + | ||
- | ===== Step 1 ===== | + | |
- | Download Zotero dataserver sources (here: https:// | + | |
- | Use your subversion client to pull down the sources from Zotero' | + | |
- | These files can be anywhere but this guide will assume they are located in / | + | |
- | You can use the following command-line: | + | |
- | < | + | |
- | $ sudo svn co https:// | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 2 ===== | + | |
- | Set up an apache VirtualHost for the dataserver.\\ | + | |
- | Use this code: | + | |
- | < | + | |
- | NameVirtualHost *:443 | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | SSLEngine on | + | |
- | SSLCertificateFile / | + | |
- | SSLCertificateKeyFile / | + | |
- | < | + | |
- | Options FollowSymLinks MultiViews | + | |
- | AllowOverride All | + | |
- | Order allow, | + | |
- | Allow from all | + | |
- | </ | + | |
- | AllowEncodedSlashes On | + | |
- | </ | + | |
- | </ | + | |
- | + | ||
- | Save this code as the file " | + | |
- | + | ||
- | NOTE: don't forget | + | |
- | < | + | |
- | $ sudo mkdir / | + | |
- | $ cd / | + | |
- | $ sudo openssl req -config / | + | |
- | $ sudo openssl rsa -in privkey.pem -out server.key | + | |
- | $ sudo openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365 | + | |
- | $ sudo openssl x509 -in server.crt -out server.der.crt -outform DER | + | |
- | $ sudo cp server.crt / | + | |
- | $ sudo cp server.key / | + | |
- | $ cd / | + | |
- | $ sudo ln -s ../ | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 3 ===== | + | |
- | Add an /etc/hosts entry for sync.zotero.org and api.zotero.org to the IP address of the server.\\ | + | |
- | Command to edit /etc/hosts: | + | |
- | < | + | |
- | $ sudo pico /etc/hosts | + | |
- | </ | + | |
- | + | ||
- | It should be like this (for example): | + | |
- | < | + | |
- | 127.0.0.1 localhost | + | |
- | + | ||
- | 192.168.142.21 sync.zotero.org | + | |
- | </code> | + | |
- | + | ||
- | Make this for all the machines that will access to the server. | + | |
- | + | ||
- | + | ||
- | ===== Step 4 ===== | + | |
- | Copy the sample config files under /include/config and remove " | + | |
- | You'll need to edit these two files later (cf. Step 8). | + | |
- | + | ||
- | + | ||
- | ===== Step 5 ===== | + | |
- | Change MySQL time zone. It must be UTC time.\\ | + | |
- | So, edit my.cnf file in /etc/mysql/ directory.\\ | + | |
- | Add the " | + | |
- | < | + | |
- | [mysqld] | + | |
- | ... | + | |
- | ... | + | |
- | default-time-zone = ' | + | |
- | </ | + | |
- | + | ||
- | Restart MySQL: | + | |
- | < | + | |
- | $ sudo / | + | |
- | </ | + | |
- | + | ||
- | ===== Step 6 ===== | + | |
- | Create zotero_cache database (using cache.sql in /misc/ directory).\\ | + | |
- | Create zotero_www_test and zotero_www databases.\\ | + | |
- | Create a users table for zotero_www_test and zotero_www (not for zotero_cache): | + | |
- | < | + | |
- | CREATE TABLE `users` ( | + | |
- | `userID` | + | |
- | `username` | + | |
- | `slug` | + | |
- | `password` | + | |
- | `email` | + | |
- | `openid` | + | |
- | `role` | + | |
- | `resetValidationKey` char(40) | + | |
- | `resetValidationExp` int NULL, | + | |
- | `emailValidationKey` char(10) | + | |
- | `emailValidated` | + | |
- | `hasImage` | + | |
- | `lastUpdated` | + | |
- | `dateRegistered` | + | |
- | PRIMARY KEY (`userID`), | + | |
- | UNIQUE KEY (`username`), | + | |
- | UNIQUE KEY (`slug`), | + | |
- | UNIQUE KEY (`email`), | + | |
- | UNIQUE KEY (`resetValidationKey`) | + | |
- | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 7 ===== | + | |
- | Give write access to the /tmp/ directory to apache. | + | |
- | + | ||
- | + | ||
- | ===== Step 8 ===== | + | |
- | Edit config.inc.php, | + | |
- | * **config.inc.php**: | + | |
- | < | + | |
- | <? | + | |
- | class Z_CONFIG { | + | |
- | public static $API_ENABLED = true; | + | |
- | public static $SYNC_ENABLED = true; | + | |
- | public static $PROCESSORS_ENABLED = true; | + | |
- | public static $MAINTENANCE_MESSAGE = ' | + | |
- | + | ||
- | public static $TESTING_SITE = true; | + | |
- | public static $DEV_SITE = true; | + | |
- | + | ||
- | public static $BASE_URI = ''; | + | |
- | + | ||
- | public static $AUTH_SALT = ''; | + | |
- | public static $API_SUPER_USERNAME = ''; | + | |
- | public static $API_SUPER_PASSWORD = ''; | + | |
- | + | ||
- | public static $API_BASE_URI = ''; | + | |
- | public static $SYNC_DOMAIN = ' | + | |
- | + | ||
- | public static $S3_BUCKET = ''; | + | |
- | public static $S3_ACCESS_KEY = ''; | + | |
- | public static $S3_SECRET_KEY = ''; | + | |
- | + | ||
- | public static $MEMCACHED_ENABLED = false; | + | |
- | public static $MEMCACHED_SERVERS = array( | + | |
- | ' | + | |
- | ); | + | |
- | + | ||
- | public static $MONGO_SERVERS = array( | + | |
- | ' | + | |
- | ); | + | |
- | public static $MONGO_DB = " | + | |
- | public static $MONGO_SAFE_NUM = 2; | + | |
- | + | ||
- | public static $TRANSLATE_SERVERS = array( | + | |
- | " | + | |
- | ); | + | |
- | + | ||
- | public static $CITE_SERVERS = array( | + | |
- | " | + | |
- | ); | + | |
- | + | ||
- | public static $LOG_TO_SCRIBE = false; | + | |
- | public static $LOG_ADDRESS = ''; | + | |
- | public static $LOG_PORT = 1463; | + | |
- | public static $LOG_TIMEZONE = ' | + | |
- | public static $LOG_TARGET_DEFAULT = ' | + | |
- | + | ||
- | public static $PROCESSOR_PORT_DOWNLOAD = 3455; | + | |
- | public static $PROCESSOR_PORT_UPLOAD = 3456; | + | |
- | public static $PROCESSOR_PORT_ERROR = 3457; | + | |
- | public static $PROCESSOR_PORT_INDEX = 3458; | + | |
- | + | ||
- | public static $PROCESSOR_LOG_TARGET_DOWNLOAD = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_UPLOAD = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_ERROR = ' | + | |
- | public static $PROCESSOR_LOG_TARGET_INDEX = ' | + | |
- | + | ||
- | public static $SYNC_DOWNLOAD_SMALLEST_FIRST = false; | + | |
- | public static $SYNC_UPLOAD_SMALLEST_FIRST = false; | + | |
- | + | ||
- | // Set some things manually for running via command line | + | |
- | public static $CLI_PHP_PATH = '/ | + | |
- | public static $CLI_DOCUMENT_ROOT = "/ | + | |
- | + | ||
- | public static $SYNC_ERROR_PATH = '/ | + | |
- | public static $API_ERROR_PATH = '/ | + | |
- | } | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | * **dbconnect.inc.php**: | + | |
- | < | + | |
- | <? | + | |
- | function Zotero_dbConnectAuth($db) { | + | |
- | if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else if ($db == ' | + | |
- | $host = ' | + | |
- | $port = 3306; | + | |
- | $db = ' | + | |
- | $user = ' | + | |
- | $pass = ' | + | |
- | } | + | |
- | + | ||
- | else { | + | |
- | throw new Exception(" | + | |
- | } | + | |
- | return array(' | + | |
- | } | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | * **Sync.inc.php** (in /model/ directory): | + | |
- | + | ||
- | Put the following lines in comment (or delete them): | + | |
- | < | + | |
- | if (!Zotero_Libraries:: | + | |
- | throw new Exception(" | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | These are lines 1406 to 1408.\\ | + | |
- | + | ||
- | I'm now searching why I have a problem with these lines and how to fix it... | + | |
- | + | ||
- | + | ||
- | ===== Step 9 ===== | + | |
- | Loading https:// | + | |
- | /!\ You must accept SSL certificates before (on https:// | + | |
- | + | ||
- | + | ||
- | ===== Step 10 ===== | + | |
- | Create or edit .my.cnf in your home directory (/ | + | |
- | < | + | |
- | [client] | + | |
- | user=root | + | |
- | password=root_password | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 11 ===== | + | |
- | Change directory to /misc/ directory. | + | |
- | + | ||
- | + | ||
- | ===== Step 12 ===== | + | |
- | Edit test_reset and test_setup.\\ | + | |
- | * In test_reset AND test_setup: replace all " | + | |
- | * In test_reset: replace | + | |
- | < | + | |
- | # Set up sample users | + | |
- | echo " | + | |
- | echo " | + | |
- | echo " | + | |
- | </ | + | |
- | + | ||
- | by | + | |
- | + | ||
- | < | + | |
- | # Set up sample user in zotero_www_test | + | |
- | echo " | + | |
- | echo " | + | |
- | + | ||
- | # Set up sample user in zotero_www | + | |
- | echo " | + | |
- | echo " | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 13 ===== | + | |
- | Launch the command: | + | |
- | < | + | |
- | $ sudo ./ | + | |
- | </ | + | |
- | + | ||
- | Normally, there are few little errors but nothing fatal. I didn't pay attention to it. | + | |
- | + | ||
- | + | ||
- | ===== Step 14 ===== | + | |
- | Launch daemons.\\ | + | |
- | There are 4 daemons, each in its own directory under the processor directory. Fire up for shells and run each independently in the foreground! | + | |
- | < | + | |
- | $ cd processor/ | + | |
- | $ php daemon.php | + | |
- | $ cd processor/ | + | |
- | $ php daemon.php | + | |
- | $ cd processor/ | + | |
- | $ php daemon.php | + | |
- | $ cd processor/ | + | |
- | $ php daemon.php | + | |
- | </ | + | |
- | + | ||
- | In all cases you should see the output similar to this (the daemon name will vary): | + | |
- | < | + | |
- | Starting sync download processor daemon | + | |
- | 0 processors, 0 queued processes | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Step 15 ===== | + | |
- | You can try to sync Zotero with login=testuser and password=testuser.\\ | + | |
- | Normally, it works! | + | |
- | \\ \\ | + |