FoolFuuka/Install/Windows

Pastebin VgYyQrCL

0) You need git installed and Java and the Java Development Kit installed (available at https://git-scm.com/download/win and http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html respectively).

0.5) Install imagemagick from http://www.imagemagick.org/script/binary-releases.php choose the windows binary. Install using the default settings.

1) Download MariaDB. This can be found at https://downloads.mariadb.org/. You should use the latest stable version. At the time of writing, this was version 10.1.9. Select the "MSI Package" and for a 64 bit system if you have one, otherwise use the x86 package. When you click the download link, just choose "No thanks, just take me to the download".

2) Open the installer, you do not need to install the "Third Party Tools", the "Development Components", or the "Debug Symbols". You should set a root password on the next screen. Use a complex password, but be sure to remember it or write it down, as you will need to use it shortly. Do not allow remote access or create an anonymous account. Click next. Be sure to install as a service, enable networking, and Optimize for Transactions. Click install.

3) Create a folder in your C: drive to store the program files for Apache and PHP. Example: C:\WebServer.

4) Download Apache for windows. You should use the VC11 latest version (available here: http://www.apachelounge.com/download/VC11/ ). At the time of writing, this was version 2.4.17. Select the ".zip" and for a 64 bit system if you have one, otherwise use the x86 package. Copy the "Apache24" folder into "C:\WebServer". You should have "C:\WebServer\Apache24".

5) Download PHP for windows. Use the 5.6.16 version (available here: http://windows.php.net/download/ ). PHP 7 is not compatible with FoolFuuka. Use the thread safe version. Select the "Zip" and for a 64 bit system if you have one, otherwise use the x86 package. Copy the contents of the zip into a new folder "C:\WebServer\PHP\".

6) Install OpenSSL. Go to http://slproweb.com/products/Win32OpenSSL.html and choose the latest "Light" installer. Choose to install the OpenSSL DLLs to the Windows system directory. Install it.

6.5) Install Maven from http://maven.apache.org/download.cgi choose the binary zip archive. Copy the apache-maven-3.3.9 folder to C:\.

7)

WARNING! MODIFYING THE PATH CAN BE DANGEROUS! DO NOT REMOVE ANYTHING THAT WAS ALREADY ADDED TO YOUR PATH VARIABLE.

Add php and maven to your path. Go to Control Panel > System and Security > System and click on "Advanced System Settings". Click on "Environmental Variables". Click on Path and click "Edit". If you are on windows 7/8/10 Home, ADD ";C:\WebServer\PHP;C:\apache-maven-3.3.9\bin" TO THE END OF THE LINE. If you are on Windows 10 (Pro), Click "New" and add "C:\WebServer\PHP" and "C:\apache-maven-3.3.9\bin" to the list. Click OK on all the dialog boxes and then log off and log back on. Make a new Environmental Variable "JAVA_HOME" and give it the contents "C:\Program Files\Java\jdk1.8.0_65".

8) Configure PHP. Open your "C:\WebServer\PHP" folder and rename "php.ini-production" to "php.ini". Click OK on the warning. Open the php.ini file in a text editor and go to the "extension" lines and above them, add "extension_dir=C:\WebServer\PHP\ext\" and then uncomment the "extension=php_openssl.dll", the "extension=php_curl.dll", the "extension=php_fileinfo.dll" line, the "extension=php_mbstring.dll" line, the "extension=php_mysqli.dll" line, and the "extension=php_pdo_mysql.dll" line. At the end of the file, add "date.timezone = UTC". Edit "post_max_size = 8M" to "post_max_size = 64M", "upload_max_filesize = 2M" to "upload_max_filesize = 64M", and "max_execution_time = 30" to "max_execution_time = 60"

9) Install Composer. Go to https://getcomposer.org/download/ and install the "Windows Installer". You do not need to install the Shell menus. Use the php file located in "C:\WebServer\PHP".

10) Log off and log back on again.

11) Edit "C:\WebServer\Apache24\conf\httpd.conf". Add :

   LoadModule php5_module "C:/WebServer/PHP/php5apache2_4.dll"
   AddType application/x-httpd-php .php 
   PHPIniDir "c:/WebServer/PHP"

at the end of the "LoadModule" section. Add :

   <IfModule mpm_winnt_module>
      ThreadStackSize 8388608
   </IfModule>

