You've already forked dokuwiki-ubuntu
initial commit
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Allan Christensen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
107
README.md
Normal file
107
README.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
# DokuWiki for Ubuntu 24.04 Server
|
||||||
|
[](#)
|
||||||
|
[](#)
|
||||||
|
[](#)
|
||||||
|
[](#)
|
||||||
|
[](#)
|
||||||
|
[](./LICENSE)
|
||||||
|
|
||||||
|
Automated Bash installer for deploying the **latest stable release of DokuWiki** on Ubuntu 24.04 Server.
|
||||||
|
|
||||||
|
This is a **production-focused installer**, not a demo.
|
||||||
|
|
||||||
|
It assumes that Nginx and PHP-FPM are already installed and running.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Related Installers
|
||||||
|
|
||||||
|
If you don’t have the required components, you can use this compatible installer:
|
||||||
|
|
||||||
|
- [Nginx + PHP-FPM Installer](https://git.x-files.dk/webserver/nginx-ubuntu)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Download the Script
|
||||||
|
Clone the repository to your server:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://git.x-files.dk/webapps/dokuwiki-ubuntu.git
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
cd dokuwiki-ubuntu
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
Run the script and provide your desired domain name as an argument:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo ./dokuwikiinstall <domain name>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```
|
||||||
|
sudo ./dokuwikiinstall wiki.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
When the installation completes, visit:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://<domain>/install.php
|
||||||
|
```
|
||||||
|
|
||||||
|
and complete the initial DokuWiki setup through the web interface.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Post-install
|
||||||
|
After completing the web-based installation, run the post-install script to apply security and hardening settings:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo /tmp/dokuwiki-postinstall
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Nginx Integration
|
||||||
|
|
||||||
|
The generated DokuWiki configuration file listens on port 80.
|
||||||
|
To enable HTTPS (port 443), use the example provided [here](https://git.x-files.dk/webserver/nginx-snippets/src/branch/main/hostfiles/dokuwiki.443.conf)
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> The file also includes optional caching directives (commented out by default).
|
||||||
|
> You can enable them to improve load times and performance if needed.
|
||||||
|
> The lines you are looking for are at the bottom of the generated config file and look like this:
|
||||||
|
> ```
|
||||||
|
> ##### Cache js css static content and open files start #####################
|
||||||
|
> # include /etc/nginx/nginx-snippets/cache-open-files.conf;
|
||||||
|
> # include /etc/nginx/nginx-snippets/cache-statics.conf;
|
||||||
|
> # include /etc/nginx/nginx-snippets/cache-js-css.conf;
|
||||||
|
> ##### Cache js css static content and open files stop ######################
|
||||||
|
> ```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
**Nginx fails to restart**
|
||||||
|
Run `nginx -t` and review any syntax errors reported in `/etc/nginx/conf.d/<domain>.conf`.
|
||||||
|
|
||||||
|
**PHP version mismatch**
|
||||||
|
The script automatically detects your installed PHP version,
|
||||||
|
but ensure that the PHP-FPM service (e.g., `php8.3-fpm`) is active.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### More Information
|
||||||
|
|
||||||
|
More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### License
|
||||||
|
Licensed under the [MIT License](./LICENSE).
|
||||||
|
|
||||||
|
---
|
||||||
145
dokuwikiinstall
Executable file
145
dokuwikiinstall
Executable file
@@ -0,0 +1,145 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Author : Allan Christensen
|
||||||
|
# First Created : 05012022 (DD-MM-YYYY)
|
||||||
|
# Description : Installs DokuWiki on Ubuntu 24.04
|
||||||
|
# License : MIT License (see LICENSE file for details)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Are we root
|
||||||
|
#
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit 1 ; fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define variables and functions
|
||||||
|
#
|
||||||
|
hostname="$1"
|
||||||
|
phpver=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') ; phpfpm="php$phpver-fpm"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function usage
|
||||||
|
#
|
||||||
|
usage () {
|
||||||
|
printf -- "\ndokuwikiinstall\n\n"
|
||||||
|
printf -- "Installs DokuWiki on Ubuntu\n\n"
|
||||||
|
printf -- "Usage:\n"
|
||||||
|
printf -- "sudo ./dokuwikiinstall <domain>\n"
|
||||||
|
printf -- "Examples:\n"
|
||||||
|
printf -- "sudo ./dokuwikiinstall wiki.something.xyz\n\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function to check if a service is already running or not
|
||||||
|
#
|
||||||
|
serviceno () { printf "\n%s" "$service" ; printf " is not running cannot continue...\n\n"; }
|
||||||
|
servicedead () { status=$(systemctl is-active "$service"); if [[ "$status" != "active" ]]; then serviceno ; exit 1 ; fi; }
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function input check
|
||||||
|
#
|
||||||
|
inputcheck () { if [[ -z "$1" ]]; then usage ; printf "ERROR: DOMAIN CANNOT BE EMPTY!\n\n" ; exit; fi; }
|
||||||
|
|
||||||
|
#
|
||||||
|
# If Nginx is not running then die
|
||||||
|
#
|
||||||
|
service="nginx" ; servicedead
|
||||||
|
|
||||||
|
#
|
||||||
|
# Let's go
|
||||||
|
#
|
||||||
|
clear
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check if input conditions are met
|
||||||
|
#
|
||||||
|
inputcheck "$hostname"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Clone nginx-snippets; if nginx-snippets exists then just pull latest changes
|
||||||
|
#
|
||||||
|
nginxsnippets="/etc/nginx/nginx-snippets"
|
||||||
|
repo="https://git.x-files.dk/webserver/nginx-snippets.git"
|
||||||
|
if [[ -d "$nginxsnippets/.git" ]]; then git -C "$nginxsnippets" pull --quiet; else git clone --quiet "$repo" "$nginxsnippets"; fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Download the latest Dokuwiki
|
||||||
|
#
|
||||||
|
wikidir="/var/www/html/$hostname" ; mkdir -p "$wikidir"
|
||||||
|
curl -sL https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz | tar -xzf - -C "$wikidir" --strip-components=1 || { echo "Download or extraction failed"; exit 1; }
|
||||||
|
chown -R www-data: "$wikidir"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create a DokuWiki nginx configuration file
|
||||||
|
#
|
||||||
|
cp "$nginxsnippets/hostfiles/dokuwiki.80.conf" /etc/nginx/conf.d/"$hostname".conf
|
||||||
|
sed -i "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf
|
||||||
|
sed -i "s/VERSION/$phpver/" /etc/nginx/conf.d/"$hostname".conf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Restarting Nginx and Phpfpm for changes to take effect
|
||||||
|
#
|
||||||
|
systemctl restart "$phpfpm" ; systemctl restart nginx
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create postinstall script
|
||||||
|
#
|
||||||
|
cat > /tmp/dokuwiki-postinstall <<EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Dokiwiki Postinstall Script
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Are we root?
|
||||||
|
#
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit ; fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hardening of Dokuwiki
|
||||||
|
#
|
||||||
|
sed -i 's/# location /location /g' /etc/nginx/conf.d/"$hostname".conf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Restart Nginx for changes to take effect
|
||||||
|
#
|
||||||
|
systemctl restart nginx
|
||||||
|
|
||||||
|
#
|
||||||
|
# Cleaning up
|
||||||
|
#
|
||||||
|
rm -f /tmp/dokuwiki-postinstall
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 755 /tmp/dokuwiki-postinstall
|
||||||
|
|
||||||
|
#
|
||||||
|
# DokuWiki postinstall notice
|
||||||
|
#
|
||||||
|
wikinotice=$(cat <<EOF
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
IMPORTANT: Go to http://$hostname/install.php in order to complete the installation:
|
||||||
|
|
||||||
|
Don't worry about the warning on the right side of the page this will be
|
||||||
|
fixed as there still is a post install step to do.
|
||||||
|
|
||||||
|
Once done run the following command as root or using sudo.
|
||||||
|
|
||||||
|
sudo /tmp/dokuwiki-postinstall
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Print notice
|
||||||
|
#
|
||||||
|
printf '%s\n' "$wikinotice"
|
||||||
|
|
||||||
|
#
|
||||||
|
# All done
|
||||||
|
#
|
||||||
|
printf "\nAll Done...\n"
|
||||||
|
|
||||||
|
#
|
||||||
|
# End of script
|
||||||
|
#
|
||||||
4
last-tested
Normal file
4
last-tested
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
------------------------------------
|
||||||
|
Last tested: 15-10-2025 (DD-MM-YYYY)
|
||||||
|
Environment: Ubuntu Server 24.04 LTS
|
||||||
|
------------------------------------
|
||||||
Reference in New Issue
Block a user