\documentclass[DIV=13,%
               BCOR=0mm,%
               headinclude=false,%
               footinclude=false,open=any,%
               fontsize=10pt,%
               oneside,%
               paper=a5]%
               {scrbook}






\usepackage[noautomatic]{imakeidx}



\usepackage{microtype}
\usepackage{graphicx}
\usepackage{alltt}
\usepackage{verbatim}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\def\hsout{\bgroup \ULdepth=-.55ex \ULset}
% https://tex.stackexchange.com/questions/22410/strikethrough-in-section-title
% Unclear if \protect \hsout is needed. Doesn't looks so
\DeclareRobustCommand{\sout}[1]{\texorpdfstring{\hsout{#1}}{#1}}
\usepackage{wrapfig}

% avoid breakage on multiple <br><br> and avoid the next [] to be eaten
\newcommand*{\forcelinebreak}{\strut\\*{}}

\newcommand*{\hairline}{%
  \bigskip%
  \noindent \hrulefill%
  \bigskip%
}

% reverse indentation for biblio and play

\newenvironment*{amusebiblio}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newenvironment*{amuseplay}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newcommand*{\Slash}{\slash\hspace{0pt}}


% http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\PassOptionsToPackage{hyphens}{url}\usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref}
\usepackage{bookmark}

\usepackage[english,shorthands=off]{babel}
\babelfont{rm}[Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]{texgyrepagella-regular.otf}
\babelfont{tt}[Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmuntb.ttf,%
 BoldItalicFont=cmuntx.ttf,%
 ItalicFont=cmunit.ttf]{cmuntt.ttf}
\babelfont{sf}[Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmunsx.ttf,%
 BoldItalicFont=cmunso.ttf,%
 ItalicFont=cmunsi.ttf]{cmunss.ttf}



\renewcommand*{\partpagestyle}{empty}


% global style

\pagestyle{plain}




\usepackage{indentfirst}

% remove the numbering
\setcounter{secnumdepth}{-2}

% remove labels from the captions
\renewcommand*{\captionformat}{}
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\KOMAoption{captions}{belowfigure,nooneline}
\addtokomafont{caption}{\centering}







\deffootnote[3em]{0em}{4em}{\textsuperscript{\thefootnotemark}~}


\addtokomafont{disposition}{\rmfamily}
\addtokomafont{descriptionlabel}{\rmfamily}


\frenchspacing
% avoid vertical glue
\raggedbottom

% this will generate overfull boxes, so we need to set a tolerance
% \pretolerance=1000
% pretolerance is what is accepted for a paragraph without
% hyphenation, so it makes sense to be strict here and let the user
% accept tweak the tolerance instead.
\tolerance=200
% Additional tolerance for bad paragraphs only
\setlength{\emergencystretch}{30pt}

% (try to) forbid widows/orphans
\clubpenalty=10000
\widowpenalty=10000





% given that we said footinclude=false, this should be safe
\setlength{\footskip}{2\baselineskip}
\setlength{\parindent}{15pt}

\title{How to install Amusewiki}
\date{}
\author{Marco Pessotto, Alexander Krotov}
\subtitle{}






% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={How to install Amusewiki},%
pdfauthor={Marco Pessotto; Alexander Krotov},%
pdfsubject={},%
pdfkeywords={doc; howto}%
}


\begin{document}









  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge How to install Amusewiki\par}}%
  \vskip 1em
  
  \vskip 2em
  
  {\usekomafont{author}{Marco Pessotto, Alexander Krotov\par}}%
  
  \vskip 1.5em



   
   \vfill



  
    \strut\par
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage





\tableofcontents
% start a new right-handed page

\cleardoublepage