to the end of the file. And Replace

   #LoadModule rewrite_module modules/mod_rewrite.so => LoadModule rewrite_module modules/mod_rewrite.so
   ServerRoot "c:/Apache24" => ServerRoot "c:/WebServer/Apache24"
   DocumentRoot "c:/Apache24/htdocs" => DocumentRoot "C:/WebServer/foolfuuka/public"
   <Directory "c:/Apache24/htdocs"> => <Directory "C:/WebServer/foolfuuka/public">
   DirectoryIndex index.html => DirectoryIndex index.html index.php

Edit the "AllowOverride None" directive in the '<Directory "C:\WebServer\foolfuuka\public">' block to "AllowOverride All".

12) Open a command prompt (as an administrator):

   cd C:\WebServer\
   composer create-project foolz/foolfuuka foolfuuka --prefer-source
   cd foolfuuka
   composer dump-autoload --optimize
   composer install  ### Choose yes to third party assets.
   cd app/foolz/foolframe/plugins
   mkdir foolz
   cd foolz
   git clone https://dev.foolz.us/foolframe-plugins/foolframe-plugin-articles.git
   cd ../../../foolfuuka/plugins
   mkdir foolz
   cd foolz
   git clone https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-board-statistics.git
   git clone https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-dice-roll.git
   git clone https://dev.foolz.us/foolfuuka-plugins/foolfuuka-plugin-quests.git
   cd C:\WebServer\Apache24\bin
   httpd.exe -k install 
   net start Apache2.4
   cd "C:\Program Files\MariaDB 10.1\bin"
   mysqld --install
   net start MySQL
   mysql -u root -p ## Login using your passwork you made in the MariaDB install
   	CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'jasdk342llfjruw';	
   	CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'asdfh424fasd';
   	CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   	CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   	GRANT ALL PRIVILEGES ON `asagi`. * TO 'asagi'@'localhost';
   	GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
   	GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
   	FLUSH PRIVILEGES;
   	exit


13) Go to http://localhost/, follow the install. MySQL details are:

Hostname: localhost
Database: foolfuuka
Username: foolfuuka
Password: asdfh424fasd
prefix: ff_

14) Install and compile Asagi from source. In a new command prompt:

   git clone https://github.com/FoolCode/asagi.git
   cd asagi
   mvn package assembly:single
   move target\asagi-0.4.0-SNAPSHOT-full.jar .\asagi.jar


15) Rename asagi.json.example to asagi.json. Edit as necessary. This example config stores full images (make mediaThreads 0 if you only want thumbs), thumbs, and text for /a/ and /qa/

{
    "settings": {
        "dumperEngine": "DumperJSON",
        "sourceEngine": "YotsubaJSON",

        "boardSettings": {
            "default": {
                "engine": "Mysql",
                "database": "asagi",
                "host": "localhost",
                "username": "asagi",
                "password": "jasdk342llfjruw",
                "charset": "utf8mb4",

                "path": "C:\\WebServer\\foolfuuka\\public\\foolfuuka\\boards",
                "useOldDirectoryStructure": false,
                "webserverGroup": "www-data",

                "newThreadsThreads": 5,
                "thumbThreads": 3,
                "mediaThreads": 3,
                "deletedThreadsThresholdPage": 8,

                "refreshDelay": 10,
                "throttleAPI": true,
                "throttleURL": "a.4cdn.org",
                "throttleMillisec": 100,
                "threadRefreshRate": 3
            },

            "a": {}, "qa": {}
        }
    }
}

16) open a command prompt and do:

   cd asagi
   java -jar asagi.jar

Asagi should begin dumping. Let this run for 5 mins before you continue.

16) Go to http://localhost/admin, login with the account you just created.

  • Update (General>Preferences) convert exec to "C:\Program Files\ImageMagick-6.9.2-Q16\convert.exe". Check all the themes. Save the settings.
  • Update the board DB (asagi), and remove the board prefix.
  • Add the boards in Boards > Manage > Add Board
    • Make the Name the title of the board
    • Make shortname the same name as the board (example: fit)
    • Make sure you check "Is this a 4chan archiving board?"
    • Make sure you check "Is the archive storing full images?" (unless you are not)
    • Make sure you check "Use SphinxSearch as search engine."
    • Save the board and repeat for every other board.

