Editing FoolFuuka/Install/Ubuntu16

From Bibliotheca Anonoma

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 4: Line 4:


__NOTOC__
__NOTOC__
== PHP7 Dependencies ==
We actually use PHP 7 now so here are the known dependencies (substitute php7.2 for your favorite point version):
<pre>
apt-get install php7.2-cli php7.2-fpm php7.2-bcmath php7.2-json php7.2-opcache php7.2-readline php7.2-curl php7.2-mysql php7.2-mbstring php7.2-gd php7.2-zip php7.2-xml
apt-get install git nginx percona-server-server-5.7 imagemagick maven openjdk-9-jdk-headless redis-server
apt-get install percona-server-tokudb-5.7
</pre>
php7.2-pdo is also required, but php7.2-mysql should bring it in as a dependency.
== Prepare things ==
== Prepare things ==


Line 25: Line 12:
[https://docs.hhvm.com/hhvm/installation/linux#ubuntu-16.10-yakkety from docs.hhvm.com]
[https://docs.hhvm.com/hhvm/installation/linux#ubuntu-16.10-yakkety from docs.hhvm.com]
<pre>sudo apt-get install software-properties-common
<pre>sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
sudo add-apt-repository &quot;deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main&quot;</pre>
sudo add-apt-repository &quot;deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main&quot;</pre>


== Add repo for Percona Server for MySQL 5.7 ==
== Add repo for MariaDB 10.1 ==


[https://www.percona.com/doc/percona-server/5.7/installation/apt_repo.html from www.percona.com]
[https://downloads.mariadb.org/mariadb/repositories/#mirror=accretive from downloads.mariadb.org]


<pre>wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
<pre>sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb</pre>
sudo add-apt-repository &quot;deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main&quot;</pre>


== Add repo for NGINX Stable ==
== Add repo for NGINX Stable ==


[https://nginx.org/en/linux_packages.html#stable from nginx.org]
[https://downloads.mariadb.org/mariadb/repositories/#mirror=accretive from downloads.mariadb.org]


<pre>wget https://nginx.org/keys/nginx_signing.key
<pre>wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo apt-key add nginx_signing.key
sudo add-apt-repository &quot;deb http://nginx.org/packages/ubuntu/ $(lsb_release -sc) nginx&quot;</pre>
sudo add-apt-repository &quot;deb http://nginx.org/packages/ubuntu/ xenial nginx&quot;</pre>


== Add repo for sphinxsearch ==
== Add repo for sphinxsearch ==


[http://sphinxsearch.com/docs/current/installing-debian.html from sphinxsearch.com]
{{Note|Todo}}
<pre>sudo add-apt-repository ppa:builds/sphinxsearch-rel22</pre>


== Install all the needed packages. ==
== Install all the needed packages. ==
Line 53: Line 39:


<pre>sudo apt-get update
<pre>sudo apt-get update
sudo apt-get install git nginx hhvm percona-server-server-5.7 percona-server-tokudb-5.7 imagemagick maven openjdk-9-jdk-headless redis-server sphinxsearch</pre>
sudo apt-get install git nginx hhvm mariadb-server mariadb-client imagemagick maven openjdk-8-jdk-headless</pre>


== Install composer for downloading FoolFuuka dependencies. ==
== Install composer for downloading FoolFuuka dependencies. ==
Line 61: Line 47:


<pre>sudo mv composer.phar /usr/local/bin/composer</pre>
<pre>sudo mv composer.phar /usr/local/bin/composer</pre>
== Enable the hhvm service. ==
<pre>sudo systemctl enable hhvm</pre>
== Install hhvm with nginx ==


<pre>TODO</pre>
== Edit HHVM config to use a unix socket. ==
== Edit HHVM config to use a unix socket. ==


Line 76: Line 68:
upload_max_filesize = 32M
upload_max_filesize = 32M
post_max_size = 32M
post_max_size = 32M
hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.socket = /var/run/mysqld/mysqld.sock
</nowiki>}}
</nowiki>}}


== Enable the hhvm service. ==
== Restart HHVM ==
 
<pre>sudo systemctl enable hhvm</pre>


<pre>sudo service hhvm restart</pre>
== Download FoolFuuka and install dependencies. ==
== Download FoolFuuka and install dependencies. ==


Line 102: Line 90:
cd foolz
cd foolz
git clone https://github.com/pleebe/foolframe-plugin-articles.git</pre>
git clone https://github.com/pleebe/foolframe-plugin-articles.git</pre>
<!-- Or use <https://github.com/FoolCode/foolframe-plugin-articles> if that's not available -->
<!-- Or use <https://github.com/FoolCode/foolframe-plugin-articles> if that's not available -->
<pre>cd /var/www/foolfuuka/app/foolz/foolfuuka/plugins
<pre>cd /var/www/foolfuuka/app/foolz/foolfuuka/plugins
mkdir foolz
mkdir foolz
Line 121: Line 111:
== Set Permissions and Group for FoolFuuka Directory ==
== Set Permissions and Group for FoolFuuka Directory ==


<pre>sudo mkdir /var/www/foolfuuka/public/foolfuuka/boards/
<pre>sudo chown -Rf www-data:www-data /var/www/foolfuuka</pre>
sudo chown -Rf www-data:www-data /var/www/foolfuuka
sudo chmod 777 /var/www/foolfuuka/public/foolfuuka/boards/</pre>
 
== Install hhvm with nginx ==
 
Change the user in /etc/nginx/nginx.conf to www-data
 
{{hc|sudo nano /etc/nginx/hhvm.conf|<nowiki>
location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
</nowiki>}}


== Configure Nginx to host foolfuuka ==
== Configure Nginx to host foolfuuka ==


Create this file
{{hc|sudo nano /etc/nginx/sites-enabled/default|<nowiki>
{{hc|sudo nano /etc/nginx/sites-enabled/archive.conf|<nowiki>
        root /home/ubuntu/foolfuuka/public;
server {
        index index.php index.html index.htm;
listen 80;
listen [::]:80;
#listen 443 ssl;
#listen [::]:443 ssl;
 
#ssl_certificate /etc/nginx/ssl/myarchive.local.crt;
#ssl_certificate_key /etc/nginx/ssl/myarchive.local.key;


root /var/www/foolfuuka/public;
        client_max_body_size 32M; # set to the same as max PHP upload size in HHVM
index index.php;
        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }


server_name myarchive.local;
        location ~ \.php$ {
include hhvm.conf;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }


client_max_body_size 2M;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
}
</nowiki>}}
</nowiki>}}


== Disable transparent_hugepage ==
== Restart Nginx ==


Add this to your /etc/rc.local file
<pre>sudo service nginx restart</pre>
<pre>su -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' &</pre>


<pre>sudo nano /etc/default/grub</pre>


append {{ic|<nowiki>transparent_hugepage=never</nowiki>}} to {{ic|GRUB_CMDLINE_LINUX_DEFAULT}}, then save the file


<pre>sudo update-grub</pre>
== edit MariaDB to use utf8mb4 for correct unicode processing ==


== Raise file limit ==
{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
 
[client]
{{hc|sudo nano /etc/security/limits.conf|
default-character-set = utf8mb4
* soft nofile 63545
* hard nofile 63545
* soft nproc 63545
* hard nproc 63545
}}
 
== edit Percona to use utf8mb4 for correct unicode processing ==
Enable toku (Find and Uncomment the load module)


<pre>ps-admin --enable-tokudb -u root -p</pre>
You may need to run that command again. Check the output to verify.
{{hc|sudo nano /etc/mysql/conf.d/mysql.cnf|<nowiki>
[mysql]
[mysql]
default-character-set = utf8mb4
default-character-set = utf8mb4
</nowiki>}}


{{hc|sudo nano /etc/mysql/percona-server.conf.d/mysqld.cnf|<nowiki>
[mysqld]
[mysqld]
character-set-client-handshake = FALSE
character-set-client-handshake = FALSE
character-set-server = utf8mb4
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
collation-server = utf8mb4_general_ci
open-files-limit=40000
skip-log-bin
default_storage_engine = TokuDB
max_connections = 1000
[client]
default-character-set = utf8mb4
</nowiki>}}
</nowiki>}}


<pre>sudo systemctl stop mysql
sudo reboot</pre>


== Create the database and install Foolfuuka user accounts. ==
== Create the database and install Foolfuuka user accounts. ==


<pre>sudo mysql_secure_installation</pre>
<pre>sudo mysql_secure_installation</pre>
<pre>mysql -u root -p
<pre>mysql -uroot -p
  SET GLOBAL default_storage_engine=TokuDB;
  SET GLOBAL log_bin_trust_function_creators = 1;
   CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'pass';   
   CREATE USER 'asagi'@'localhost' IDENTIFIED BY 'pass';   
   CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'pass';
   CREATE USER 'foolfuuka'@'localhost' IDENTIFIED BY 'pass';
  CREATE USER 'sphinx'@'localhost' IDENTIFIED BY 'pass';
   CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE asagi DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
   CREATE DATABASE foolfuuka DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
Line 228: Line 166:
   GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `asagi`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
   GRANT ALL PRIVILEGES ON `foolfuuka`. * TO 'foolfuuka'@'localhost';
  GRANT SELECT ON `asagi`.* TO 'sphinx'@'localhost';
  GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, TRIGGER, SHOW VIEW ON `asagi`.`index_counters` TO 'sphinx'@'localhost' WITH GRANT OPTION;
   FLUSH PRIVILEGES;
   FLUSH PRIVILEGES;
   exit</pre>
   exit</pre>
== Restart MariaDB ==
<pre>sudo service mysql restart</pre>
Disable transparent_hugepage
<pre>su -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'</pre>
<pre>sudo nano /etc/default/grub</pre>
append {{ic|<nowiki>transparent_hugepage=never</nowiki>}} to {{ic|GRUB_CMDLINE_LINUX_DEFAULT}}, then save the file
<pre>sudo update-grub</pre>
Enable toku (Find and Uncomment the load module)
<pre>sudo nano /etc/mysql/conf.d/tokudb.cnf </pre>
Raise file limit
{{hc|sudo nano /etc/security/limits.conf|
* soft nofile 63545
* hard nofile 63545
* soft nproc 63545
* hard nproc 63545
}}
Increase mysql file limit:
{{hc|sudo nano /etc/mysql/my.cnf|<nowiki>
# Put this after [mysqld]
open-files-limit=40000
</nowiki>}}
<pre>sudo service mysql stop
sudo reboot</pre>
<pre>mysql -u root -p
set global default_storage_engine=TokuDB;
SET GLOBAL log_bin_trust_function_creators = 1;</pre>
Now, Install FoolFuuka at the website using foolfuuka credentials


== Install and compile Asagi from source. ==
== Install and compile Asagi from source. ==


<pre>
<pre>cd ~
sudo adduser asagi
git clone https://github.com/FoolCode/asagi.git
sudo su asagi
cd ~
git clone https://github.com/desuarchive/asagi.git
cd asagi
cd asagi
mvn package assembly:single
mvn package assembly:single
mv target/asagi-0.4.0-SNAPSHOT-full.jar ./asagi.jar</pre>
mv target/asagi-0.4.0-SNAPSHOT-full.jar ./asagi.jar</pre>
== Configure Asagi ==
== Configure Asagi ==


<pre>nano asagi.json</pre>
<pre>cp asagi.json.example asagi.json
nano asagi.json</pre>


Insert the following JSON into that file:
Insert the following JSON into that file:
Line 261: Line 234:
       "host": "localhost",
       "host": "localhost",
       "username": "asagi",
       "username": "asagi",
       "password": "pass",
       "password": "afj8a428dauwj",
       "charset": "utf8mb4",
       "charset": "utf8mb4",
       "path": "/var/www/foolfuuka/public/foolfuuka/boards/",
       "path": "/home/ubuntu/foolfuuka/public/foolfuuka/boards/",
       "useOldDirectoryStructure": false,
       "useOldDirectoryStructure": false,
       "webserverGroup": "www-data",
       "webserverGroup": "www-data",
Line 272: Line 245:
       "refreshDelay": 30,
       "refreshDelay": 30,
       "throttleAPI": true,
       "throttleAPI": true,
       "throttleURL": "a.4cdn.org",
       "throttleURL": "api.4cdn.org",
       "throttleMillisec": 11100,
       "throttleMillisec": 11100,


Line 374: Line 347:
<pre>screen java -Xmx6144m -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -XX:MaxPermSize=512m -jar asagi.jar</pre>
<pre>screen java -Xmx6144m -XX:+UseParallelGC -XX:+UseParallelOldGC -verbose:gc -XX:MaxPermSize=512m -jar asagi.jar</pre>


Now, Configure asagi as the database and remove the table prefix from FoolFuuka.
== Install FoolFuuka ==
== Install FoolFuuka ==
Now, Install FoolFuuka at the website using foolfuuka credentials
Then, Configure asagi as the database and remove the table prefix from FoolFuuka.


The installer is quite self explanatory, just make sure to remove the Boards prefix.
The installer is quite self explanatory, just make sure to remove the Boards prefix.
Line 383: Line 354:
Also make sure to install imagemagick and set the path in the config to it.
Also make sure to install imagemagick and set the path in the config to it.


{{Note|<nowiki>In the installer one should have FoolFuuka table prefix set (default is fine ff_). But after installing one needs to set BOARD PREFIX to blank since asagi doesn't have any. FoolFuuka table prefix != board table prefix.</nowiki>}}
{{Note|In the installer one should have FoolFuuka table prefix set (default is fine ff_). But after installing one needs to set BOARD PREFIX to blank since asagi doesn't have any. FoolFuuka table prefix != board table prefix. Here's [https://github.com/p0wer0n/FoolFrame/commit/3368e24dc9d89b881460f8c876ddb91c78b5b955 a code change that does it.]}}


== Add boards, Configure Sphinx ==
== Add boards, Configure Sphinx ==
Line 394: Line 365:
<pre>
<pre>
/var/lib/sphinxsearch
/var/lib/sphinxsearch
</pre>
=== Supplement Sphinxsearch ===
<pre>
cd /var/run
sudo mkdir sphinxsearch
sudo chmod -Rf 777 sphinxsearch
</pre>
</pre>


Line 420: Line 399:
=== Build the indexes ===
=== Build the indexes ===


<pre>sudo indexer *_ancient --rotate
<pre>sudo indexer *_ancient --rotate</pre>
sudo indexer *_main --rotate
<pre>sudo indexer *_main --rotate</pre>
sudo indexer *_delta --rotate</pre>


=== Configure Crontab ===
=== Configure Crontab ===
<pre>
<pre>
sudo crontab -e
sudo nano /etc/crontab
</pre>
</pre>
<pre>
<pre>
Line 433: Line 411:
@monthly sudo -u sphinxsearch /usr/bin/indexer --rotate *_ancient > /dev/null
@monthly sudo -u sphinxsearch /usr/bin/indexer --rotate *_ancient > /dev/null
</pre>
</pre>


=== Adding Archives ===
=== Adding Archives ===
Line 440: Line 419:


Then, in the admin panel, simply add the board that corresponds to the board you injected.
Then, in the admin panel, simply add the board that corresponds to the board you injected.
{{Note| This only applies if you are importing a new board. For importing a dump to an existing board table, you will need to use the fuuka-to-asagi tool found in the [https://github.com/FoolCode/asagi-toolkit asagi-toolkit]}}


== Extra configuration ==
== Extra configuration ==
Line 454: Line 431:
</pre>
</pre>
and make sure it is the same value in Admin panel -> general -> Imagemagick Convert
and make sure it is the same value in Admin panel -> general -> Imagemagick Convert
=== Enable Redis Cache ===
{{hc|nano /var/www/foolfuuka/app/foolz/foolframe/config/cache.php|<nowiki>
<?php
return array (
  'type' => 'redis',
  'format' => 'smart_json',
  'prefix' => 'foolframe_TUi_',
  'servers' =>
  array (
  ),
);</nowiki>}}
<!-- Oddities: Create /etc/tmpfiles.d/mysql.conf
Please note that all contributions to Bibliotheca Anonoma are considered to be released under the Creative Commons Attribution-ShareAlike (see Bibliotheca Anonoma:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Templates used on this page: