This script automates the installation and configuration of Nextcloud on an Ubuntu 22.04 server. It includes the setup of Apache, MariaDB, PHP 8.1, Redis, and Opcache. Additionally, it offers the option to install SSL certificates using Certbot.
- Automatic installation of Nextcloud and all required dependencies.
- Configuration of MariaDB, PHP 8.1, Redis, and Opcache.
- SSL certificate option: Install during setup or at a later stage.
- Detection of existing installations: Option to add SSL later.
- Fresh installation of Ubuntu 22.04.
- Root or sudo access to the server.
-
Clone the repository:
git clone https://github.com/kristiangasic/nextcloud.git
-
Navigate to the script directory:
cd nextcloud -
Make the script executable:
chmod +x install_nextcloud.sh
-
Run the script:
sudo ./install_nextcloud.sh
-
Follow the instructions:
- Enter the MariaDB username and password.
- Provide the subdomain for your Nextcloud instance.
If you don't install SSL during the initial setup, you can rerun the script later to add SSL.
-
Create the necessary files:
Dockerfile: Container image for Nextcloud.docker-compose.yml: Docker Compose configuration for Nextcloud, MariaDB, Redis, and optionally a reverse proxy.php.ini: Configuration for PHP (e.g., upload limits and Opcache).
-
File contents:
- Copy the file contents from the relevant sections below.
-
Create the project structure:
mkdir nextcloud-docker && cd nextcloud-docker touch Dockerfile docker-compose.yml php.ini
-
Add file content: Insert the provided content into the respective files.
-
Start Docker containers:
docker-compose up -d
-
Set up Nextcloud: Open
http://<server-ip>in your browser and follow the Nextcloud installation wizard. -
Add SSL certificates (optional): If using a reverse proxy like Traefik, SSL certificates will be configured automatically through Let's Encrypt.
- User input collection: MariaDB credentials and subdomain.
- Installation log creation: Saves installation details, including the MariaDB password in plain text, for later reference.
- Install Nextcloud: Configures Apache, MariaDB, PHP 8.1, Redis, and Opcache. Downloads and sets up Nextcloud.
- Install SSL: Optional installation of SSL certificates using Certbot.
- Ensure your DNS settings point the subdomain to your server's IP address.
- The script checks for existing Nextcloud installations and offers SSL options only if Nextcloud is already set up.
- Apache issues: Check logs in
/var/log/apache2/. - MariaDB issues: Ensure the database and user are correctly created.
- Network issues: Check firewall rules if connectivity issues arise.
- Kristian Gasic
- Provided by https://gasic.bio
- License: Free for use
For questions or assistance: kristian@gasic.bio & Discord : Pain0xF
🎥 Video Tutorial: Watch on YouTube
