User Tools

Site Tools


sysadmin:dokuwiki:dokuwiki_install_aws_ec2

This is an old revision of the document!


Install DokuWiKi on AWS EC2 Amazon Linux 2 AMI

  1. Launch a new t2.micro EC2 instance from Amazon Linux 2 AMI
  2. Allocation new Elastic IP
  3. Allocate the Elastic IP to newly create EC2 instance
  4. Using PuTTY SSH Client and PEM key login, SSH into in the new instance
  5. Run the following Linux shell command to update Amazon Linux 2:
    sudo yum -y update
  6. Run the following Linux shell command to install PHP 7.2:
    sudo amazon-linux-extras install -y php7.2
  7. Run the following Linux shell command to install Apache httpd, PHP XML Parser (required by DokuWiki) and Apache SSL Module:
    sudo yum -y install httpd php-xml mod_ssl
  8. Edit httpd.conf file by running sudo vi /etc/httpd/conf/httpd.conf Linux shell command with following contents:

    Replace «Private IP Address of EC2 Instance»
    Replace «Server Administrator Email address»
    Replace «Website DNS»

    httpd.conf
    Listen <<Private IP Address of EC2 Instance>>:80
    ServerAdmin <<Server Administrator Email address>>
    ServerName <<Website DNS>>:80
    <LocationMatch "/(data|conf|bin|inc|vendor)/">
         order allow,deny
         deny from all
         satisfy all
    </LocationMatch>
  9. Run the following Linux shell command to enable Apache httpd server to start at boot as well as immediately:
    sudo systemctl enable httpd
    sudo systemctl start httpd
  10. Run the following Linux shell commands to download and install DocuWiKi:

    For detailed installation procedure, refer to install:amazone_ec2

    To generate «dokuwiki download file», Goto https://download.dokuwiki.org/ URL from any web browser, select necessary options and click Start Download button

    cd /var/www/html
    sudo wget https://download.dokuwiki.org/out/dokuwiki-<<.tgz
    sudo tar -zxvf dokuwiki-<<dokuwiki download file>>.tgz
    sudo rm -r dokuwiki-<<dokuwiki download file>>.tgz
    sudo chown -R apache dokuwiki
    sudo chgrp -R apache dokuwiki
    cd dokuwiki
    sudo mv * ../
    cd ..
    sudo rm -Rf docuwiki
    sudo chmod -R 0700 data
    sudo chmod -R 0700 conf
    sudo chmod -R 0700 inc
    sudo chmod -R 0700 vendor
  11. From web browser on your PC, go to http://«Elastic IP»/install.php
  12. Fill all the required details
  13. Generate CloudFlare Origin Certificate
  14. Run following commands to create certificates:

    Replace «domain name» with your website's domain name
    Replace «Paste Origin Certificate» with Origin Certificate generated in your CloudFlare account
    Replace «Paste Private Key» with Private Key for Origin Certificate generated in your CloudFlare account

    mkdir /usr/local/ssl
    vi /usr/local/ssl/<<domain name>>.crt
    <<Paste Origin Certificate>>
    vi /usr/local/ssl/<<domain name>>.crt
    <<Paste Private Key>>
    vi /usr/local/ssl/cloudflare.crt
    cloudflare.crt
    -----BEGIN CERTIFICATE-----
    MIIEADCCAuigAwIBAgIID+rOSdTGfGcwDQYJKoZIhvcNAQELBQAwgYsxCzAJBgNV
    BAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQwMgYDVQQLEytDbG91
    ZEZsYXJlIE9yaWdpbiBTU0wgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MRYwFAYDVQQH
    Ew1TYW4gRnJhbmNpc2NvMRMwEQYDVQQIEwpDYWxpZm9ybmlhMB4XDTE5MDgyMzIx
    MDgwMFoXDTI5MDgxNTE3MDAwMFowgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBD
    bG91ZEZsYXJlLCBJbmMuMTQwMgYDVQQLEytDbG91ZEZsYXJlIE9yaWdpbiBTU0wg
    Q2VydGlmaWNhdGUgQXV0aG9yaXR5MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRMw
    EQYDVQQIEwpDYWxpZm9ybmlhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
    AQEAwEiVZ/UoQpHmFsHvk5isBxRehukP8DG9JhFev3WZtG76WoTthvLJFRKFCHXm
    V6Z5/66Z4S09mgsUuFwvJzMnE6Ej6yIsYNCb9r9QORa8BdhrkNn6kdTly3mdnykb
    OomnwbUfLlExVgNdlP0XoRoeMwbQ4598foiHblO2B/LKuNfJzAMfS7oZe34b+vLB
    yrP/1bgCSLdc1AxQc1AC0EsQQhgcyTJNgnG4va1c7ogPlwKyhbDyZ4e59N5lbYPJ
    SmXI/cAe3jXj1FBLJZkwnoDKe0v13xeF+nF32smSH0qB7aJX2tBMW4TWtFPmzs5I
    lwrFSySWAdwYdgxw180yKU0dvwIDAQABo2YwZDAOBgNVHQ8BAf8EBAMCAQYwEgYD
    VR0TAQH/BAgwBgEB/wIBAjAdBgNVHQ4EFgQUJOhTV118NECHqeuU27rhFnj8KaQw
    HwYDVR0jBBgwFoAUJOhTV118NECHqeuU27rhFnj8KaQwDQYJKoZIhvcNAQELBQAD
    ggEBAHwOf9Ur1l0Ar5vFE6PNrZWrDfQIMyEfdgSKofCdTckbqXNTiXdgbHs+TWoQ
    wAB0pfJDAHJDXOTCWRyTeXOseeOi5Btj5CnEuw3P0oXqdqevM1/+uWp0CM35zgZ8
    VD4aITxity0djzE6Qnx3Syzz+ZkoBgTnNum7d9A66/V636x4vTeqbZFBr9erJzgz
    hhurjcoacvRNhnjtDRM0dPeiCJ50CP3wEYuvUzDHUaowOsnLCjQIkWbR7Ni6KEIk
    MOz2U0OBSif3FTkhCgZWQKOOLo1P42jHC3ssUZAtVNXrCk3fw9/E15k8NPkBazZ6
    0iykLhH1trywrKRMVw67F44IE8Y=
    -----END CERTIFICATE-----
  15. Edit ssl.conf file by running sudo vi /etc/httpd/conf.d/ssl.conf Linux shell command with following contents:

    Replace «domain name» with your website's domain name

    ssl.conf
    SSLCertificateFile /usr/local/ssl/<<domain name>>.crt
    SSLCertificateKeyFile /usr/local/ssl/<<domain name>>.key
    SSLCertificateChainFile /usr/local/ssl/cloudflare.crt
  16. Run following Linux shell command to restart Apache httpd service:
    sudo service httpd restart
  17. Update DNS host record with your Domain Registrar or Domain Management Service
  18. Test security of your website by accessing https://«domain name»/data/pages/wiki/dokuwiki.txt. Refer to security#web_access_security for detailed instructions on how to properly secure important directories in your DokuWiki installation.
sysadmin/dokuwiki/dokuwiki_install_aws_ec2.1602093831.txt.gz · Last modified: 2020/10/07 18:03 by vidyasb