mirror of
				https://github.com/krislamo/freecloud
				synced 2025-10-30 17:38:33 +00:00 
			
		
		
		
	Basic Nextcloud Installation on Debian 10
A basic installation of Nextcloud 16 Stable on Debian Stable.
This commit is contained in:
		
							
								
								
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| # Vagrant files | ||||
| .vagrant | ||||
|  | ||||
| # Unneeded ansible file | ||||
| *.retry | ||||
|  | ||||
| # Production files | ||||
| group_vars/production.yml | ||||
| group_vars/.gitignore | ||||
|  | ||||
							
								
								
									
										38
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| # Freedom Cloud. Management code for a self-hosted file server. | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
| # | ||||
| # vi: set ft=ruby : | ||||
|  | ||||
| Vagrant.configure("2") do |config| | ||||
|  | ||||
|   # Debian Stable | ||||
|   # Temporary box until debian/buster64 updates | ||||
|   # https://lists.debian.org/debian-cloud/2019/07/msg00023.html | ||||
|   config.vm.box = "krislamo/debian" | ||||
|  | ||||
|   # Disable default sync | ||||
|   config.vm.synced_folder '.', '/vagrant', disabled: true | ||||
|  | ||||
|   # Get local IP and display | ||||
|   config.vm.network :forwarded_port, guest: 80, host: 8080 | ||||
|  | ||||
|   # Run Ansible | ||||
|   config.vm.provision "ansible" do |ansible| | ||||
|     ansible.compatibility_mode = "2.0" | ||||
|     ansible.playbook = "testing.yml" | ||||
|   end | ||||
|  | ||||
| end | ||||
|  | ||||
							
								
								
									
										13
									
								
								group_vars/all.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								group_vars/all.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| ## Nextcloud Configuration ## | ||||
| nc_version: 16.0.3 | ||||
| nc_sha256sum: a13f68ce47a1362318629ba5b118a59fa98358bb18f4afc371ea15104f2881f3 | ||||
|  | ||||
| nc_domain: www.example.com | ||||
| nc_docroot: /var/www/nextcloud | ||||
|  | ||||
| nc_db: nextcloud | ||||
| nc_db_user: nextcloud | ||||
| nc_db_pass: nc+password | ||||
|  | ||||
| nc_admin: admin | ||||
| nc_admin_pass: ncadmin+password | ||||
							
								
								
									
										29
									
								
								production.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								production.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # Freedom Cloud. Management code for a self-hosted file server. | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
|  | ||||
| - name: Install Backup Server | ||||
|   hosts: production | ||||
|   become: true | ||||
|  | ||||
|   pre_tasks: | ||||
|     - name: Install Ansible requirements | ||||
|       shell: apt-get update && apt-get install -y python-apt aptitude | ||||
|       args: | ||||
|         creates: /usr/lib/python2.7/dist-packages/apt/__init__.py | ||||
|         warn: false | ||||
|  | ||||
|   roles: | ||||
|     - nextcloud | ||||
							
								
								
									
										19
									
								
								roles/nextcloud/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								roles/nextcloud/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| # Freedom Cloud. Management code for a self-hosted file server. | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
| - name: Reload Apache | ||||
|   service: | ||||
|     name: apache2 | ||||
|     state: reloaded | ||||
							
								
								
									
										119
									
								
								roles/nextcloud/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								roles/nextcloud/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,119 @@ | ||||
