Showing posts with label saktumiva. Show all posts
Showing posts with label saktumiva. Show all posts

Wednesday, May 29, 2024

Making your own Saktumiva server using Ubuntu

The following are instructions for using the command-line interface to set up your own instance of Charles Li’s Saktumiva (Upama) on your own Ubuntu-type server. You’re going to be working in /var/www a lot, so you need to use sudo for almost all commands. Unless otherwise stated, you’ll do all these commands in the /var/www directory. I’m assuming that you sit in /var/www and to download files to that location, etc., using sudo all the time. (or just becoming root for a while sudo su).
  1. Install apache2 (not nginx; it probably works, but we’re doing apache2 here). 

     sudo apt-get install apache2  

    You will then have a directory /var/www/html which is where all your later files for Dokuwiki and Upama will go. Next, create a file  

    /etc/apache2/sites-available/dokuwiki.conf  

    with the contents

    <VirtualHost *:80>
      ServerAdmin <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b1d0d5dcd8dff1d4c9d0dcc1ddd49fd2dedc">[email protected]</a>
      DocumentRoot /var/www/html/
      ServerName your_domain_or_IP
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

    Replace "your_domain_or_IP" with the public IP number of your server. (I got the above from /etc/apache2/sites-available/dokuwiki.conf and I’m not certain it is necessary.) 

  2. Install php and extras:

    sudo apt install php php-xml php8.1-mbstring

  3. Install Dokuwiki by following the instructions at https://www.dokuwiki.org/install. Broadly, you fetch the file dokuwiki-stable.tgz by saying

    cd /var/www sudo wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

    And then you’ll unpack the tgz file into /var/www/html using the commands

    cd /var/www/html sudo tar xvf /var/www/dokuwiki-stable.tgz -C /var/www/html 

    The -C arguments above tell tar to unpack the archive to the /var/www/html directory. You should then have a directory called something like /var/www/html/dokuwiki-2024-02-06a. Rename it to just ./dokuwiki:

    sudo mv  /var/www/html/dokuwiki-2024-02-06a /var/www/html/dokuwiki

  4. Now fetch the Upama plugin from Github:

    cd /var/www sudo git clone https://github.com/chchch/upama.git

  5. Install Upama. Charles explains what to do at the bottom of this page: https://github.com/chchch/upama . There’s no installation as such; all you do is copy the files to the right dokuwiki directories.

    To be more explicit, do the following:

    cd /var/www (where you now have an upama directory)

    Now copy the folders and files from the upama directory into the dokuwiki directory:

    sudo cp -r /var/www/upama/dokuwiki/* /var/www/html/dokuwiki/

    The folders that get copied are /var/www/upama/dokuwiki/data -> /var/www/html/dokuwiki/data /var/www/upama/dokuwiki/lib -> /var/www/html/dokuwiki/lib  

    One last thing:

    sudo touch /var/www/html/dokuwiki/data/pages/sidebar.txt  

    This creates the empty file /var/www/html/dokuwiki/data/pages/sidebar.txt

  6. Set some file permissions and ownership. This is a bit of a nightmare, and www.dokuwiki.org’s documentation is awful. But all your really need to do is this: sudo chmod -R 777 /var/www/html/dokuwiki/data/ sudo chmod -R 777 /var/www/html/dokuwiki/lib/ sudo chmod -R 777 /var/www/html/dokuwiki/conf/ sudo chown -R www-data:www-data /var/www/html/

  7. Next, some necessary apache stuff I got from https://forum.dokuwiki.org/d/9893-the-datadir-pages-at-data-pages-is-not-found/4 . We’ve already done the stuff up to Step C. Now edit the file apache2.conf. I use the editor vi; pick your favourite non-graphics editor.

    sudo vi /etc/apache2/apache2.conf 

     Find the lines

    <Directory /var/www/>
    ...
    </Directory>

    and below them add the following two new sections:

    <Directory /var/www/dokuwiki>
    order deny,allow
    allow from all
    </Directory>

    <LocationMatch "/(data|conf|bin|inc)/">
      order allow,deny
      deny from all
      satisfy all
    </LocationMatch>

    Then restart the apache server: sudo service apache2 restart Open a new browser tab and go to the page <my_IP_address>/dokuwiki/install.php This should open a page of dokuwiki settings. This page only appears the first time you invoke it; later, you get instructions on how to change things in a more low-level manner. At your dokuwiki page, log in and go to Admin/Configuration Manager. Amongst the initial “Basic” settings, find the setting for “template” and change it from “dokuwiki” to “saktumiva”. It looks like this:

     

    And go to the bottom of the screen and hit "save". 

  8. Stay with me. We’re almost done. The next thing is to add some TEI files of your edition.They are going to live in this directory:

      cd /var/www/html/dokuwiki/data/pages/wiki/  

    Create a file structure under wiki/ that makes sense to you. For example, sudo mkdir /var/www/html/dokuwiki/data/pages/wiki/Sakuntala/

    Copy your TEI files into ../Sakuntala/.  

    sudo cp /home/me/Documents/SaktutalaTEIfiles/* /var/www/html/dokuwiki/data/pages/wiki/Sakuntala

    Remember that the files need the extension .txt, even if they are xml files.

    You can also create a file start.txt in the ../Sakuntala/ directory that contains a nice starting page for your project. This must be written in dokuwiki syntax (cheatsheet).

  9. At this point, you should have a usable system. However, there’s a useful tweak. If you are going to upload your TEI files from your desktop to your new Saktumiva server by ftp, perhaps using Filezilla, you will want to change the ownership of files under ../Sakuntala/ so that your ftp identity can write files to that directory. sudo chown -R <me>:<me> /var/www/html/dokuwiki/data/pages/wiki/Sakuntala/

    where “<me>” is your Filezilla ftp login username. (You can set up users in Dokuwiki under Admin/User Manager).

  10. Other tweaks.
    • If your collation-generation times out, try upping the max execution in /etc/php8.1/apache/php.ini.
    • If your installation can't find symlinked files under directories, try adding the option +FollowSymLinks to  /etc/apache2/sites-enabled/000-default.conf:

      DocumentRoot /var/www/html
              <Directory />
              Options +FollowSymLinks
              AllowOverride None
              </Directory>
    • As a variant of point 9. above, you may prefer to use Saktumiva on your own laptop or desktop, rather than from a remote server.  If you want to link files from somewhere else on your disk into the Dokuwiki data/pages/wiki directory, you need to use hard links, not soft, symbolic links.  In Unix, ln <target> <name> not ln -s <target> <name>.   And if you want to be able to edit them through the Dokuwiki interface, say
      cd /var/www/html/dokuwiki/data/pages/wiki/Sakuntala/
      sudo chown -R <me>:www-data Sakuntala
      so that you are the "owner" but the "group" is still Apache.

 

Dominik Wujastyk

June 2024