### Install Basic Software and Dependencies Source: https://github.com/foolcode/foolfuuka/wiki/Installing-the-minimal Install essential software and dependencies required for further setup. This command installs build tools, sudo, and image manipulation libraries. ```bash $ apt-get install build-essential sudo libpcre3-dev libssl-de imagemagick graphicsmagick ``` -------------------------------- ### Prepare MySQL User and Directories for Fresh Installation Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Create a dedicated user and group for MySQL, and set up the data directory. This is part of the initial Percona Server setup. ```bash cd /opt mkdir /home/mysql # we like to give mysql a folder in /home, since often it's on a larger HDD groupadd mysql useradd -r -g mysql mysql cp Percona-Server-5.x.xx-relxx.x-xxx.Linux.xxxx /home/mysql/mysql cd /home/mysql/mysql chown -R mysql . chgrp -R mysql . ``` -------------------------------- ### Start and Autostart Percona Server Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Start the Percona Server instance and configure it to automatically start on system boot. ```bash /etc/init.d/mysql start [stop|restart] update-rc.d mysql defaults ``` -------------------------------- ### Install sudo and wget Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Ensure sudo and wget are installed on your system before proceeding with Percona Server installation. ```bash apt-get install sudo apt-get install wget ``` -------------------------------- ### Compile and Install PHP Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Compile the PHP source code using 'make' and install it to the system. This step can take a significant amount of time. ```bash make make install ``` -------------------------------- ### Install OpenJDK 6 JRE Source: https://github.com/foolcode/foolfuuka/wiki/Installing-Java-Virtual-Machine Use this command to install the Java Runtime Environment. This is a prerequisite for running applications like Asagi. ```bash $ apt-get install openjdk-6-jre ``` -------------------------------- ### Start Percona Server After Replacement Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Start the Percona Server instance after completing the replacement of MySQL. ```bash /etc/init.d/mysql start # maybe /etc/init.d/mysql.server start ``` -------------------------------- ### Install APC using PECL Source: https://github.com/foolcode/foolfuuka/wiki/Install-APC Use the PECL command-line tool to install the APC extension. ```bash $ pecl install apc ``` -------------------------------- ### Install Build Dependencies Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Install essential build tools and development libraries required for compiling PHP. This ensures all necessary components are available. ```bash apt-get install build-essentials openssl libcurl4-openssl-dev sqlite3 libsqlite3-dev libxml2 libxml2-dev zlib1g-dev bzip2 zip unzip libjpeg-dev libpng-dev ``` -------------------------------- ### Install PHP-FPM Init Script Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Copy the PHP-FPM init script to the system's init directory and make it executable. This allows PHP-FPM to be managed as a service. ```bash cp sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm chmod 755 /etc/init.d/php-fpm ``` -------------------------------- ### Enable PHP-FPM on Boot Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Configure PHP-FPM to start automatically on system boot. This ensures the service is available after a reboot. ```bash update-rc.d php-fpm defaults ``` -------------------------------- ### Start and Manage Nginx Service Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-installation Starts, stops, or restarts the Nginx service using the init script. ```bash /etc/init.d/nginx start [stop|restart] ``` -------------------------------- ### Update Package List and Install Nginx Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-installation Updates the local package index from the newly added repository and installs the Nginx package. ```bash apt-get update ``` ```bash apt-get install nginx ``` -------------------------------- ### Configure PHP Build Options Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Configure the PHP build with specific options, including MySQL support, FPM, and various extensions. Adjust MySQL paths as per your installation. ```bash ./configure --with-mysql=/home/mysql/mysql \ --with-pdo-mysql=/home/mysql/mysql/bin/mysql_config \ --with-mysqli=/home/mysql/mysql/bin/mysql_config \ --enable-zip --enable-sockets --enable-fpm --with-gettext \ --with-gd --enable-ftp --enable-exif --with-curl --with-bz2 \ --with-openssl --with-mcrypt --enable-mbstring --with-jpeg-dir \ --with-png-dir --with-zlib --enable-bcmath ``` -------------------------------- ### Edit PHP-FPM Configuration (`php-fpm.conf`) Source: https://github.com/foolcode/foolfuuka/wiki/Configure-PHP-FPM Configure PHP-FPM process manager settings for dynamic resource allocation. These values are examples for a 16GB RAM server and should be adjusted based on server resources. ```bash $ nano /usr/local/etc/php-fpm.conf ``` ```ini pm = dynamic # else the rest won't work pm.max_children = 100 # < 20 on 512mb RAM pm.start_servers = 30 # < 10 digit on 512mb RAM pm.min_spare_servers = 30 # < 10 on 512mb RAM pm.max_spare_servers = 100 # < 20 on 512mb RAM pm.max_requests = 250 # respawns the thread to avoid lockups, low is fine ``` -------------------------------- ### Remove Apache Web Server Source: https://github.com/foolcode/foolfuuka/wiki/Installing-the-minimal Use this command to remove Apache if it is installed on the server. ```bash $ apt-get remove apache apache2 ``` -------------------------------- ### Manage PHP-FPM Service Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Start, stop, or restart the PHP-FPM service using the init script. This command controls the PHP FastCGI Process Manager. ```bash /etc/init.d/php-fpm start [stop|restart] ``` -------------------------------- ### Restore Percona Server Data Directory Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Move the previously backed-up data directory into the new Percona Server installation. ```bash mv /home/mysql/data /home/mysql/mysql/data ``` -------------------------------- ### Move MySQL Data and Original Directory Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Safely move the existing MySQL data directory and rename the MySQL installation directory to prepare for Percona Server. ```bash mv /home/mysql/mysql/data /home/mysql/data # just move it outside mv /home/mysql/mysql /home/mysql/mysql_original ``` -------------------------------- ### Restart PHP-FPM Service Source: https://github.com/foolcode/foolfuuka/wiki/Install-APC Restart the PHP-FPM service to apply the changes made to php.ini. This command may vary depending on your operating system and PHP installation. ```bash $ /etc/init.d/php-fpm restart ``` -------------------------------- ### Create Database via Command Line Source: https://github.com/foolcode/foolfuuka/wiki/How-to-install Use this command to create a new database for FoOlFuuka. Ensure you have administrative privileges. ```bash $ mysql -u root -p ``` ```sql mysql> CREATE DATABASE foolfuuka; ``` ```sql mysql> GRANT usage ON *.* to foolfuuka@localhost identified by 'xxxpasswordxxx'; ``` ```sql mysql> GRANT all privileges ON foolfuuka.* to foolfuuka@localhost; ``` ```sql mysql> exit; ``` -------------------------------- ### Initialize Percona Server Databases Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Initialize the data directory for Percona Server using the mysql_install_db script. This creates the initial database structure. ```bash scripts/mysql_install_db --user=mysql --basedir=/home/mysql/mysql --datadir=/home/mysql/mysql/data ``` -------------------------------- ### Download FoOlFuuka via Command Line Source: https://github.com/foolcode/foolfuuka/wiki/How-to-install Download the latest version of FoOlFuuka using wget. Replace '0.7.0-dev-2' with the desired version tag. ```bash $ cd /var/www ``` ```bash $ wget https://github.com/FoOlRulez/FoOlFuuka/zipball/0.7.0-dev-2 -O foolfuuka.zip ``` -------------------------------- ### Configure Percona Server and Service Script Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Copy the Percona Server configuration file and the init script to their respective system locations. ```bash chown -R root . chown -R mysql data cp support-files/my-medium.cnf /etc/my.cnf # medium is fine, you will have to blow this out or proportion anyway cp support-files/mysql.server /etc/init.d/mysql ``` -------------------------------- ### Download and Extract Percona Server Binaries Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Download the Percona Server binary distribution and extract it to the /opt directory. ```bash cd /opt wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.22-25.2/binary/linux/x86_64/Percona-Server-5.x.xx-relxx.x-xxx.Linux.xxxx.tar.gz tar xvzf Percona-Server-5.x.xx-relxx.x-xxx.Linux.xxxx.tar.gz ``` -------------------------------- ### Add Nginx Repository to sources.list Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-installation Appends the Nginx official package repository lines to the apt sources list. ```bash nano /etc/apt/sources.list ``` ```text deb http://nginx.org/packages/ubuntu/ lucid nginx deb-src http://nginx.org/packages/ubuntu/ lucid nginx ``` -------------------------------- ### Extract and Navigate PHP Source Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Extract the downloaded PHP archive and navigate into the source directory to begin the compilation process. ```bash tar xvzf php-5.x.xx.tar.gz cd php-5.x.xx/ ``` -------------------------------- ### Import Nginx GPG Keys Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-installation Imports the Nginx GPG public key to validate the repository and prevent apt-get warnings. ```bash gpg --recv-key 7BD9BF62 ``` ```bash gpg -a --export 7BD9BF62 | sudo apt-key add - ``` -------------------------------- ### Unzip and Rename FoOlFuuka Folder Source: https://github.com/foolcode/foolfuuka/wiki/How-to-install Extract the downloaded zip file and rename the resulting folder to 'foolfuuka'. Adjust the source folder name if 'unzip' output is unclear. ```bash $ unzip foolfuuka.zip ``` ```bash $ ls # search the generated folder in case the unzip didn't show the output making it obvious ``` ```bash $ mv FoOlRulez-FoOlFuuka-xxxxxxx/ foolfuuka/ # you can choose whichever name you want ``` -------------------------------- ### Update Server Software Source: https://github.com/foolcode/foolfuuka/wiki/Installing-the-minimal Run these commands to update the server's software packages to their latest versions. ```bash $ apt-get update $ apt-get upgrade ``` -------------------------------- ### Basic Nginx Configuration Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-configuration This snippet shows a fundamental Nginx configuration file (nginx.conf). It sets up worker processes, logging, and basic HTTP server settings. Adjust worker_processes based on your server's CPU cores. ```nginx user www-data; worker_processes 1; worker_rlimit_nofile 30000; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log off; open_file_cache max=1000 inactive=300s; open_file_cache_valid 360s; open_file_cache_min_uses 2; open_file_cache_errors off; sendfile on; #tcp_nopush on; keepalive_timeout 65; client_max_body_size 30m; gzip on; gzip_vary on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.1; gzip_min_length 1000; gzip_disable "MSIE [1-6]\."; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json application/javascript; include /etc/nginx/sites-available/*; } ``` -------------------------------- ### Configure Nginx for Subfolder Deployment Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-configuration This Nginx configuration allows serving FoOlFuuka from a subfolder (e.g., http://foolz.us/foolfuuka). Adjust the 'server_name' and 'root' directives, and ensure the 'location /foolfuuka' block correctly points to the application's index.php. ```nginx server { server_name foolz.us # change this to a domain or subdomain index index.php; root /var/www/; # the root domain of your # tell the browser to cache all static files # FoOlFuuka automatically deals with forcing redownload through query parameters like style.css?v=0.8.0 location ~* \.(css|js|htc|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ { expires 31536000s; add_header Pragma "public"; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; try_files $uri $uri/ /index.php; } # allow reaching the base folder, without any special magic # if you have index.php in the root folder it will be shown when http://foolz.us is reached location / {} # in case you have a Wordpress blog in /blog location /blog { try_files $uri $uri/ /blog/index.php; } # most important part, this sends the requests to FoOlFuuka # in this case we add a folder to location and try_files location /foolfuuka { try_files $uri $uri/ /foolfuuka/index.php; } # connection to PHP location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_index index.php; if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000; # you can use the sockets (10%~ faster connection) if you setup PHP with a socket file # fastcgi_pass unix:/dev/shm/php5-fpm.sock; } } } ``` -------------------------------- ### Download PHP Source Code Source: https://github.com/foolcode/foolfuuka/wiki/A-good-PHP-compilation Download the latest stable version of PHP from the official website. Replace 'x.xx' with the specific version number. ```bash cd /opt wget http://xx.php.net/get/php-5.x.xx.tar.gz/from/this/mirror -O php-5.x.xx.tar.gz ``` -------------------------------- ### Set Folder Permissions for Webserver User Source: https://github.com/foolcode/foolfuuka/wiki/Troubleshooting-installation After identifying the webserver user (e.g., www-data), use this command to recursively change ownership of the FoOlFuuka directory to that user. ```bash cd /get/in/foolfuuka/directory chown -R www-data . ``` -------------------------------- ### Check Webserver User with PHP Source: https://github.com/foolcode/foolfuuka/wiki/Troubleshooting-installation This snippet helps identify the user your webserver is running as by creating a temporary PHP file. Access the file via your browser to see the output. ```bash cd /get/in/foolfuuka/directory echo "" > whoami.php ``` ```bash rm whoami.php ``` -------------------------------- ### Monitor PHP Resource Usage Source: https://github.com/foolcode/foolfuuka/wiki/Configure-PHP-FPM Use `htop` to monitor PHP process resource consumption. Press F5 to group threads for better analysis. ```bash $ htop ``` -------------------------------- ### Move Percona Server to MySQL's Original Location Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Relocate the Percona Server binaries to the directory previously occupied by MySQL. ```bash mv /opt/Percona-Server-5.x.xx-relxx.x-xxx.Linux.xxxx /home/mysql/mysql ``` -------------------------------- ### Configure Nginx for a Domain Source: https://github.com/foolcode/foolfuuka/wiki/Nginx-configuration This Nginx server block configuration is for serving FoOlFuuka from a dedicated domain or subdomain. Ensure the 'server_name' and 'root' directives point to your specific domain and application path. ```nginx server { server_name archive.foolz.us # change this to your domain or subdomain index index.php; root /var/www/foolfuuka; # change it to the location of your FoOlFuuka # tell the browser to cache all static files # FoOlFuuka automatically deals with forcing redownload through query parameters like style.css?v=0.8.0 location ~* \.(css|js|htc|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ { expires 31536000s; add_header Pragma "public"; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; try_files $uri $uri/ /index.php; } # most important part, this sends the requests to FoOlFuuka location / { try_files $uri $uri/ /index.php; } # connection to PHP location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_index index.php; if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000; # you can use the sockets (10%~ faster connection) if you setup PHP with a socket file # fastcgi_pass unix:/dev/shm/php5-fpm.sock; } } } # optional # block all sub-domains not set above server { listen 80; server_name *.foolz.us; location / { return 403; } } ``` -------------------------------- ### Reboot Server Source: https://github.com/foolcode/foolfuuka/wiki/Installing-the-minimal Reboot the server to apply hostname changes and ensure system stability. ```bash $ reboot ``` -------------------------------- ### Edit PHP Configuration (`php.ini`) Source: https://github.com/foolcode/foolfuuka/wiki/Configure-PHP-FPM Modify PHP execution time and memory limits. Adjust `date.timezone` to your server's location. ```bash $ nano /usr/local/lib/php.ini ``` ```ini max_execution_time = 120 memory_limit = 256M # 128M for a 512MB RAM server date.timezone = America/New_York # or wherever your server is from this list http://php.net/manual/en/timezones.php ``` -------------------------------- ### Stop MySQL Server Before Replacement Source: https://github.com/foolcode/foolfuuka/wiki/Using-Percona-Server-instead-of-MySQL Stop the existing MySQL server instance before proceeding with the replacement process. ```bash /etc/init.d/mysql stop # maybe /etc/init.d/mysql.server stop ``` -------------------------------- ### Change Server Hostname Source: https://github.com/foolcode/foolfuuka/wiki/Installing-the-minimal Change the server's hostname to a custom name for easier identification. A reboot is recommended after changing the hostname. ```bash $ hostname hakurei # or any name you want ``` -------------------------------- ### Configure APC in php.ini Source: https://github.com/foolcode/foolfuuka/wiki/Install-APC Add the APC extension and configure its shared memory size in the php.ini file. Ensure to restart PHP after making changes. ```ini extension=apc.so apc.shm_size = 256M # make this at least 64-128M, we use 512M for giggles ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.