The recommended way to install Amusewiki is via
\href{https://packages.amusewiki.org}{Debian repository}.


Since October 2020, Amusewiki installs a stripped down \emph{TeX~Live!}
which greatly reduces the installation size.


On a clean Debian Buster installation, which takes about 1Gb of space,
following the procedure described at
\href{https://packages.amusewiki.org}{packages.amusewiki.org}, installing
Amusewiki takes 308Mb of archives resulting in 920Mb of space used,
plus 160Mb of extra fonts, ending up with a total disk usage of about
2.2Gb.


However, please keep in mind that Amusewiki produces a lot of files,
so for a working instance the recommended \emph{minimum} free space would
be something like 5Gb.


If you want to install manually, read on. If you need to do some
post-installation tweaking for ports and webserver logging, jump to
the \hyperref{}{amuse}{configuration}{configuration section}. Otherwise feel free to
skip this document entirely.

\section{General installation}


The procedure is fully automated, so start it, check if it bails
out at the beginning, forget about it for some time (run it under
\href{https://www.gnu.org/software/screen/}{screen}), then come back later
and finish it up to complete it for the operations which require root
privileges (notably the webserver configuration).


You can speed up the process by installing TeX Live from the OS
repositories, which is the suggested approach because this way the
security fixes are delegated to the standard tools.


Amusewiki installation is similar for all *nix
operating systems, but you may want to additionally consult
\hyperref{}{amuse}{specific}{OS-specific instructions section} which contain instructions
for less common operating systems. Windows is not supported in any way.

\subsection{Install prerequisites}


In addition, the following software should be installed:


\begin{itemize}
\item\relax 
a database (\href{https://www.mysql.com/}{MySQL},
\href{https://www.postgresql.org/}{PostgreSQL},
\href{https://www.sqlite.org/}{SQLite} are supported)



\item\relax 
\href{https://www.perl.org/}{Perl} and
\href{https://metacpan.org/pod/Carton}{Carton}:
\href{https://packages.debian.org/stable/perl/carton}{\texttt{carton}}
package on Debian



\item\relax 
fontconfig (install it before installing TeX Live)



\item\relax 
ghostscript (for preview generation)



\item\relax 
a mime-info database: \texttt{shared-mime-info} on Debian



\item\relax 
a dedicated system user (with a clean home) which is going to run the site



\item\relax 
SSL binaries and development libraries (\texttt{openssl} and \texttt{libssl-dev})



\item\relax 
Xapian libraries and development files (\texttt{xapian-tools} \texttt{libxapian-dev})



\item\relax 
commonly used utilities: \texttt{unzip}, \texttt{wget}, \texttt{git}, \texttt{rsync}



\item\relax 
widely used libraries: \texttt{libxml2-dev} \texttt{libexpat1-dev} \texttt{zlib1g-dev}
\texttt{libjpeg-dev} \texttt{libpng-dev} for \texttt{XML::LibXML} and \texttt{Imager}



\item\relax 
\texttt{cgit} if the distro provides it



\item\relax 
a webserver, \texttt{nginx} is the suggestion (but see below)



\item\relax 
TeX Live full either from system repo or installed with the provided script




\end{itemize}

So:


\begin{alltt}
adduser --disabled-password amusewiki
apt install --no-install-recommends git carton ghostscript shared-mime-info openssl libssl-dev \textbackslash{}
    xapian-tools libxapian-dev unzip wget rsync build-essential cpanminus \textbackslash{}
    cgit libxml2-dev libexpat1-dev zlib1g-dev libjpeg-dev libpng-dev nginx fontconfig
\end{alltt}


Log in as the user you want to run the site.


Unpack the sources (or clone the repo) and change directory into them.

\subsection{Install TeX Live}


If you want to install TeX Live from the installer, run:


\begin{alltt}
./script/install-texlive.sh
\end{alltt}


It will install the needed binaris and packages under \texttt{local/}.

\subsection{Run the Amusewiki installer}


Run installation script to check that you have installed prerequisites
and complete the installation:


\begin{alltt}
./script/install.sh
\end{alltt}

\subsection{Create the database}


\hyperdef{amuse}{mysql}{}%
\label{textamuse:mysql}%
Create a database for the application. E.g., for MySQL\Slash{}MariaDB:\footnote{Since May 2023, we suggest to use \texttt{utf8mb4} instead of \texttt{utf8}. If you want to upgrade from utf8 to utf8mb4, please take a look at \texttt{script/convert-mysql-to-utf8mb4.my.sql} in the root of the distribution, which contains the instructions for the upgrade.}


\begin{alltt}
MariaDB [(none)]> CREATE DATABASE amuse CHARACTER SET = utf8mb4 COLLATE = utf8mb4\_unicode\_ci;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON amuse.* TO amusewiki@localhost IDENTIFIED BY 'Pa55Word';
\end{alltt}


\hyperdef{amuse}{psql}{}%
\label{textamuse:psql}%
Or, for PostgreSQL:


Login as root.


\begin{alltt}
su - postgres
psql
create user amusewiki with password 'XXXX';
create database amusewiki owner amusewiki;
\end{alltt}


For SQLite no setup is required.


Copy \texttt{dbic.yaml.<dbtype>.example} to \texttt{dbic.yaml} and adjust the
credentials, and \texttt{chmod} it to \texttt{0600}. (For SQLite is good as it is).

\subsection{Configure initial site}


If you have multiple Amusewiki instances (please note, multiple sites
are just fine on a single instance) on the same machine,
\hyperref{}{amuse}{multiple}{see below} before proceeding (you probably want to tweak
the configuration).


Configure initial site with:


\begin{alltt}
./script/configure.sh [ hostname ]
\end{alltt}


Please note that the installation procedure will create a mirror of
amusewiki.org under the subdomain amusewiki.<your domain>, where <your
domain> is the output of \texttt{hostname -d}. Nothing you can’t change later
from the admin console, but you need to access it. You can pass the
desired hostname as the first argument to the configure script.

\section{Start the application}

\subsection{Starting the application manually}


To set the number of FCGI workers, set the environment variable
AMW\_WORKERS (defaults to 3).


\begin{alltt}
export AMW\_WORKERS=5
\end{alltt}


To start\Slash{}stop\Slash{}restart the application:


\begin{alltt}
./init-all.sh start
./init-all.sh stop
./init-all.sh restart
\end{alltt}


This is not needed if you use systemd.

\subsection{Starting the application with systemd}


If your OS uses systemd for initialization, you can generate systemd
units with


\begin{alltt}
script/generate-systemd-unit-files
\end{alltt}


It will generate unit files for three services:


\begin{itemize}
\item\relax 
amusewiki-web



\item\relax 
amusewiki-jobber



\item\relax 
amusewiki-cgit




\end{itemize}

Follow the instructions printed on the screen to enable
\texttt{amusewiki-web} and \texttt{amusewiki-jobber}. Do \emph{not} enable
\texttt{amusewiki-cgit}. cgit is managed by the web server, which we’ll
configure in the next section.

\subsection{Web server configuration}


The supported and recommended setup is nginx + FCGI. The FCGI setup
should work with Apache HTTP Server and Caddy Server as well (see
below).

\subsubsection{Nginx configuration}


To regenerate the nginx configuration after adding a site:


\begin{alltt}
carton exec script/amusewiki-generate-nginx-conf
\end{alltt}


Follow the printed instructions to install generated configuration.

\subsubsection{Apache}


Sample configuration. You need \texttt{mod\_proxy} and \texttt{mod\_proxy\_fcgi} loaded.


\begin{alltt}
<VirtualHost *:80>
    \#ServerName www.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /usr/share/perl5/AmuseWikiFarm/root/
    ErrorLog \$\{APACHE\_LOG\_DIR\}/error.log
    CustomLog \$\{APACHE\_LOG\_DIR\}/access.log combined

    \# serve static from root
    ProxyPass /static !
    ProxyFCGIBackendType GENERIC
    ProxyFCGISetEnvIf true SCRIPT\_NAME
    \# Correct the socket path if needed, but leave the fcgi://localhost/ intact
    ProxyPass "/" "unix:/var/lib/amusewiki/amusewiki.socket\textbar{}fcgi://localhost/"
</VirtualHost>
\end{alltt}

\subsubsection{Caddy configuration}


Another easy to setup webserver is \href{https://caddyserver.com}{Caddy},
but you will have to configure it manually and your configurtion may
become incomplete in the future.


Here, Amusewiki is assumed to be installed in \texttt{/home/amusewiki/amusewiki/} and hostname is \texttt{amusewiki.local}.


After \href{https://caddyserver.com/docs/install}{installing Caddy},
create a \texttt{Caddyfile} with the correct paths to the webserver root and
to the FCGI socket.


For Caddy Version 1 (in this example we're using a sample amusewiki
install from git):


\begin{alltt}
amusewiki.local:8080
tls off
log ./access.log
errors ./error.log
root /usr/home/amusewiki/amusewiki/root

fastcgi / unix:/usr/home/amusewiki/amusewiki/var/amw.sock \{
        except /static/
        except /git/
\}
\end{alltt}


For Caddy Version 2 (in this example with a system-wide installation
via \href{http://packages.amusewiki.org/}{Debian package}):


\begin{alltt}
http://amusewiki.local:8080 \{
    @static \{
       path /static/*
    \}
    @fcgi \{
       not path /static/*
    \}
    file\_server @static \{
        root /usr/share/perl5/AmuseWikiFarm/root/
    \}
    reverse\_proxy @fcgi unix//var/lib/amusewiki/amusewiki.socket \{
        transport fastcgi
    \}
\}
\end{alltt}


Start \texttt{caddy}.

\section{Additional configuration}
\hyperdef{amuse}{configuration}{}%
\label{textamuse:configuration}%

\subsection{Configuration file}


Normally, you don’t need to change anything. However, may need to do
some tweaking to the webserver configuration. This is done via the
configuration file.


If amusewiki was installed with a debian package, the location is
\texttt{/etc/amusewiki.conf} otherwise you should create a file called
\texttt{amusewikifarm\_local.conf} in the application directory, which will
override the existing settings in \texttt{amusewikifarm.conf}


Example with the defaults:


\begin{alltt}
  <Model::Webserver>
      \#\# cgit port
      cgit\_port 9015
      \#\# nginx log format
      log\_format combined
      \#\# nginx root
      nginx\_root /etc/nginx
      \#\# string to identify this installation
      instance\_name amusewikidebian
      webserver\_root /usr/share/perl5/AmuseWikiFarm/root
      fcgi\_socket /var/lib/amusewiki/amusewiki.socket
  </Model::Webserver>
\end{alltt}

\subsection{Mail with SMTP}


You need to set the desired parameter as environment variable (in the
systemd unit file or in the user starting the application). See
\href{https://metacpan.org/pod/Email::Sender::Manual::QuickStart}{\texttt{https://metacpan.org/pod/Email::Sender::Manual::QuickStart}} and
\href{https://metacpan.org/pod/Email::Sender::Transport::SMTP}{\texttt{https://metacpan.org/pod/Email::Sender::Transport::SMTP}} for details.


Previously we used the application config file, but that’s sloppy
because it prevents the jobber to send mails properly.


Example:


\begin{alltt}
\$ export EMAIL\_SENDER\_TRANSPORT=SMTP
\$ export EMAIL\_SENDER\_TRANSPORT\_host=smtp.example.com
\$ export EMAIL\_SENDER\_TRANSPORT\_port=2525
\$ export EMAIL\_SENDER\_TRANSPORT\_sasl\_username=XXXX
\$ export EMAIL\_SENDER\_TRANSPORT\_sasl\_password=XXXX

./init-all.sh restart
\end{alltt}


If you use systemd unit files to start\Slash{}stop\Slash{}restart the application,
you need to override them and set the environment variables instead.


\begin{alltt}
cp /lib/systemd/system/amusewiki-web.service \textbackslash{}
   /lib/systemd/system/amusewiki-jobber.service \textbackslash{}
   /etc/systemd/system
\end{alltt}


Add in the \texttt{[Service]} stanza the needed variables to both unit files, like this:


\begin{alltt}
Environment="EMAIL\_SENDER\_TRANSPORT=SMTP"
Environment="EMAIL\_SENDER\_TRANSPORT\_host=smtp.example.com"
Environment="EMAIL\_SENDER\_TRANSPORT\_port=2525"
Environment="EMAIL\_SENDER\_TRANSPORT\_sasl\_username=XXXX"
Environment="EMAIL\_SENDER\_TRANSPORT\_sasl\_password=XXXX"
\end{alltt}


and reload systemd with \texttt{systemctl daemon-reload}

\subsection{Multiple installations}
\hyperdef{amuse}{multiple}{}%
\label{textamuse:multiple}%


If you run a Debian machine and you have only one instance running and
if you have the port 9015 free, you don’t need any of this.


Please note: “multiple instances” doesn’t mean “multiple sites”. On a
single instance you can have as many sites as you want.


The interaction between nginx and the application, including cgit, is
controlled by the Webserver model. You can configure it creating a
file in the application root named \texttt{amusewikifarm\_local.conf} with
this content (here listed with the defaults).


\begin{alltt}
<Model::Webserver>
    \# cgit port
    cgit\_port 9015
    log\_format combined
    nginx\_root /etc/nginx
    instance\_name amusewiki
    fcgiwrap\_socket /var/run/fcgiwrap.socket
</Model::Webserver>
\end{alltt}


The instance\_name is just a string used to create the nginx
configuration files to avoid conflicts with other installations. So
you may have one instance named “testing” and the other “live”.

\section{OS-specific instructions}
\hyperdef{amuse}{specific}{}%
\label{textamuse:specific}%


The following sections contain installation instructions for operating
systems other than Debian. Note that these sections may be outdated,
so read general installation instructions first.

\subsection{FreeBSD 12.0}


Install prerequisites:


\begin{alltt}
pkg install perl5 p5-App-cpanminus \textbackslash{}
    p5-carton git texlive-full \textbackslash{}
    cgit GraphicsMagick shared-mime-info \textbackslash{}
    xapian-core xapian-bindings \textbackslash{}
    nginx fcgiwrap unzip rsync wget bash
\end{alltt}


Create amusewiki user:


\begin{alltt}
[root@freebsd \textasciitilde{}]\# adduser
Username: amusewiki
Full name: Amusewiki
Uid (Leave empty for default):
Login group [amusewiki]:
Login group is amusewiki. Invite amusewiki into other groups? []:
Login class [default]:
Shell (sh csh tcsh zsh rzsh bash rbash git-shell nologin) [sh]: bash
Home directory [/home/amusewiki]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]:
Username   : amusewiki
Password   : <disabled>
Full Name  : Amusewiki
Uid        : 1001
Class      :
Groups     : amusewiki
Home       : /home/amusewiki
Home Mode  :
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (amusewiki) to the user database.
Add another user? (yes/no): no
Goodbye!
\end{alltt}


Add to \texttt{/etc/rc.conf}


\begin{alltt}
nginx\_enable=YES
fcgiwrap\_enable=YES
fcgiwrap\_user=www
fcgiwrap\_socket="unix:/var/run/fcgiwrap/socket"

\# create an include sites-enabled directory for nginx and log dir
mkdir -p /usr/local/etc/nginx/sites-enabled
mkdir -p /var/log/nginx/
\# and add an include directive in nginx.conf inside the http \{ \} stanza, at the end.
\# include /usr/local/etc/nginx/sites-enabled/*;
vi /usr/local/etc/nginx/nginx.conf
\end{alltt}


And start the services


\begin{alltt}
service nginx start
service fcgiwrap start
\end{alltt}


\begin{alltt}
su - amusewiki
git clone https://github.com/melmothx/amusewiki.git
cd amusewiki
CXX=c++ ./script/install.sh
\# create the config
cat << EOF > amusewikifarm\_local.conf
<Model::Webserver>
    nginx\_root /usr/local/etc/nginx
    fcgiwrap\_socket /var/run/fcgiwrap/socket
</Model::Webserver>
EOF
\end{alltt}


Then decide to which hostname you want to serve this and run


\begin{alltt}
./script/configure.sh amw.localdomain
\end{alltt}


Read the output (you'll need to configure a database), do what it says
and run it again, taking note of the credentials, and follow the
instructions.


If you want to use MySQL, run as root:


\begin{alltt}
pkg install mysql57-server
echo 'mysql\_enable=YES' >> /etc/rc.conf
service mysql-server start
cat \textasciitilde{}/.mysql\_secret \# see password
mysql -h localhost -p
\end{alltt}


Create the database as described above in the \hyperref{}{amuse}{mysql}{generic section}
and then finalize the configuration with the amusewiki user:


\begin{alltt}
\# su - amusewiki
\$ cd amusewiki
\$ cpanm -L local DBD::mysql
\$ cp dbic.yaml.mysql.example dbic.yaml
\$ vi dbic.yaml \# edit db credentials
\$ ./script/configure.sh amw.localdomain \# reconfigure
\$ ./init-all start
\end{alltt}


For PostgreSQL, run as root:


\begin{alltt}
pkg install postgresql96-server
echo 'postgresql\_enable=YES' >> /etc/rc.conf
service postgresql initdb
service postgresql start
su - postgres
\end{alltt}


Create the database as described above in the \hyperref{}{amuse}{psql}{generic section}
and then finalize the configuration with the amusewiki user:


\begin{alltt}
\# su - amusewiki
\$ cd amusewiki
\$ cpanm -L local DBD::Pg
\$ cp dbic.yaml.pg.example dbic.yaml
\$ vi dbic.yaml \# edit db credentials
\$ ./script/configure.sh amw.localdomain \# reconfigure
\$ ./init-all start
\end{alltt}

\subsection{CentOS 7}


Most of these instructions will apply to other GNU\Slash{}Linux systems with
systemd and SELinux.


TeX Live is obsolete, so we will install it from CTAN. The same goes
with Perl.


From a fresh install:


\begin{alltt}
\# yum install epel-release
\# yum install git nginx perl-local-lib sqlite cgit \textbackslash{}
    perl-App-cpanminus fontconfig GraphicsMagick ImageMagick shared-mime-info openssl openssl-devel \textbackslash{}
    xapian-core xapian-core-devel unzip wget libxml2 libxml2-devel expat-devel \textbackslash{}
    policycoreutils setroubleshoot
\# yum groupinstall 'Development Tools'
\end{alltt}


Tweak nginx configuration to conform to Debian standard


\begin{alltt}
\# mkdir /etc/nginx/sites-enabled
\end{alltt}


Modify \texttt{/etc/nginx/nginx.conf} adding this line:


\begin{alltt}
  include /etc/nginx/sites-enabled/*;
\end{alltt}


Right after \texttt{include /etc/nginx/conf.d/*.conf;}


(Probably you may also want to add \texttt{client\_max\_body\_size 8m;} as the
default is way too low).


Start nginx:


\begin{alltt}
\# systemctl enable nginx
\# systemctl start nginx
\end{alltt}


Open the firewall


\begin{alltt}
\# firewall-cmd --get-active-zones
\# firewall-cmd --zone=public --add-service=http --permanent
\# firewall-cmd --zone=public --add-service=https --permanent
\# firewall-cmd --reload
\end{alltt}


Prepare the installation directory for your user (say \texttt{amusewiki}, but
any other will do).


Please note that we install it under \texttt{/var/www/} to avoid problems
with SELinux.


\begin{alltt}
\# mkdir /var/www/amusewiki
\# chown amusewiki:amusewiki /var/www/amusewiki
\end{alltt}


As the user which is going to run Amusewiki, install a fresh Perl.
This way we simplify and make our install independent from the base
system, which is lacking way too many modules.


\begin{alltt}
\$ eval `perl -Mlocal::lib`
\$ cpanm Perl::Build
\$ perl-build -j 3 --test 5.24.1 \$HOME/amw-perl
\$ cd /vaw/www/amusewiki
\$ git clone https://github.com/melmothx/amusewiki.git
\$ cd amusewiki \# you're now in /vaw/www/amusewiki/amusewiki, our app home
\$ ./script/install-texlive.sh \# install texlive
\$ echo 'export PATH=\$HOME/amw-perl/bin:\$HOME/texlive/2018/bin/x86\_64-linux:\$PATH' >> \$HOME/.bashrc
\$ chmod 755 \$HOME  \# open the home so plackup is accessible to nginx
\end{alltt}


Logout and login again and check the program paths to point to the newly installed ones


\begin{alltt}
\$ which perl \# should be: \textasciitilde{}/amw-perl/bin/perl
\$ which xelatex \# should be \textasciitilde{}/texlive/2018/bin/x86\_64-linux/xelatex or equivalent
\end{alltt}


Install cpanm and the dependencies


\begin{alltt}
\$ perl -MCPAN -e 'install Carton'
\$ which carton \# should be \textasciitilde{}/amw-perl/bin/carton
\$ cd /var/www/amusewiki/amusewiki/
\$ ./script/install.sh
\end{alltt}


Decide the initial server name to serve Amusewiki (to get access to
the admin), e.g. amw.localdomain.


See above if you want a MySQL or PostgreSQL database. The following
command will create a sample site with the current Amusewiki
documentation.


\begin{alltt}
\$ ./script/configure.sh amw.localdomain
\end{alltt}


Remove the cgit wrapper, we’re going to install systemd unit files.


\begin{alltt}
\$ rm root/git/cgit.cgi
\$ ./script/generate-systemd-unit-files
\$ carton exec ./script/amusewiki-generate-nginx-conf
\end{alltt}


Read the output and install the fresh nginx configuration.


Finally, open the permission for SELinux. As root:


\begin{alltt}
cd /var/www/amusewiki/amusewiki/doc/centos/
checkmodule -M -m -o amusewiki.mod amusewiki.te
semodule\_package -o amusewiki.pp -m amusewiki.mod
semodule -i amusewiki.pp
\end{alltt}


Reboot to be sure everything is ok, open with a browser the location
you configured (say, \texttt{amw.localdomain}, you may want to add the entry
\texttt{/etc/hosts} to access it) and login.


You probably want to head to the admin panel under \texttt{/admin/sites} to
create a new site.









% begin final page

\clearpage



% new page for the colophon

\thispagestyle{empty}

\begin{center}





\bigskip
\includegraphics[width=0.25\textwidth]{logo-amw.pdf}
\bigskip

\end{center}

\strut

\vfill

\begin{center}


Marco Pessotto, Alexander Krotov

How to install Amusewiki






\bigskip



   

       

       
         This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit \href{http://creativecommons.org/licenses/by-sa/4.0/}{\texttt{http://creativecommons.org/licenses/by-sa/4.0/}} or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
       

       

       

       

       

   



\bigskip
\textbf{amusewiki.org}


\end{center}

% end final page with colophon


% end closing pages



\end{document}


% No format ID passed.



