initial commit
This commit is contained in:
commit
55aa37782e
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 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.
|
50
README.md
Normal file
50
README.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
## Dokuwiki install script for Ubuntu 22.04 and 24.04 server.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
Ubuntu 22.04 or higher with Nginx and Php-Fpm. Nginx with Php-Fpm can be installed from
|
||||||
|
[\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install)
|
||||||
|
|
||||||
|
**Important:**\
|
||||||
|
This the script will only work if you installed Nginx using the script located [\[Here\]](https://git.x-files.dk//ubuntu-web-server/nginx-install)
|
||||||
|
|
||||||
|
### Download the script
|
||||||
|
```
|
||||||
|
git clone https://git.x-files.dk/ubuntu-web-application/dokuwiki-install.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
cd dokuwiki-install
|
||||||
|
sudo ./dokuwikiinstall <domain name>
|
||||||
|
|
||||||
|
### Example
|
||||||
|
sudo ./dokuwikiinstall wiki.something.xyz
|
||||||
|
|
||||||
|
This will create a Dokuwiki site running on port 80 with the domain name you chose under the installation.
|
||||||
|
Don't worry though this can easily be fixed by modifying the Nginx configuration later.
|
||||||
|
If you need an example on how to configure Nginx to run this on port 443 I an example
|
||||||
|
[\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg-apps/dokuwiki.443.conf)
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
Once the script is done browse to http://<i></i>wiki.hostname.xyz/install.php and fill out the mandatory fields marked with green.
|
||||||
|
<p align="center" width="100%">
|
||||||
|
<img src="https://git.x-files.dk/assets/dokuwiki-configuration.png" alt="Dokuwiki Configuration"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### Post install
|
||||||
|
This is needed in order to change some configuration settings in Nginx after you are done with the setup screen.
|
||||||
|
|
||||||
|
cd dokuwiki-install
|
||||||
|
sudo ./postinstall
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
Most issues will probably be caused by the fact that we all set up and configure Nginx diffrently. If you encounter problems I would suggest you look at the Nginx configuration I use
|
||||||
|
[\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg/nginx.conf)
|
||||||
|
and also the default "sites-enabled" Nginx configurarion I use
|
||||||
|
[\[Here\]](https://git.x-files.dk/ubuntu-web-server/nginx-install/src/branch/main/cfg/default)
|
||||||
|
when you start troubleshooting.
|
||||||
|
|
||||||
|
### More guides
|
||||||
|
More guides can be found on [\[wiki.x-files.dk\]](https://wiki.x-files.dk)
|
||||||
|
|
||||||
|
### Last tested
|
||||||
|
October 10th 2024 on Ubuntu 24.04.
|
111
dokuwikiinstall
Executable file
111
dokuwikiinstall
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# First Created: 17082021 Author: Allan Desc: Installs DokuWiki on Ubuntu requires Nginx #
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Are we root
|
||||||
|
#
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit ; fi
|
||||||
|
#
|
||||||
|
# Are we in the right directory
|
||||||
|
#
|
||||||
|
scriptdir="dokuwiki-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
||||||
|
if [ $whereami != $scriptdir ]; then printf "\nWrong directory! Script must be run from $scriptdir\n\n" ; exit ; fi
|
||||||
|
#
|
||||||
|
# Define variables and functions
|
||||||
|
#
|
||||||
|
red='\033[0;31m' ; bred='\033[1;31m' ; green='\033[0;92m' ; blue='\033[0;36m' ; bold='\033[1m' ; normal='\033[0m'
|
||||||
|
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
||||||
|
nginxfiles="/etc/nginx/nginxsnippets"
|
||||||
|
phpver=$(php -v |head -1 |awk -F'.' '{print $1"."$2}' |sed 's/PHP //')
|
||||||
|
phpfpm="php$phpver-fpm" ; phpclidir="/etc/php/$phpver/cli" ; phpfpmdir="/etc/php/$phpver/fpm" ; socket="php$phpver"
|
||||||
|
#
|
||||||
|
# Function title
|
||||||
|
#
|
||||||
|
title () { printf "\nDokuwiki install script V1.0\n\n"; }
|
||||||
|
#
|
||||||
|
# Function usage
|
||||||
|
#
|
||||||
|
usage () { clear ; printf -- "\n"
|
||||||
|
printf -- "${bold}dokuwikiinstall${normal} \n\n"
|
||||||
|
printf -- "${bold}Usage:${normal} \n"
|
||||||
|
printf -- "./dokuwikiinstall <domain> \n"
|
||||||
|
printf -- "${bold}Examples:${normal} \n"
|
||||||
|
printf -- "./dokuwikiinstall wiki.something.xyz\n\n"; }
|
||||||
|
#
|
||||||
|
# Function to check if a service is already running or not
|
||||||
|
#
|
||||||
|
serviceno () { printf "\n$service is not running cannot continue...\n\n"; }
|
||||||
|
servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "active" ]]; then serviceno ; exit; fi; }
|
||||||
|
#
|
||||||
|
# Function input check
|
||||||
|
#
|
||||||
|
inputcheck () {
|
||||||
|
if [[ -z "$1" ]]; then printf "${bold}Error! ${normal}Hostname Empty...\n\n" ; exit; fi; }
|
||||||
|
#
|
||||||
|
# If Nginx is not running then die
|
||||||
|
#
|
||||||
|
service="nginx" ; servicedead
|
||||||
|
#
|
||||||
|
# Check if input conditions are met
|
||||||
|
#
|
||||||
|
usage ; inputcheck $1
|
||||||
|
#
|
||||||
|
# Display title
|
||||||
|
#
|
||||||
|
clear ; title
|
||||||
|
#
|
||||||
|
# Check if nginxsnippets exist if not download them
|
||||||
|
#
|
||||||
|
if [[ ! -d "$nginxfiles" ]]; then
|
||||||
|
git clone --quiet https://git.x-files.dk/ubuntu-web-server/nginx-install.git ; cp -R nginx-install/nginxsnippets /etc/nginx
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
# Download the latest Dokuwiki
|
||||||
|
#
|
||||||
|
wget --no-verbose https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
|
||||||
|
#
|
||||||
|
# Create a DokuWiki nginx configuration file
|
||||||
|
#
|
||||||
|
curl --silent https://git.x-files.dk/ubuntu-web-server/nginx-install/raw/branch/main/cfg-apps/dokuwiki.80.conf > /etc/nginx/conf.d/$1.conf
|
||||||
|
sed -s -i "s/DOMAIN/$1/g" /etc/nginx/conf.d/$1.conf
|
||||||
|
sed -i "s/VERSION/$phpver/" /etc/nginx/conf.d/$1.conf
|
||||||
|
#
|
||||||
|
# Restarting Nginx and Phpfpm for changes to take effect
|
||||||
|
systemctl restart nginx && systemctl restart $phpfpm
|
||||||
|
#
|
||||||
|
# Extract DokuWiki set permisssions and rename according to input from user
|
||||||
|
#
|
||||||
|
mkdir -p /var/www/html
|
||||||
|
tar zxfp dokuwiki-stable.tgz -C /var/www/html
|
||||||
|
mv /var/www/html/dokuwiki* /var/www/html/$1
|
||||||
|
chown -R www-data: /var/www/html/$1
|
||||||
|
#
|
||||||
|
# DokuWiki postinstall notice
|
||||||
|
#
|
||||||
|
wikinotice="
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
IMPORTANT: Go to http://$1/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 go back to \"dokuwiki-install\" and run the following as root or using sudo.
|
||||||
|
|
||||||
|
./postinstall
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
"
|
||||||
|
#
|
||||||
|
# Display post install note
|
||||||
|
#
|
||||||
|
clear ; printf '%s\n' "${wikinotice[@]}"
|
||||||
|
#
|
||||||
|
# Cleaning up and saving hostname for use with postinstall
|
||||||
|
echo $1 > hostname
|
||||||
|
#
|
||||||
|
rm -Rf dokuwiki-stable.tgz nginx-install
|
||||||
|
#
|
||||||
|
# End of script
|
||||||
|
#
|
53
postinstall
Executable file
53
postinstall
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# First Created: 17082021 Author: Allan Desc: DokuWiki postinstall script #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# Are we root
|
||||||
|
#
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo ""; exit 1; fi
|
||||||
|
#
|
||||||
|
# Are we in the right directory
|
||||||
|
#
|
||||||
|
scriptdir="dokuwiki-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
||||||
|
if [ $whereami != $scriptdir ]; then printf "\nWrong directory! Script must be run from $scriptdir\n\n"; exit 1; fi
|
||||||
|
#
|
||||||
|
# Define variables and functions
|
||||||
|
#
|
||||||
|
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
||||||
|
hostname=$(cat hostname)
|
||||||
|
nginxconfig="/etc/nginx/conf.d"
|
||||||
|
#
|
||||||
|
# Function to check if a service is already running or not
|
||||||
|
#
|
||||||
|
serviceno () { printf "\n$service is not running cannot continue...\n\n"; }
|
||||||
|
servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "active" ]]; then serviceno ; exit; fi; }
|
||||||
|
#
|
||||||
|
# Function title
|
||||||
|
#
|
||||||
|
title () { printf "\nDokuwiki postinstall script V1.0${normal}\n\n"; }
|
||||||
|
#
|
||||||
|
# If Nginx is not running then die
|
||||||
|
#
|
||||||
|
service="nginx" ; servicedead
|
||||||
|
#
|
||||||
|
# Hardening DokuWiki
|
||||||
|
#
|
||||||
|
sed -i 's/# location /location /g' $nginxconfig/$hostname.conf
|
||||||
|
#
|
||||||
|
# Restart Nginx in order for changes to take effect
|
||||||
|
#
|
||||||
|
systemctl restart nginx
|
||||||
|
#
|
||||||
|
# Cleaning up
|
||||||
|
#
|
||||||
|
rm hostname
|
||||||
|
#
|
||||||
|
# All done
|
||||||
|
#
|
||||||
|
clear ; printf "\n" ; line '-' ; printf "All Done...\n" ; line '-' ; printf "\n"
|
||||||
|
#
|
||||||
|
# End of script
|
||||||
|
#
|
Loading…
Reference in New Issue
Block a user