Loading...
 
Skip to main content

Ubuntu 安装

在这里,我们有一些在带有 Apache2、MySQL/MARIADB 和 PHP5/PHP7/PHP8 的 Ubuntu Server 上安装 Tiki 的分步说明。.

安装 Ubuntu 服务器

我建议在初始安装时仅安装SSH服务器。

Patch it up

Copy to clipboard
sudo apt-get update sudo apt-get upgrade


安装 Tiki 的其他必要组件

1.1.1. Tiki 29 系统要求

PHP 及其他系统依赖项

Copy to clipboard
sudo apt install php-cli php-fpm composer php-gd php-xml php-bcmath↵

1.1.2. 如果你想从 Git 源码构建(适用于大多数人)

Copy to clipboard
sudo apt install git


安装 NVM ,然后使用它来安装 node:

Copy to clipboard
nvm install --lts=jod touch .nvmrc nvm use lts/jod

1.2. 安装 LAMP


在 Ubuntu 系统下,您可以使用以下命令安装 LAMP(Linux、Apache、MariaDB、PHP)服务器:

Copy to clipboard
sudo apt install lamp-server^ # this comes with Mysql 8.0 however we want to use Mariadb in order to keep usual way to make db as root in the first instance safely through a terminal window sudo apt install -y mariadb-server mariadb-client # this will replace mysql with mariadb


请注意,Ubuntu 24.04 自带 PHP 8.3+ 版本。

1.3. 安装 Tiki 的其他必要组件

1.3.1. Tiki 27 LTS 系统要求

您应该可以通过以下命令安装所需的 PHP 8.1+ 相关软件包:

Copy to clipboard
sudo apt install libapache2-mod-php8.1 memcached php8.1 php8.1-apcu php8.1-bcmath php8.1-bz2 php8.1-common php8.1-curl php8.1-gd php8.1-intl php8.1-ldap php8.1-mbstring php8.1-memcache php8.1-memcached php8.1-mysql php8.1-opcache php8.1-pspell php8.1-soap php8.1-sqlite3 php8.1-tidy php8.1-xml php8.1-xmlrpc php8.1-zip php-apcu php-bcmath php-common php-curl php-gd php-intl php-mbstring php-memcache php-memcached php-mysql php-pear php-pspell php-sqlite3 php-tidy php-xmlrpc php-zip php-bcmath npm


在这种情况下,您可以通过以下命令将默认 PHP 版本设置为 8.1:

Copy to clipboard
sudo a2dismod php8.3 sudo a2enmod php8.1 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php8.1



You might also want to install some extra packages:

Copy to clipboard
sudo apt install bsdmainutils catdoc composer curl elinks git man-db memcached odt2txt phpmyadmin poppler-utils postfix


然后您需要添加 npm 。对于通过命令行安装的 Tiki27 或更高版本,您的系统中需要相当新版本的 nodejs(v18+)和 npm(v10+)。Ubuntu 24.04 LTS 默认自带这些程序的旧版本。因此,您需要添加一些软件源并从那里安装更新的版本。可参考此处的说明:

https://hostman.com/tutorials/how-to-install-node-js-and-npm-on-ubuntu-24-04/#installing-node-js-and-npm-via-the-nodesource-repository

示例步骤:

Copy to clipboard
cd ~ curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh nano nodesource_setup.sh # you can check what the script does, before running it, since you have just downloaded it from the internet sudo bash nodesource_setup.sh sudo apt install nodejs -y


您可以使用以下命令检查已安装的版本:

Copy to clipboard
user@machine:~$ node -v v20.19.0 user@machine:~$ npm -v 10.8.2

1.3.2. Tiki 24 LTS 系统要求(如果您需要此较旧的 LTS 版本)


Tiki 26 之前的版本需要 PHP 7.4,例如 Tiki 24 LTS。但有一个良好的 PPA 可用于 PHP 7.4。因此,如果您安装 LAMP 服务器,然后从此 PPA 安装 PHP 7.4 软件包,您将能够安装 Tiki 24 LTS(需要 php 7.4)、Tiki 27 LTS(需要 php 8.1+)或更新版本。

使用以下命令将 PPA 集成到系统中:

Copy to clipboard
sudo apt-get update sudo apt -y install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update


然后您应该可以使用以下命令安装所有 PHP 7.4 软件包:

Copy to clipboard
sudo apt install libapache2-mod-php7.4 memcached php7.4 php7.4-apcu php7.4-bcmath php7.4-bz2 php7.4-common php7.4-curl php7.4-gd php7.4-intl php7.4-ldap php7.4-mbstring php7.4-memcache php7.4-memcached php7.4-mysql php7.4-opcache php7.4-pspell php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xmlrpc php7.4-zip php-apcu php-bcmath php-common php-curl php-gd php-intl php-mbstring php-memcache php-memcached php-mysql php-pear php-pspell php-sqlite3 php-tidy php-xmlrpc php-zip


或者您也可以选择只安装 PHP 8.3+ 版本的软件包:

Copy to clipboard
sudo apt install libapache2-mod-php8.3 memcached php-apcu php-bcmath php-common php-curl php-gd php-intl php-mbstring php-memcache php-memcached php-mysql php-pear php-pspell php-sqlite3 php-tidy php-xmlrpc php-zip


您可能还需要安装一些额外的软件包:

Copy to clipboard
sudo apt install bsdmainutils catdoc composer curl elinks git man-db memcached odt2txt phpmyadmin poppler-utils postfix

将 php 7.4 设置为默认版本(可选)


如果您需要 php 7.4 作为默认版本(用于 Tiki 24 LTS),而不是较新的版本(如 php 8.3.x),您可以使用以下命令将默认 php 版本设置为 7.4:

Copy to clipboard
sudo a2dismod php8.3 sudo a2enmod php7.4 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.4

1.3.3. 需要执行的额外步骤

如果是全新服务器,您可能会被问到几个问题来配置一些服务器程序。

配置 postfix(用于管理服务器发送和接收电子邮件的程序)时,您可以回答如下(除非您知道自己在做什么):

  • 常规邮件配置类型: Internet site
  • 系统邮件名称:mail.yourdomain.org