17) Setup SphinxSearch. Go to http://sphinxsearch.com/downloads/release/ and download the "Win64 binaries w/MySQL+id64 support" if you have a 64 bit system, otherwise, get the "Win32 binaries w/MySQL support". Copy the folder inside the ZIP to C:\WebServer. You should now have a C:\WebServer\sphinx-2.2.10-release-win64 folder (or similar). Open this folder and make a new folder named 'data'.

18) Go to http://localhost/admin/boards/search/ and check "Activate Sphinx globally (enables crossboard search)". Add your sphinx folder to the "Working Directory" setting (Example: C:\WebServer\sphinx-2.2.10-release-win64\). Click "Save". On the next screen, click "Generate Config". Copy and paste this into a text editor. Edit the sql variables at the top of the file. An example is provided below:

     sql_host = 127.0.0.1
     sql_user = asagi
     sql_pass = jasdk342llfjruw
     sql_db   = asagi
     sql_port = 3306

save this file as 'sphinx.conf' into your sphinx directory (Example: C:\WebServer\sphinx-2.2.10-release-win64\). Open a command prompt as an administrator and do:

   cd C:\WebServer\sphinx-2.2.10-release-win64\
   bin\indexer.exe --rotate --all
   bin\searchd.exe --install --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf
   net start searchd

This part should also be done in a command prompt, but this is an example using the boards a and qa. Change the boards here and add more as necessary sepearated by a space.

   C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_ancient qa_ancient
   C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_main qa_main
   C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_delta qa_delta

Search should now be up and running, but we need to have it update. Open up the "Task Scheduler" on your computer. Click "Create Basic Task" on the sidebar.

   Name:  "Archive Delta Update",
   Time: Daily,
   Frequency: 1 day @ 12:01 AM,
   Action: Start a Program,
       Program: C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe 
       Arguments: --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_ancient qa_ancient
       Start in: C:\WebServer\sphinx-2.2.10-release-win64\

Check "Open Properties when I click Finish".

On the "General" Tab, check "Run whether this user is logged in or not" and "Run with highest privileges".

On the "Triggers" Tab, click "Edit", check the box for "Repeat task every:" and select "5 minutes". Check "Stop all running tasks at the end of repetition duration".

Click 'OK'. Enter your password if prompted.

Click "Create Basic Task" on the sidebar.

   Name:  "Archive Main Update",
   Time: Daily,
   Frequency: 1 day @ 12:01 AM,
   Action: Start a Program,
       Program: C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe 
       Arguments: --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_main qa_main
       Start in: C:\WebServer\sphinx-2.2.10-release-win64\

Check "Open Properties when I click Finish".

On the "General" Tab, check "Run whether this user is logged in or not" and "Run with highest privileges".

On the "Triggers" Tab, click "Edit", check the box for "Repeat task every:" and select "1 hour". Check "Stop all running tasks at the end of repetition duration".

Click 'OK'. Enter your password if prompted.

Click "Create Basic Task" on the sidebar.

   Name:  "Archive Ancient Update",
   Time: Monthly,
       Months, Select all Months,
       Days, 1,
   Frequency: 1 day @ 12:01 AM,
   Action: Start a Program,
       Program: C:\WebServer\sphinx-2.2.10-release-win64\bin\indexer.exe 
       Arguments: --config C:\WebServer\sphinx-2.2.10-release-win64\sphinx.conf --rotate a_ancient qa_ancient
       Start in: C:\WebServer\sphinx-2.2.10-release-win64\

Check "Open Properties when I click Finish".

On the "General" Tab, check "Run whether this user is logged in or not" and "Run with highest privileges".

On the "Triggers" Tab, click "Edit", check the box for "Repeat task every:" and select "1 hour". Check "Stop all running tasks at the end of repetition duration".

Click 'OK'. Enter your password if prompted.

Congratulations. You have done it! You can close out all windows EXCEPT the command prompt which contains Asagi. If asagi is closed, new posts will not be fetched. Always be sure Asagi is opened after a restart. You may want to create a batch file that launches asagi on boot or look into third party programs that can create Asagi into a system service that always runs (such as http://www.firedaemon.com/).