| # Freedom Cloud. Management code for a self-hosted file server. | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
|  | ||||
| - name: Install Apache | ||||
|   apt: | ||||
|     name: apache2 | ||||
|     state: present | ||||
|  | ||||
| - name: Create Public HTML Directory | ||||
|   file: | ||||
|     path: "{{ nc_docroot }}" | ||||
|     state: directory | ||||
|  | ||||
| - name: Install MySQL/MariaDB | ||||
|   apt: | ||||
|     name: mariadb-server | ||||
|     state: present | ||||
|  | ||||
| - name: Ansible MySQL/MariaDB Dependency | ||||
|   apt: | ||||
|     name: python-mysqldb | ||||
|     state: present | ||||
|  | ||||
| - name: Create Database | ||||
|   mysql_db: | ||||
|     name: "{{ nc_db }}" | ||||
|     state: present | ||||
|  | ||||
| - name: Create Database User | ||||
|   mysql_user: | ||||
|     name: "{{ nc_db_user }}" | ||||
|     password: "{{ nc_db_pass }}" | ||||
|     priv: 'nextcloud.*:ALL' | ||||
|     state: present | ||||
|  | ||||
| - name: Install PHP | ||||
|   apt: | ||||
|     name: php7.3 | ||||
|     state: present | ||||
|  | ||||
| - name: Install PHP modules | ||||
|   apt: | ||||
|     name: ['php7.3-mysql', 'php7.3-xml', 'php7.3-mbstring', | ||||
|            'php7.3-gd', 'php7.3-curl', 'php7.3-zip', | ||||
|            'php7.3-intl', 'php7.3-imagick'] | ||||
|     state: present | ||||
|   notify: | ||||
|     - Reload Apache | ||||
|  | ||||
| - name: Download Nextcloud | ||||
|   get_url: | ||||
|     url: "https://download.nextcloud.com/server/releases/\ | ||||
|           nextcloud-{{ nc_version }}.tar.bz2" | ||||
|     dest: /tmp/nextcloud-{{ nc_version }}.tar.bz2 | ||||
|     checksum: sha256:{{ nc_sha256sum }} | ||||
|     timeout: 600 | ||||
|  | ||||
| - name: Extract Nextcloud | ||||
|   unarchive: | ||||
|     src: /tmp/nextcloud-{{ nc_version }}.tar.bz2 | ||||
|     dest: /var/www | ||||
|     owner: www-data | ||||
|     group: www-data | ||||
|     remote_src: true | ||||
|  | ||||
| - name: Install Nextcloud | ||||
|   command: 'sudo -u www-data php occ maintenance:install | ||||
|             --database "mysql" | ||||
|             --database-name "{{ nc_db }}" | ||||
|             --database-user "{{ nc_db_user }}" | ||||
|             --database-pass "{{ nc_db_pass }}" | ||||
|             --admin-user "{{ nc_admin }}" | ||||
|             --admin-pass "{{ nc_admin_pass }}"' | ||||
|   register: nc_install | ||||
|   args: | ||||
|     warn: false | ||||
|     chdir: "{{ nc_docroot }}" | ||||
|     creates: "{{ nc_docroot }}/config/config.php" | ||||
|  | ||||
| - name: Set Nextcloud's Trusted Domain | ||||
|   command: 'sudo -u www-data php occ config:system:set trusted_domains 0 | ||||
|            --value="{{ nc_domain }}"' | ||||
|   when: nc_install.changed | ||||
|   args: | ||||
|     warn: false | ||||
|     chdir: "{{ nc_docroot }}" | ||||
|  | ||||
| - name: Create Apache Virtual Host | ||||
|   template: | ||||
|     src: apacheconf.conf | ||||
|     dest: /etc/apache2/sites-available/{{ nc_domain }}.conf | ||||
|     owner: root | ||||
|     group: root | ||||
|     mode: '0644' | ||||
|   notify: | ||||
|     - Reload Apache | ||||
|  | ||||
| - name: Enable Site | ||||
|   file: | ||||
|     src: /etc/apache2/sites-available/{{ nc_domain }}.conf | ||||
|     dest: /etc/apache2/sites-enabled/{{ nc_domain }}.conf | ||||
|     state: link | ||||
|     owner: root | ||||
|     group: root | ||||
|   notify: | ||||
|     - Reload Apache | ||||
							
								
								
									
										36
									
								
								roles/nextcloud/templates/apacheconf.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								roles/nextcloud/templates/apacheconf.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| # Freedom Cloud. Management code for a self-hosted file server. | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
|  | ||||
| <VirtualHost *:80> | ||||
|         ServerName {{ nc_domain }} | ||||
|  | ||||
|         ServerAdmin {{ nc_admin }} | ||||
|         DocumentRoot {{ nc_docroot }} | ||||
|  | ||||
|         ErrorLog ${APACHE_LOG_DIR}/error.log | ||||
|         CustomLog ${APACHE_LOG_DIR}/access.log combined | ||||
|  | ||||
| </VirtualHost> | ||||
|  | ||||
| <Directory {{ nc_docroot }}> | ||||
|     Options Indexes FollowSymLinks | ||||
|     AllowOverride All | ||||
|     Require all granted | ||||
|  | ||||
|     php_value memory_limit 512M | ||||
| </Directory> | ||||
|  | ||||
| # vim: syntax=apache | ||||
							
								
								
									
										29
									
								
								testing.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								testing.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| # Copyright (C) 2019  Kris Lamoureux | ||||
| # | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, version 3 of the License. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
|  | ||||
| - name: Install Backup Server | ||||
|   hosts: all | ||||
|   become: true | ||||
|  | ||||
|   pre_tasks: | ||||
|     - name: Install Ansible requirements | ||||
|       shell: apt-get update && apt-get install -y python-apt aptitude | ||||
|       args: | ||||
|         creates: /usr/lib/python2.7/dist-packages/apt/__init__.py | ||||
|         warn: false | ||||
|  | ||||
|   roles: | ||||
|     - nextcloud | ||||
|  | ||||
		Reference in New Issue
	
	Block a user