配置 phpmyadmin (用于通过基于 Web 的 GUI 管理 mysql 数据库的程序)时,您可以回答如下(除非您知道自己在做什么):

  • Web 服务器:apache2 (如有需要,可以使用空格键和箭头键在选项之间移动来选择)
  • 配置数据库 dbconfig-common: yes
  • phpmyadmin 的 MySQL 应用程序密码: [leave empty]




然后您可以启用这些模块:

Copy to clipboard
#sudo phpenmod mcrypt # mcrypt is not found in php 7.2 sudo phpenmod mbstring


Media Alchemyst 的额外软件包:

Copy to clipboard
#sudo apt install software-properties-common #sudo add-apt-repository ppa:libreoffice/libreoffice-6-0 # not available for ubuntu 20.04 at the time of this writing sudo apt install -y libreoffice ffmpeg unoconv ghostscript php-imagick imagemagick



启用 Apache 重写规则:

Command on a console
Copy to clipboard
sudo a2enmod rewrite sudo service apache2 restart


您可以启用自签名 ssl 证书以允许 https 连接:

Command on a console
Copy to clipboard
sudo a2enmod ssl sudo a2ensite default-ssl sudo service apache2 restart


并将此段内容添加到文件 /etc/apache2/sites-enabled/000-default.conf 中的 VirtualHost 标签之间(或根据您的配置添加到等效文件;在本例中,tiki 安装的文档根目录是 /var/www/html/,这也是 ubuntu 预配置的基础文档根目录):

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/000-default.conf


要添加的段(紧跟在 Document root 行之后):

Copy to clipboard
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory>


退出 nano 编辑器并保存更改(按 Ctrl + X )。

对 https 的等效配置文件进行相同的编辑:

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/default-ssl.conf



更改后,它们应该看起来像:

Contents of /etc/apache2/sites-enabled/000-default.conf
Copy to clipboard
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Contents of /etc/apache2/sites-enabled/default-ssl.conf
Copy to clipboard
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. # BrowserMatch "MSIE [2-6]" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

1.4. 为tiki创建一个MySQL数据库和一个对该数据库具有本地权限的MySQL用户

选项1 - 使用控制台

我们可以为tiki创建数据库和用户。我们可以通过终端窗口操作,首先使用 sudo su 切换到root用户,然后继续执行mysql命令。请注意,当执行 mysql -+ (作为root)时,无需提供密码,因为Ubuntu 18.04中的mysql认证方案仅要求您在shell中以root用户运行此命令。

commands in a terminal window
Copy to clipboard
# sudo su # mysql -p Enter password: (press enter) Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 31 Server version: 10.11.11-MariaDB-0ubuntu0.24.04.2 Ubuntu 24.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE mytikidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; MariaDB [(none)]> CREATE USER 'mytikiuser'@'localhost' IDENTIFIED BY 'mypassword'; MariaDB [(none)]> GRANT ALL ON mytikidb.* TO 'mytikiuser'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q Bye #


如果这是一台全新的服务器,您可能希望(风险自负)使用提供的脚本( sudo mysql_secure_installation )来加固您的MySQL安装,并按照以下链接中推荐的设置步骤进行操作:
https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/

选项2 - 使用phpmyadmin或adminer

或者,您可以使用已安装的PhpMyAdmin:
http://example.com/phpmyadmin/

或者使用一个名为Adminer的小型PHP脚本来管理您的MySQL服务器,您可以通过终端中类似如下命令将其下载到服务器:

Copy to clipboard
sudo wget https://www.adminer.org/latest-mysql-en.php -O "/var/www/html/tiki/adminer.php" # once you are done with managing your database and users, you are encouraged to remove adminer.php from the web access to somewhere else unaccessible from your web root for extra precaution sudo mv /var/www/html/tiki/adminer.php /var/www/


然后您可以通过图形界面的Web访问(phpMyAdmin或Adminer)登录。您可能无法使用MySQL的root密码登录,因为Ubuntu 18.04中的MySQL认证方案与先前版本相比有所变化(目前使用auth_socket而不是native_mysql_password)。
因此,您可以使用在此处找到的 debian-sys-maint 凭据:
/etc/mysql/debian.cnf

  • 为MySQL创建一个不具有全部权限的新用户
    • 新用户为 tikiuser,我们不为此用户选择任何数据库或常规权限。
  • 再次进入PhpMyAdmin/Adminer的起始页面
  • 创建一个名为 tiki24git 的数据库,并选择排序规则 utf8mb4_unicode_ci
  • 转到用户选项卡,然后转到数据库
    • 选择数据库 tiki24git,并为该用户勾选该数据库的所有权限,但“授予”权限除外。


就这样。然后您需要告知tiki我们已创建:

  • mysql数据库:tiki24git
  • mysql用户:tikiuser
  • mysql密码:xxxxxxx(您设置的密码)


建议按照以下步骤加固您的phpMyAdmin:https://www.atlantic.net/vps-hosting/how-to-install-and-secure-phpmyadmin-on-centos-8/

1.5. 通过git安装Tiki 27

