apfelcast

NC Ubuntu20.04

May 15th, 2020
19,007
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #### nextcloud Easy Install ####
  2.  
  3. # updating
  4. apt-get update
  5. apt-get upgrade
  6.  
  7. # Installing LAMP-Stack
  8. apt install lamp-server^
  9.  
  10. # Install PHP Moduls
  11. apt install php-zip php-dompdf php-xml php-mbstring php-gd php-curl php-imagick php-intl unzip
  12.  
  13. # adjust PHP.ini file
  14. nano /etc/php/7.4/apache2/php.ini
  15.  
  16.  
  17. memory_limit = 1024M
  18. upload_max_filesize = 16G
  19. post_max_size = 16G
  20. date.timezone = Europe/Berlin
  21.  
  22.  
  23. # Maria DB Server Konfiguration
  24. mysql_secure_installation
  25.  
  26. # open SQL dialoge
  27. mysql
  28.  
  29. # create database calles nextcloud
  30. CREATE DATABASE nextcloud;
  31.  
  32. # create database user with password
  33. CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';
  34.  
  35. #grant accesss to databse
  36. GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
  37.  
  38. #save changes and exit
  39. FLUSH PRIVILEGES;
  40. EXIT;
  41.  
  42. # Download lastest nextcloud version
  43. cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
  44. unzip latest.zip
  45. mv nextcloud /var/www/
  46.  
  47. #create new conf
  48. nano /etc/apache2/sites-available/nextcloud.conf
  49.  
  50. <VirtualHost *:80>
  51. ServerAdmin master@domain.com
  52. DocumentRoot /var/www/nextcloud/
  53. ServerName cloud.domain.com
  54. ServerAlias www.cloud.domain.com
  55.  
  56. Alias /nextcloud "/var/www/nextcloud/"
  57.  
  58. <Directory /var/www/nextcloud/>
  59. Options +FollowSymlinks
  60. AllowOverride All
  61. Require all granted
  62. <IfModule mod_dav.c>
  63. Dav off
  64. </IfModule>
  65. SetEnv HOME /var/www/nextcloud
  66. SetEnv HTTP_HOME /var/www/nextcloud
  67. </Directory>
  68.  
  69. ErrorLog ${APACHE_LOG_DIR}/error.log
  70. CustomLog ${APACHE_LOG_DIR}/access.log combined
  71.  
  72. </VirtualHost>
  73.  
  74. # Enable the NextCloud and Rewrite Module
  75.  
  76. a2ensite nextcloud.conf
  77. a2enmod rewrite
  78. a2enmod headers
  79. a2enmod env
  80. a2enmod dir
  81. a2enmod mime
  82.  
  83. # restart apache
  84. systemctl restart apache2.service
  85.  
  86. # prepare data folder
  87. mkdir /home/data/
  88. chown -R www-data:www-data /home/data/
  89.  
  90. chown -R www-data:www-data /var/www/nextcloud/
  91. chmod -R 755 /var/www/nextcloud/
  92.  
  93. --> Domain ansurfen und Einrichtung abschlie├čen
  94.  
  95.  
  96. ## Let's Encrypt SSL Zertifikat ##
  97.  
  98. apt install certbot python3-certbot-apache
  99.  
  100. certbot --apache -m master@domain.com -d cloud.domain.com
  101.  
  102. #--> only lasts 90 days
  103.  
  104. #install crontab
  105. crontab -e
  106.  
  107. 0 1 * * * /usr/bin/certbot renew & > /dev/nul
RAW Paste Data