Install DokuWiki Wiki Software on Ubuntu 16.04 | 18.04 | 18.10 with Apache2, PHP 7.2
How to Install DokuWiki on Ubuntu 18.04 LTS
Установка DokuWiki
Установка DokuWiki на Debian/Ubuntu на Nginx с авторизацией LDAP (AD) и установкой плагинов
Как развернуть DokuWiki on Ubuntu 18.04 Server
Часто задаваемые вопросы
Запись А wiki.examle.com host в DNS домена example.com
На хосте lxd :
$ lxc launch ubuntu:18.04 wiki
$ lxc exec wiki -- sudo --user ubuntu --login
$ sudo apt update
$ sudo apt upgrade
$ sudo locale-gen en_US ru_RU en_US.UTF-8 ru_RU.UTF-8
$ sudo timedatectl set-timezone Europe/Moscow
$ sudo apt install mc cadaver -y
$ sudo apt install apache2 -y
#$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php -y
$ sudo apt update
$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-sqlite3 php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-tidy php7.2-intl php7.2-json php7.2-curl php7.2-zip -y
$ sudo nano /etc/php/7.2/apache2/php.ini
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Europe/Moscow
$ sudo systemctl restart apache2.service
$ cd /var/www/html/
$ sudo git clone --branch stable https://github.com/splitbrain/dokuwiki.git
$ sudo chown -R www-data:www-data /var/www/html/dokuwiki/
$ sudo chmod -R 755 /var/www/html/dokuwiki/
Обратить внимание, запись А
wiki.example.com host в домен example.com
ServerName
wiki.example.com
$ sudo nano /etc/apache2/sites-available/dokuwiki.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/dokuwiki
ServerName wiki.example.com
#ServerAlias www.example.com
<Directory /var/www/html/dokuwiki/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/dokuwiki/>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]
</Directory>
</VirtualHost>
Сохранить.
$ sudo a2ensite dokuwiki.conf
$ sudo a2enmod rewrite
$ exit
$ lxc list
| wiki | RUNNING | 10.91.219.37 (eth0) |
Далее в контейнере haproxy:
$ lxc exec haproxy -- sudo --user ubuntu --login
$ sudo nano /etc/hosts
10.91.219.37 wiki.lxd
$ sudo nano /etc/haproxy/haproxy.cfg
...
acl host_wiki hdr(host) -i wiki.example.com
...
use_backend subdomain5 if host_wiki
...
acl web_wiki hdr(host) -i wiki.example.com
...
use_backend subdomain5 if web_wiki
...
backend subdomain5
balance leastconn
http-request set-header X-Client-IP %[src]
#redirect scheme https if !{ ssl_fc }
server wordpress wiki.lxd:80 check
Сохранить.
$ sudo systemctl restart haproxy
https://wiki.example.com/install.php
https://wiki.example.com/doku.php
После успешной установки:
$ lxc exec wiki -- sudo --user ubuntu --login
$ sudo rm /var/www/html/dokuwiki/install.php
$ exit
Настроим backup
$ nano /home/user/backup_wiki_lxd.sh
#!/usr/bin/env bash
set -ex
lxc stop wiki
BACKUP_DIR=/home/user/backup
#HOSTS=$(lxc list -c n --format csv)
HOSTS=wiki
for HOST in ${HOSTS}
do
BACKUP_NAME=${HOST}-$(date +"%Y-%m-%d")
lxc snapshot ${HOST} auto-backup
lxc publish ${HOST}/auto-backup --alias ${BACKUP_NAME}
#lxc image export ${BACKUP_NAME} ${BACKUP_DIR}/${BACKUP_NAME}.tar.gz
lxc image export ${BACKUP_NAME} ${BACKUP_DIR}/${BACKUP_NAME}
lxc image delete ${BACKUP_NAME}
lxc delete ${HOST}/auto-backup
done
lxc start wiki
Сохранить.
$ chmod +x /home/user/backup_wiki_lxd.sh
$ crontab -e
00 4 * * * sh /home/user/backup_wiki_lxd.sh
Сохранить.