Prerequisites
Before we begin, ensure that your Raspberry Pi Model B+ is running Raspbian Lite OS with a 32-bit architecture. This guide assumes that you have already installed Raspbian Lite OS and have basic familiarity with the command line.
Installing Nextcloud
To install Nextcloud, run the following commands:
sudo apt update
sudo apt install -y apache2 php libapache2-mod-php php-{mysql,xml,gd,zip,curl,mbstring,zip,intl,ldap,openssl,soap,json}
wget -qO- https://get.nextcloud.org/install.sh | sh
This command installs Apache, PHP, and Nextcloud. Once the installation is complete, access Nextcloud by visiting http:// in a web browser.
Setting Up Nextcloud
After installation, configure Nextcloud by accessing the /var/www/html/nextcloud/config/config.php file:
sudo nano /var/www/html/nextcloud/config/config.phpUpdate the following lines:
'dbhost' => 'localhost', 'dbname' => '', 'dbuser' => ' ', 'dbpass' => ' ', 'secret' => ' ', 'trusted_domains' => [0 => 'your-domain.com'], 'overwrite.cli.url' => 'http://your-domain.com', 'overwrite.url' => 'https://your-domain.com', Save and exit the file.
Installing Certbot
Certbot is a tool for obtaining free SSL certificates from Let's Encrypt. To install Certbot, run the following commands:
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install certbot python3-certbot-apache
Obtaining SSL Certificate with Certbot
To obtain an SSL certificate, run:
sudo certbot --apache
Follow the prompts to enter your email address, agree to the terms of service, and select your domain name. Once the certificate is issued, Certbot will automatically configure Apache to use it.
Testing the Installation
To ensure that everything is working correctly, visit https://your-domain.com in a web browser. You should see a secure connection with a padlock icon in the address bar.