(URL取自 http://dev.tiki.org/Get+code

我们将通过git浅克隆获取tiki27。此选项最适合在生产服务器上检出。它大约占用214M磁盘空间。

切换目录到 /var/www 并获取该tiki27克隆:

Copy to clipboard
cd /var/www git clone --depth=1 --branch=27.x https://gitlab.com/tikiwiki/tiki.git tiki27


由于您在前面的步骤中已安装了nodejs v20+和npm v10+,您可以在Web服务器公共www路径内的tiki根目录下的控制台中运行setup.sh脚本:

Copy to clipboard
cd tiki27 sh setup.sh


然后选择 b 作为第一个选项,以便获取composer,并执行npm run以及安装/编译tiki运行所需的相应文件。然后您可以选择修复文件和目录权限(经典默认设置):

Copy to clipboard
# First choose: Your choice [b]?: b # Then: Your choice [f]?: f User [www-data]: www-data Group [www-data]: www-data Multi []: # Then you can quit from the setup.sh script: Your choice [x]?: x


您可以在此查看该脚本的作用:
https://gitlab.com/tikiwiki/tiki/-/blob/27.x/setup.sh

此脚本通过一个名为“Composer”的程序(在需要时下载并更新它们)以及npm来管理所有Tiki依赖项。

您需要使这个tiki27文件夹可以通过Web服务器访问。您可以通过创建符号链接轻松实现。

Copy to clipboard
ln -s /var/www/tiki27 /var/www/html/tiki


然后您可以通过Web浏览器进行标准的Tiki安装(将example.com替换为您的域名):
http://example.com/tiki/

这将引导我们进入 tiki-install.php
http://example.com/tiki/tiki-install.php

安装完成后,您可能需要手动在tiki根目录中创建指向.htaccess文件的符号链接,因为这是tiki正常运行所必需的,而且在某些情况/设置下可能不会自动创建。您可以使用以下命令:

Copy to clipboard
ln -s /var/www/html/tiki/_htaccess /var/www/html/tiki/.htaccess


给西语用户的提示:观看Tiki课程视频:


在设置数据库连接的界面上,我们提供之前创建的数据库名称、数据库用户和密码,然后按照屏幕上的说明操作。

在新安装时,第一个用户是admin,密码为admin。我们更换密码,然后继续首次登录。
您的Tiki已安装完毕,可继续使用Wizards

1.6. 从Let's Encrypt获取免费SSL证书

安装一个仓库以获取能正常工作的更新版软件包:

Copy to clipboard
#sudo add-apt-repository ppa:certbot/certbot #sudo apt update sudo apt install python3-certbot-apache


在开始创建SSL证书之前,请在vhost配置文件中设置域名。用编辑器打开默认的vhost文件:

Copy to clipboard
nano /etc/apache2/sites-available/000-default.conf


并添加以下行:

Copy to clipboard
ServerName example.com


将 example.com 替换为您的完全限定域名。

然后使用以下命令创建 SSL 证书:

Copy to clipboard
sudo certbot --apache


该命令将启动一个向导,向您询问几个问题。
如果您想进一步自定义,请使用此处描述或链接的其他选项:
https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

1.6.1. 通过控制台添加一些 Composer 包

如果需要,您可以通过 console 添加一些包。

Copy to clipboard
sudo su cd /var/www/html/tiki/ composer require --update-no-dev --prefer-dist mpdf/mpdf composer require --update-no-dev --prefer-dist fullcalendar/fullcalendar-scheduler # no longer needed in Tiki 29+ since it's replaced with a different library composer require --update-no-dev --prefer-dist tikiwiki/diagram # updated for Tiki 21.x instead of mxgraph-editor composer require --update-no-dev --prefer-dist onelogin/php-saml composer require --update-no-dev --prefer-dist thiagoalessio/tesseract_ocr # composer require --update-no-dev --prefer-dist npm-asset/pdfjs-dist-viewer-min #composer require --update-no-dev --prefer-dist media-alchemyst/media-alchemyst #composer require --update-no-dev --prefer-dist php-ffmpeg/php-ffmpeg #composer require --update-no-dev --prefer-dist npm-asset/dexie #composer require --update-no-dev --prefer-dist npm-asset/lozad composer require --update-no-dev --prefer-dist google/apiclient service apache2 restart chown www-data:www-data composer.* exit


安装 Manticore 搜索

Tiki26 开始,您可以在生产环境中使用 Manticore search 作为统一搜索索引。您需要为 Manticore 搜索安装一些额外的软件包:

Copy to clipboard
wget https://repo.manticoresearch.com/manticore-repo.noarch.deb sudo dpkg -i manticore-repo.noarch.deb sudo apt update sudo apt install -y manticore manticore-extra


Once installed, you can start it with:

Copy to clipboard
sudo systemctl start manticore


More information:
https://manticoresearch.com/install/

1.7. Install Lamp

You can install a LAMP (Linux, Apache, Mariadb, PHP) server with this command under Ubuntu:

Copy to clipboard
sudo apt install lamp-server^ # this comes with Mysql 8.0 however we want to use Mariadb in order to keep usual way to make db as root in the first instance safely through a terminal window sudo apt install -y mariadb-server mariadb-client # this will replace mysql with mariadb


However, Ubuntu 22.04 doesn't contain PHP 7.4 any longer. Only PHP 8.1 is supported. Tiki versions before 26 need PHP 7.4. But there's a good PPA for PHP 7.4 available. So you install the LAMP server and then the PHP 7.4 packages from this PPA.

Use these commands to integrate the PPA in the system:

Copy to clipboard
sudo apt-get update sudo apt -y install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update


You should then be able to install all the PHP 7.4 packages with this command:

Copy to clipboard
sudo apt install libapache2-mod-php7.4 memcached php7.4 php7.4-apcu php7.4-bcmath php7.4-bz2 php7.4-common php7.4-curl php7.4-gd php7.4-intl php7.4-ldap php7.4-mbstring php7.4-memcache php7.4-memcached php7.4-mysql php7.4-opcache php7.4-pspell php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xmlrpc php7.4-zip php-apcu php-bcmath php-common php-curl php-gd php-intl php-mbstring php-memcache php-memcached php-mysql php-pear php-pspell php-sqlite3 php-tidy php-xmlrpc php-zip


You might also want to install some extra packages:

Copy to clipboard
sudo apt install bsdmainutils catdoc composer curl elinks git man-db memcached odt2txt phpmyadmin poppler-utils postfix pstotext

Set php 7.4 as default

In case you have other php versions newer than 7.4 (such as php 8.0.x), you may set the default php version at 7.4 with these commands:

Copy to clipboard
sudo a2dismod php8.1 sudo a2enmod php7.4 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.4

Extra steps needed

If it's a brand new server, you might be asked a few questions to configure some server programs.

To configure postfix (program to mange email sending and receiving from the server), you can answer, for instance (unless you know what you are doing):

  • General type of mail configuration: Internet site
  • System mail name: mail.yourdomain.org


To configure phpmyadmin (program to manage mysql databases through a web based GUI), you can answer, for instance (unless you know what you are doing):

  • Webserver: apache2 (you can select using the space bar and arrow keys if needed to move between the options)
  • Configure database with dbconfig-common: yes
  • MySQL application password for phpmyadmin: [leave empty]




Then you can enable the modules

Copy to clipboard
#sudo phpenmod mcrypt # mcrypt is not found in php 7.2 sudo phpenmod mbstring


Extra packages for Media Alchemyst:

Copy to clipboard
#sudo apt install software-properties-common #sudo add-apt-repository ppa:libreoffice/libreoffice-6-0 # not available for ubuntu 20.04 at the time of this writing sudo apt install -y libreoffice ffmpeg unoconv ghostscript php-imagick imagemagick



Enable the Apache rewrite rules:

Command on a console
Copy to clipboard
sudo a2enmod rewrite sudo service apache2 restart


And you can enable the self-signed ssl certificates to allow connections with https:

Command on a console
Copy to clipboard
sudo a2enmod ssl sudo a2ensite default-ssl sudo service apache2 restart


And add this section between the VirtualHost tags the to this file /etc/apache2/sites-enabled/000-default.conf (or equivalent for your configuration; in this case, the doc. root where tiki is installed is /var/www/html/, which is where ubuntu 20.04 comes pre-configured for the base doc root):

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/000-default.conf


Section to add (just after the Document root line):

Copy to clipboard
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory>


Do the same type of edit into the equivalent config file for https:

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/default-ssl.conf



After the change, they should look like:

Contents of /etc/apache2/sites-enabled/000-default.conf
Copy to clipboard
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Contents of /etc/apache2/sites-enabled/default-ssl.conf
Copy to clipboard
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. # BrowserMatch "MSIE [2-6]" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

1.8. Create for tiki a mysql db and a mysql user with local perms for that db

Option 1 - using console

We can create a database and user for tiki. We can do so through a terminal windows converting ourselves in root in a first step with sudo su, and then, we can continue with the mysql commands. Please note that when executing mysql -+ (as root) you need to provide no password, since mysql authenticaation scheme in Ubuntu 18.04 only requires that you run this command as user root in the shell.

commands in a terminal window
Copy to clipboard
# sudo su # mysql -p # mysql> CREATE DATABASE mytikidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # mysql> CREATE USER 'mytikiuser'@'localhost' IDENTIFIED BY 'mypassword'; # mysql> GRANT ALL ON mytikidb.* TO 'mytikiuser'@'localhost'; # mysql> FLUSH PRIVILEGES; # mysql> \q


If it's a brand new server, you may wish (at your own risk) to secure your mysql installation with the provided script ( sudo mysql_secure_installation ), and do the recommended setup steps indicated here:
https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/

Option 2 - use phpmyadmin or adminer

Alternatively, you can use your PhpMyAdmin install:
http://example.com/phpmyadmin/

or a small php script to manage your mysql server, called Adminer, that you can download to your server with an instruction like this one in a terminal:

Copy to clipboard
sudo wget https://www.adminer.org/latest-mysql-en.php -O "/var/www/html/tiki/adminer.php" # once you are done with managing your database and users, you are encouraged to remove adminer.php from the web access to somewhere else unaccessible from your web root for extra precaution sudo mv /var/www/html/tiki/adminer.php /var/www/


Then you can login to your GUI web access (either phpmyadmin or adminer). You will probably not be able to login with your mysql root password, since the msyql auth scheme in ubuntu 18.04 has changed compared to previous versions (it currently uses auth_socket instead of native_mysql_password).
Therefore, you can use the debian-sys-maint credentials that you will find here:
/etc/mysql/debian.cnf

  • Create a new user for mysql that does NOT have all perms
    • New user is tikiuser, and we do not select neither database nor general perms for this user.
  • Go to the start page for PhpMyAdmin/Adminer again
  • Create a bbdd named tiki24git and as collation select utf8mb4_unicode_ci
  • Go to the users tab, and go to Databases
    • Select the db tiki24git and check all perms except "grant" to that user for that db


And that's all. Then you will need to tell tiki that we have created:

  • mysql db: tiki24git
  • mysql user: tikiuser
  • mysql password: xxxxxxx (whatever you provided as password)


It is recommended to secure your phpMyAdmin by following the steps: https://www.atlantic.net/vps-hosting/how-to-install-and-secure-phpmyadmin-on-centos-8/

1.9. Install Tiki 24 through git

(url's taken from http://dev.tiki.org/Get+code )

We will fetch tiki24 through git shallow clone. This option is best to checkout on production servers. It uses about 214M of disk space.

Change directory to /var/www and get that tiki24 clone:

Copy to clipboard
cd /var/www git clone --depth=1 --branch=24.x https://gitlab.com/tikiwiki/tiki.git tiki24


Then we run the Tiki setup script through console:

Copy to clipboard
cd tiki24 sh setup.sh


The first question you will asked is about running composer to fetch the dependencies (libraries) which need to be downloaded for Tiki to run:

Copy to clipboard
# First choose: Your choice [c]?: c # Then choose to fix file and directory permissions (classic default): Your choice [f]?: f User [www-data]: www-data Group [www-data]: www-data Multi []: # Then you can quit from the setup.sh script: Your choice [x]?: x


You can have a look at what the script does here:
https://gitlab.com/tikiwiki/tiki/-/blob/24.x/setup.sh

This script manages all Tiki dependencies through a program called "Composer" (it downloads and updated them when needed)

You need to make this tiki24 folder available through the webserver.
You can easily do so by means of a symbolic link

Copy to clipboard
ln -s /var/www/tiki24 /var/www/html/tiki


Then you can proceed with the standard Tiki installation through the web browser (replace example.com with your domain name):
http://example.com/tiki/

and this will take us to tiki-install.php:
http://example.com/tiki/tiki-install.php

Once installed, you may need to manually create a synbolic link to .htaccess file in the tiki root folder, since it's needed for tiki to work properly and it might not get automatically created under some circumstances/setups, apparently. You can do so with the command:

Copy to clipboard
ln -s /var/www/html/tiki/_htaccess /var/www/html/tiki/.htaccess


Tip for Spanish speakers: see the video from a course on Tiki:


At the screen to Setup the database connection, we provide the database name, db user and password that we previosuly created and we follow instructions on screen.

At the new installation, the first user is admin, with password admin. We replace the password and continue to log in for the first time.
You have your tiki installed, ready for you to continue using the Wizards

1.10. Get a free SSL Certificate from Let's Encrypt

Install a repository to get updated version of packages that will just work:

Copy to clipboard
#sudo add-apt-repository ppa:certbot/certbot #sudo apt update sudo apt install python3-certbot-apache


Before we can start to create the SSL cert, set the domain name in the vhost configuration file. Open the default vhost file with an editor:

Copy to clipboard
nano /etc/apache2/sites-available/000-default.conf


and add the line:

Copy to clipboard
ServerName example.com


Replace example.com with your fully qualified domain name.

Then create the SSL Certificate with this command:

Copy to clipboard
sudo certbot --apache


The command will start a wizard that asks you several questions.
If you want further customization, use other options as described or linked from here:
https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

1.10.1. Add some composer packages through console

If you want, you can add some packages through console

Copy to clipboard
sudo su cd /var/www/html/tiki/ composer require --update-no-dev --prefer-dist mpdf/mpdf composer require --update-no-dev --prefer-dist fullcalendar/fullcalendar-scheduler composer require --update-no-dev --prefer-dist tikiwiki/diagram # updated for Tiki 21.x instead of mxgraph-editor composer require --update-no-dev --prefer-dist onelogin/php-saml composer require --update-no-dev --prefer-dist thiagoalessio/tesseract_ocr # composer require --update-no-dev --prefer-dist npm-asset/pdfjs-dist-viewer-min #composer require --update-no-dev --prefer-dist media-alchemyst/media-alchemyst #composer require --update-no-dev --prefer-dist php-ffmpeg/php-ffmpeg #composer require --update-no-dev --prefer-dist npm-asset/dexie #composer require --update-no-dev --prefer-dist npm-asset/lozad composer require --update-no-dev --prefer-dist google/apiclient service apache2 restart chown www-data:www-data composer.* exit

Tiki 26+

For Tiki26 or higher, you need php8.1. If you want to install this tiki, you will need to tweak the previous git commands to clone branch 26.x.

You should then be able to install the required PHP 8.1 packages with this command:

Copy to clipboard
sudo apt install libapache2-mod-php8.1 memcached php8.1 php8.1-apcu php8.1-bcmath php8.1-bz2 php8.1-common php8.1-curl php8.1-gd php8.1-intl php8.1-ldap php8.1-mbstring php8.1-memcache php8.1-memcached php8.1-mysql php8.1-opcache php8.1-pspell php8.1-soap php8.1-sqlite3 php8.1-tidy php8.1-xml php8.1-xmlrpc php8.1-zip php-apcu php-bcmath php-common php-curl php-gd php-intl php-mbstring php-memcache php-memcached php-mysql php-pear php-pspell php-sqlite3 php-tidy php-xmlrpc php-zip


In this case, you may set the default php version at 8.1 with these commands:

Copy to clipboard
sudo a2dismod php7.4 sudo a2enmod php8.1 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php8.1

Tiki 27+

For Tiki27 or higher installed through the command line, you need a fairly recent version of nodejs (v18) and npm (v10) in your system. Ubuntu 22.04 LTS comes with older versions of those programs by default. Therefore, you need to add some repository and install newer verions from there. See for instance instructions here:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04#option-2-installing-node-js-with-apt-using-a-nodesource-ppa

Example instructions:

Copy to clipboard
cd ~ curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh nano nodesource_setup.sh # you can check what the script does, before running it, since you have just downloaded it from the internet sudo bash nodesource_setup.sh sudo apt install nodejs npm -y


Once, installed nodejs v18+ and npm v10+, you can run in a console in the tiki root folder inside the webserver public www path:

Copy to clipboard
sudo sh seutp.sh


And choose b as the first option, in order to get composer, and npm run and install/compile the corresponding files for tiki to run.

Since Tiki26, you can start using Manticore search for production as your unified search index. You will need to install some extra packages for manticore search:

Copy to clipboard
wget https://repo.manticoresearch.com/manticore-repo.noarch.deb sudo dpkg -i manticore-repo.noarch.deb sudo apt update sudo apt install -y manticore manticore-extra


Once installed, you can start it with:

Copy to clipboard
sudo systemctl start manticore


More information:
https://manticoresearch.com/install/

Related links


1.1. Install Lamp

You can install Linux, Apache, Mysql and PHP (plus a few other helper utils such as git or subversion, etc) with:

Copy to clipboard
sudo apt install mariadb-server mariadb-client apache2 curl composer php php-tidy php-pear memcached php-gd php-xmlrpc phpmyadmin php-mbstring libapache2-mod-php php-mysql php-apcu php-curl php-intl php-sqlite3 php-zip postfix git subversion php-memcache php7.4-gettext php-pspell php-zip poppler-utils php-memcached bsdmainutils pstotext catdoc elinks man-db odt2txt php-pear pstotext php-common php-intl php-bcmath php7.4-opcache php7.4-xml php7.4-zip php7.4-ldap php7.4-bz2

Note

If you need to install Tiki22 or newer, you don't need to add any extra repository, since you already have php 7.4 using the default ubuntu 20.04 repositories.

Need extra repos for php 7.4+ ?

[+]

Add php 7.4 packages

Copy to clipboard
sudo apt -y install php7.4 php7.4-tidy php7.4-gd php7.4-xmlrpc php7.4-mbstring php7.4-mysql php7.4-apcu php7.4-curl php7.4-intl php7.4-sqlite3 php7.4-zip php7.4-memcache php7.4-pspell php7.4-memcached php7.4-common php7.4-opcache php7.4-xml php7.4-ldap php7.4-bcmath php7.4-soap libapache2-mod-php7.4 php7.4-bz2

Set php 7.4 as default

In case you have other php versions newer than 7.4 (such as php 8.0.x), you may set the default php version at 7.4 with these commands:

Copy to clipboard
sudo a2dismod php8.0 sudo a2enmod php7.4 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.4

Extra steps needed

If it's a brand new server, you might be asked a few questions to configure some server programs.

To configure postfix (program to mange email sending and receiving from the server), you can answer, for instance (unless you know what you are doing):

  • General type of mail configuration: Internet site
  • System mail name: mail.yourdomain.org


To configure phpmyadmin (program to manage mysql databases through a web based GUI), you can answer, for instance (unless you know what you are doing):

  • Webserver: apache2 (you can select using the space bar and arrow keys if needed to move between the options)
  • Configure database with dbconfig-common: yes
  • MySQL application password for phpmyadmin: [leave empty]




Then you can enable the modules

Copy to clipboard
#sudo phpenmod mcrypt # mcrypt is not found in php 7.2 sudo phpenmod mbstring


Extra packages for Media Alchemyst:

Copy to clipboard
#sudo apt install software-properties-common #sudo add-apt-repository ppa:libreoffice/libreoffice-6-0 # not available for ubuntu 20.04 at the time of this writing sudo apt install libreoffice ffmpeg unoconv ghostscript php-imagick imagemagick



Enable the Apache rewrite rules:

Command on a console
Copy to clipboard
sudo a2enmod rewrite sudo service apache2 restart


And you can enable the self-signed ssl certificates to allow connections with https:

Command on a console
Copy to clipboard
sudo a2enmod ssl sudo a2ensite default-ssl sudo service apache2 restart


And add this section between the VirtualHost tags the to this file /etc/apache2/sites-enabled/000-default.conf (or equivalent for your configuration; in this case, the doc. root where tiki is installed is /var/www/html/, which is where ubuntu 20.04 comes pre-configured for the base doc root):

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/000-default.conf


Section to add (just after the Document root line):

Copy to clipboard
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory>


Do the same type of edit into the equivalent config file for https:

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/default-ssl.conf



After the change, they should look like:

Contents of /etc/apache2/sites-enabled/000-default.conf
Copy to clipboard
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Contents of /etc/apache2/sites-enabled/default-ssl.conf
Copy to clipboard
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. # BrowserMatch "MSIE [2-6]" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

1.2. Create for tiki a mysql db and a mysql user with local perms for that db

Option 1 - using console

We can create a database and user for tiki. We can do so through a terminal windows converting ourselves in root in a first step with sudo su, and then, we can continue with the mysql commands. Please note that when executing mysql -+ (as root) you need to provide no password, since mysql authenticaation scheme in Ubuntu 18.04 only requires that you run this command as user root in the shell.

commands in a terminal window
Copy to clipboard
# sudo su # mysql -p # mysql> CREATE DATABASE mytikidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # mysql> CREATE USER 'mytikiuser'@'localhost' IDENTIFIED BY 'mypassword'; # mysql> GRANT ALL ON mytikidb.* TO 'mytikiuser'@'localhost'; # mysql> FLUSH PRIVILEGES; # mysql> \q


If it's a brand new server, you may wish (at your own risk) to secure your mysql installation with the provided script ( sudo mysql_secure_installation ), and do the recommended setup steps indicated here:
https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/

Option 2 - use phpmyadmin or adminer

Alternatively, you can use your PhpMyAdmin install:
http://example.com/phpmyadmin/

or a small php script to manage your mysql server, called Adminer, that you can download to your server with an instruction like this one in a terminal:

Copy to clipboard
sudo wget https://www.adminer.org/latest-mysql-en.php -O "/var/www/html/tiki/adminer.php" # once you are done with managing your database and users, you are encouraged to remove adminer.php from the web access to somewhere else unaccessible from your web root for extra precaution sudo mv /var/www/html/tiki/adminer.php /var/www/


Then you can login to your GUI web access (either phpmyadmin or adminer). You will probably not be able to login with your mysql root password, since the msyql auth scheme in ubuntu 18.04 has changed compared to previous versions (it currently uses auth_socket instead of native_mysql_password).
Therefore, you can use the debian-sys-maint credentials that you will find here:
/etc/mysql/debian.cnf

  • Create a new user for mysql that does NOT have all perms
    • New user is tikiuser, and we do not select neither database nor general perms for this user.
  • Go to the start page for PhpMyAdmin/Adminer again
  • Create a bbdd named tiki18svn and as collation select utf8mb4_unicode_ci
  • Go to the users tab, and go to Databases
    • Select the db tiki18svn, and check all perms except "grant" to that user for that db


And that's all. Then you will need to tell tiki that we have created:

  • mysql db: tiki18svn
  • mysql user: tikiuser
  • mysql password: xxxxxxx (whatever you provided as password)


It is recommended to secure your phpMyAdmin by following the steps: https://www.atlantic.net/vps-hosting/how-to-install-and-secure-phpmyadmin-on-centos-8/

1.3. Use bash instead of dash

Ubuntu 20.04 comes with dash as the default shell interpreter. And Tiki shell scripts expect bash instead of dash. Therefore, one easy solution is to setup bash for your user with sudo perms in the server to use bash by default. You can do so with the command (for user username):

Copy to clipboard
usermod --shell /bin/bash yourusername


More information:

1.4. Install Tiki 21 through git

(url's taken from http://dev.tiki.org/Get+code )

We will fetch tiki21 through git shallow clone. This option is best to checkout on production servers. It uses about 187M of disk space.

Change directory to /var/www and get that tiki21 clone:

Copy to clipboard
cd /var/www git clone --depth=1 --branch=21.x https://gitlab.com/tikiwiki/tiki.git tiki21


Then we run the Tiki setup script through console:

Copy to clipboard
cd tiki21 bash setup.sh


The first question you will asked is about running composer to fetch the dependencies (libraries) which need to be downloaded for Tiki to run:

Copy to clipboard
# First choose: Your choice [c]?: c # Then choose to fix file and directory permissions (classic default): Your choice [f]?: f User [www-data]: www-data Group [www-data]: www-data Multi []: # Then you can quit from the setup.sh script: Your choice [x]?: x


You can have a look at what the script does here:
https://gitlab.com/tikiwiki/tiki/-/blob/21.x/setup.sh

This script manages all Tiki dependencies through a program called "Composer" (it downloads and updated them when needed)

You need to make this tiki21 folder available through the webserver.
You can easily do so by means of a symbolic link

Copy to clipboard
ln -s /var/www/tiki21 /var/www/html/tiki


Then you can proceed with the standard Tiki installation through the web browser (replace example.com with your domain name):
http://example.com/tiki/

and this will take us to tiki-install.php:
http://example.com/tiki/tiki-install.php

Tip for Spanish speakers: see the video from a course on Tiki:


At the screen to Setup the database connection, we provide the database name, db user and password that we previosuly created and we follow instructions on screen.

At the new installation, the first user is admin, with password admin. We replace the password and continue to log in for the first time.
You have your tiki installed, ready for you to continue using the Wizards

1.5. Get a free SSL Certificate from Let's Encrypt

Install a repository to get updated version of packages that will just work:

Copy to clipboard
#sudo add-apt-repository ppa:certbot/certbot #sudo apt update sudo apt install python3-certbot-apache


Before we can start to create the SSL cert, set the domain name in the vhost configuration file. Open the default vhost file with an editor:

Copy to clipboard
nano /etc/apache2/sites-available/000-default.conf


and add the line:

Copy to clipboard
ServerName example.com


Replace example.com with your fully qualified domain name.

Then create the SSL Certificate with this command:

Copy to clipboard
sudo certbot --apache


The command will start a wizard that asks you several questions.
If you want further customization, use other options as described or linked from here:
https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

1.5.1. Add some composer packages through console

If you want, you can add some packages through console

Copy to clipboard
sudo su cd /var/www/html/ composer require --update-no-dev --prefer-dist mpdf/mpdf composer require --update-no-dev --prefer-dist fullcalendar/fullcalendar-scheduler composer require --update-no-dev --prefer-dist tikiwiki/diagram # updated for Tiki 21.x instead of mxgraph-editor composer require --update-no-dev --prefer-dist onelogin/php-saml composer require --update-no-dev --prefer-dist thiagoalessio/tesseract_ocr # composer require --update-no-dev --prefer-dist npm-asset/pdfjs-dist-viewer-min #composer require --update-no-dev --prefer-dist media-alchemyst/media-alchemyst #composer require --update-no-dev --prefer-dist php-ffmpeg/php-ffmpeg #composer require --update-no-dev --prefer-dist npm-asset/dexie #composer require --update-no-dev --prefer-dist npm-asset/lozad composer require --update-no-dev --prefer-dist google/apiclient service apache2 restart chown www-data:www-data composer.* exit

Related links


1.1. Install Lamp

You can install Linux, Apache, Mysql and PHP (plus a few other helper utils such as git or subversion, etc) with:

Copy to clipboard
sudo apt install mysql-server mysql-client apache2 curl composer php php-tidy php-pear memcached php-gd php-xmlrpc phpmyadmin php-mbstring libapache2-mod-php php-mysql php-apcu php-curl php-intl php-sqlite3 php-zip postfix git subversion php-memcache php-gettext php-pspell php-zip poppler-utils php-memcached bsdmainutils pstotext catdoc elinks man-db odt2txt php-pear pstotext php-common php-intl php7.2-opcache php7.2-xml php7.2-zip php7.2-ldap

Note

If you need to install Tiki22 or newer, since they require php 7.4, you will need to add a couple of extra repository to the server, in order to be able to install the php 7.4 packages.

Copy to clipboard
sudo apt-get update sudo apt -y install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo add-apt-repository ppa:ondrej/apache2 sudo apt-get update sudo apt -y install php7.4 php7.4-tidy php7.4-gd php7.4-xmlrpc php7.4-mbstring php7.4-mysql php7.4-apcu php7.4-curl php7.4-intl php7.4-sqlite3 php7.4-zip php7.4-memcache php7.4-pspell php7.4-memcached php7.4-common php7.4-opcache php7.4-xml php7.4-ldap php7.4-bcmath php7.4-soap php7.4-bz2 libapache2-mod-php7.4


In case you have other php versions newer than 7.4 (such as php 8.0.x), you may set the default php version at 7.4 with these commands:

Copy to clipboard
sudo a2dismod php8.0 sudo a2enmod php7.4 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.4


If it's a brand new server, you might be asked a few questions to configure some server programs.

To configure postfix (program to mange email sending and receiving from the server), you can answer, for instance (unless you know what you are doing):

  • General type of mail configuration: Internet site
  • System mail name: mail.yourdomain.org


To configure phpmyadmin (program to manage mysql databases through a web based GUI), you can answer, for instance (unless you know what you are doing):

  • Webserver: apache2 (you can select using the space bar and arrow keys if needed to move between the options)
  • Configure database with dbconfig-common: yes
  • MySQL application password for phpmyadmin: [leave empty]




Then you can enable the modules

Copy to clipboard
#sudo phpenmod mcrypt # mcrypt is not found in php 7.2 sudo phpenmod mbstring


Extra packages for Media Alchemyst:

Copy to clipboard
sudo apt install software-properties-common sudo add-apt-repository ppa:libreoffice/libreoffice-6-0 sudo apt install libreoffice ffmpeg unoconv ghostscript php-imagick imagemagick



Enable the Apache rewrite rules:

Command on a console
Copy to clipboard
sudo a2enmod rewrite sudo service apache2 restart


And you can enable the self-signed ssl certificates to allow connections with https:

Command on a console
Copy to clipboard
sudo a2enmod ssl sudo a2ensite default-ssl sudo service apache2 restart


And add this section between the VirtualHost tags the to this file /etc/apache2/sites-enabled/000-default.conf (or equivalent for your configuration; in this case, the doc. root where tiki is installed is /var/www/html/, which is where ubuntu 16.04 comes pre-configured for the base doc root):

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/000-default.conf


Section to add (just after the Document root line):

Copy to clipboard
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory>


Do the same type of edit into the equivalent config file for https:

Copy to clipboard
sudo nano /etc/apache2/sites-enabled/default-ssl.conf



After the change, they should look like:

Contents of /etc/apache2/sites-enabled/000-default.conf
Copy to clipboard
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Contents of /etc/apache2/sites-enabled/default-ssl.conf
Copy to clipboard
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All ## The following lines to allow connections have changed syntax ## between apache 2.2 and apache 2.4 ## See: http://httpd.apache.org/docs/2.4/upgrading.html > Run-Time Configuration Changes > Access control #Order allow,deny #Allow from all Require all granted </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. # BrowserMatch "MSIE [2-6]" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

1.2. Create for tiki a mysql db and a mysql user with local perms for that db

Option 1 - using console

We can create a database and user for tiki. We can do so through a terminal windows converting ourselves in root in a first step with sudo su, and then, we can continue with the mysql commands. Please note that when executing mysql -+ (as root) you need to provide no password, since mysql authenticaation scheme in Ubuntu 18.04 only requires that you run this command as user root in the shell.

commands in a terminal window
Copy to clipboard
# sudo su # mysql -p # mysql> CREATE DATABASE mytikidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # mysql> GRANT ALL PRIVILEGES ON mytikidb.* TO 'mytikiuser'@'localhost' IDENTIFIED BY 'mypassword'; # mysql> FLUSH PRIVILEGES; # mysql> \q


If it's a brand new server, you are encouraged to secure your mysql installation with the provided script ( sudo mysql_secure_installation ), and do the recommended setup steps indicated here:
https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/

Option 2 - use phpmyadmin or adminer

Alternatively, you can use your PhpMyAdmin install:
http://example.com/phpmyadmin/

or a small php script to manage your mysql server, called Adminer, that you can download to your server with an instruction like this one in a terminal:

Copy to clipboard
sudo wget https://www.adminer.org/latest-mysql-en.php -O "/var/www/html/tiki/adminer.php" # once you are done with managing your database and users, you are encouraged to remove adminer.php from the web access to somewhere else unaccessible from your web root for extra precaution sudo mv /var/www/html/tiki/adminer.php /var/www/


Then you can login to your GUI web access (either phpmyadmin or adminer). You will probably not be able to login with your mysql root password, since the msyql auth scheme in ubuntu 18.04 has changed compared to previous versions (it currently uses auth_socket instead of native_mysql_password).
Therefore, you can use the debian-sys-maint credentials that you will find here:
/etc/mysql/debian.cnf

  • Create a new user for mysql that does NOT have all perms
    • New user is tikiuser, and we do not select neither database nor general perms for this user.
  • Go to the start page for PhpMyAdmin/Adminer again
  • Create a bbdd named tiki18svn and as collation select utf8mb4_unicode_ci
  • Go to the users tab, and go to Databases
    • Select the db tiki18svn, and check all perms except "grant" to that user for that db


And that's all. Then you will need to tell tiki that we have created:

  • mysql db: tiki18svn
  • mysql user: tikiuser
  • mysql password: xxxxxxx (whatever you provided as password)

1.3. Use bash instead of dash

Ubuntu 18.04 comes with dash as the default shell interpreter. And Tiki shell scripts expect bash instead of dash. Therefore, one easy solution is to setup bash for your user with sudo perms in the server to use bash by default. You can do so with the command (for user username):

Copy to clipboard
usermod --shell /bin/bash yourusername


More information:

1.4. Install Tiki 21 through git

(url's taken from http://dev.tiki.org/Get+code )

We will fetch tiki21 through git shallow clone. This option is best to checkout on production servers. It uses about 187M of disk space.

Change directory to /var/www and get that tiki21 clone:

Copy to clipboard
cd /var/www git clone --depth=1 --branch=21.x https://gitlab.com/tikiwiki/tiki.git tiki21


Then we run the Tiki setup script through console:

Copy to clipboard
cd tiki21 bash setup.sh


The first question you will asked is about running composer to fetch the dependencies (libraries) which need to be downloaded for Tiki to run:

Copy to clipboard
# First choose: Your choice [c]?: c # Then choose to fix file and directory permissions (classic default): Your choice [f]?: f User [www-data]: www-data Group [www-data]: www-data Multi []: # Then you can quit from the setup.sh script: Your choice [x]?: x


You can have a look at what the script does here:
https://gitlab.com/tikiwiki/tiki/-/blob/21.x/setup.sh

This script manages all Tiki dependencies through a program called "Composer" (it downloads and updated them when needed)

You need to make this tiki21 folder available through the webserver.
You can easily do so by means of a symbolic link

Copy to clipboard
ln -s /var/www/tiki21 /var/www/html/tiki


Then you can proceed with the standard Tiki installation through the web browser (replace example.com with your domain name):
http://example.com/tiki/

and this will take us to tiki-install.php:
http://example.com/tiki/tiki-install.php

Tip for Spanish speakers: see the video from a course on Tiki:


At the screen to Setup the database connection, we provide the database name, db user and password that we previosuly created and we follow instructions on screen.

At the new installation, the first user is admin, with password admin. We replace the password and continue to log in for the first time.
You have your tiki installed, ready for you to continue using the Wizards

1.4.1. Additional step for H5P

It seems that you need to create a folder for h5p to work as expected (in case you have H5P enabled in your site); otherwise, when you attempt to upload a file to a file gallery, you get an error message saying that Tiki cannot write to the corresponding folder from h5p.

You can run these commands, from the tiki root folder in the server:

Copy to clipboard
sudo mkdir storage/public/h5p sudo chmod 775 storage/public/h5p

1.5. Get a free SSL Certificate from Let's Encrypt

Install a repository to get updated version of packages that will just work:

Copy to clipboard
sudo add-apt-repository ppa:certbot/certbot sudo apt update sudo apt install python-certbot-apache


Before we can start to create the SSL cert, set the domain name in the vhost configuration file. Open the default vhost file with an editor:

Copy to clipboard
nano /etc/apache2/sites-available/000-default.conf


and add the line:

Copy to clipboard
ServerName example.com


Replace example.com with your fully qualified domain name.

Then create the SSL Certificate with this command:

Copy to clipboard
sudo certbot --apache


The command will start a wizard that asks you several questions.
If you want further customization, use other options as described or linked from here:
https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

1.5.1. Add some composer packages through console

If you want, you can add some packages through console

Copy to clipboard
sudo su cd /var/www/html/ composer require --update-no-dev --prefer-dist mpdf/mpdf composer require --update-no-dev --prefer-dist fullcalendar/fullcalendar-scheduler #composer require --update-no-dev --prefer-dist xorti/mxgraph-editor # deprecated for Tiki 21.x composer require --update-no-dev --prefer-dist tikiwiki/diagram # updated for Tiki 21.x instead of mxgraph-editor composer require --update-no-dev --prefer-dist onelogin/php-saml composer require --update-no-dev --prefer-dist thiagoalessio/tesseract_ocr # composer require --update-no-dev --prefer-dist npm-asset/pdfjs-dist-viewer-min #composer require --update-no-dev --prefer-dist media-alchemyst/media-alchemyst #composer require --update-no-dev --prefer-dist php-ffmpeg/php-ffmpeg #composer require --update-no-dev --prefer-dist npm-asset/dexie #composer require --update-no-dev --prefer-dist npm-asset/lozad composer require --update-no-dev --prefer-dist google/apiclient service apache2 restart chown www-data:www-data composer.* exit