Infra Insert 01: Difference between revisions

This page was last edited on 1 February 2024, at 22:23.
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!------------------------>
<!------------------------>
<!-- do not remove this -->
<!-- do not remove this -->
<div id="infra##" class="infra-insert">
<div id="Infra Insert 01" class="infra-insert">
<!------------------------>
<!------------------------>


 
$ wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.1.tar.gz
Command to check your OS, for this project we will be using Armbian:
 
'''$ cat /etc/os-release
'''
 
Download mediawiki:
 
'''$ wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.1.tar.gz
'''
 
Unzip the tar:
 
'''$ tar -xzvf mediawiki-*.tar.gz
'''
 
MediaWiki requires:
 
- PHP 7.4.3+
 
- a webserver software
 
- and either MariaDB 10.3.0+, MySQL 5.7.0+, SQLite 3.8.0+ or PostgreSQL 10.0+. Using MariaDB or MySQL is recommended as Wikipedia uses MariaDB.
 
Install PHP:
 
'''$ sudo apt-get install php-fpm
'''
 
Check the version:
 
'''$ php -v
'''
 
Check the version of nginx:
 
'''$ nginx -v
'''
 
Install database software (MariaDB):
 
'''$ sudo apt-get install mariadb-server
'''
 
Set up nginx configuration to serve the wiki. Here’s an example nginx configuration:
 
https://git.vvvvvvaria.org/varia/wiki-to-print/src/branch/master/wiki-to-print.nginx.example
 
Make a symbolic link (symlink) between the configurations in /sites-available and /sites-enabled:
 
'''$ ln sites-available/wiki2print.conf sites-enabled/wiki2print.conf
'''
 
First, check if the nginx configuration works, before reloading:
 
'''$ nginx -t
'''
 
If it works, hold your breath and reload nginx:
 
'''$ sudo systemctl reload nginx
'''
 
or
 
'''$ service nginx reload
'''
 
Edit the wiki2print.conf file, based on this example:
 
https://git.vvvvvvaria.org/varia/wiki-to-print/src/branch/master/wiki-to-print.nginx.example
 
Enable PHP. Installing some PHP extensions are required:
 
'''$ sudo apt install php-mbstring'''
 
'''$ sudo apt install php-xml'''
 
'''$ sudo apt install php-intl
'''
 
'''$ sudo apt install php my-sql
'''
 
 
Install image magick:
 
'''$ sudo apt install imagemagick'''
 
On the MariaDB/Mysql settings:
 
-  create user
 
-  not advised to create root user (the password on LocalSettings.php is stored in plain text)
 
'''$ mariadb'''
 
'''$ CREATE USER print@localhost IDENTIFIED BY 'XXX';'''
 
Create database called wiki. Documentation reference: https://mariadb.com/kb/en/create-database/
 
'''$ CREATE DATABASE wiki'''
 
Grant access to the user (called print) for this database (called wiki). The "*" is to give access to all tables.
 
'''$ GRANT ALL PRIVILEGES ON wiki.* TO 'print'@'localhost' WITH GRANT OPTION;'''
 
Check that access is granted.
 
Copy the LocalSettings.php from the database set up into server put in www site root folder.
 
'''$ cd /var/www/'''
 
'''$ ls -lha '''
 
(What does -h do? It makes the file sizes human readable)
 
Install PHP-FPM:
 
'''$ sudo apt-get install php7.3-fpm'''
 
'''$ service php8.1-fpm status'''
 
Media wiki install nginx:
 
Reference: https://www.howtoforge.com/how-to-install-mediawiki-with-nginx-and-lets-encrypt-ssl-on-ubuntu-20-04/
 
'''$ chown -R www-data:www-data /var/www/wiki2print'''
 
'''chmod -R 755 /var/www/wiki2print'''
 
Install flask in /opt/
 
'''$ cd /opt/'''
 
'''$ git clone https://git.vvvvvvaria.org/varia/wiki-to-print'''
 
'''$ cd wiki-to-print'''
 
and again
 
'''$ cd wiki-to-print'''
 
(Do we want to do it in a virtual environment?)
 
Make a virtual environment:
 
'''$ python3 -m venv venv'''
 
You now have a folder called "venv".
 
Activate the venv:
 
'''$ source venv/bin/activate'''
 
'''$ pip3 install flask'''
 
'''$ pip3 install bs4'''
 
'''$ pip3 install gunicorn'''
 
 
The flask application programme is in web-interface.py with routes to different parts of wiki-to-print
 
'''edit config:'''
  '''  nano config.json'''
   
    '''change:'''
    '''    "project_name"'''
  '''    "base_url" '''
       
 
 


<!------------------------>
<!------------------------>

Latest revision as of 22:23, 1 February 2024