Introduction
Ever thought of self-hosting your own private cloud server?? Nextcloud is a popular open-source file hosting and sharing platform that allows you to store, sync, and share your files, contacts, calendars, and more. Feel free to checkout the below video I made for this tutorial as well.
In this tutorial, we will walk you through the process of self-hosting Nextcloud on AWS using EC2 and the snap package of Nextcloud.
Prerequisites:
Before getting started, you will need the following:
- An AWS account: Sign up for an AWS account if you don't have one already.
- Basic knowledge of AWS services, particularly EC2.
- Familiarity with Linux command line and server administration.
- A domain name (optional): You can use a domain name to access your Nextcloud instance.
Step 1: Launch an EC2 Instance:
Log in to your AWS Management Console. Navigate to the EC2 service. Select the region closest to you.
Launch a new EC2 instance, choosing an appropriate Amazon Machine Image (AMI) based on your preferred Linux distribution (e.g., Ubuntu, CentOS). Select the desired instance type, storage options, and security group settings.
Make sure to enable HTTP and HTTPS along with SSH
Create or select an existing key pair to access your EC2 instance securely.
Launch the instance and wait for it to be ready.
Step 2: Connect to your EC2 Instance:
Obtain the public IP address or public DNS of your EC2 instance from the EC2 management console or use the web console by AWS.
Open a terminal or SSH client and connect to your EC2 instance using the following command:
ssh -i <path_to_key_pair_file> <username>@<public_ip_or_dns>
Step 3: Install Nextcloud via Snap Package:
Update and Upgrade the package lists on your EC2 instance:
sudo apt update && sudo apt upgrade -y
Install the snap package management system:
sudo apt install snapd
Install Nextcloud snap package:
sudo snap install nextcloud
Replace <username>
with the username you want to set and replace <password>
with the password you want to set. Make sure to remove <>
while typing.
sudo nextcloud.manual-install <username> <password>
Wait for the installation to complete. Nextcloud and its dependencies will be automatically installed.
Step 4: Configure Nextcloud:
Now set the IP address/domain name you want to use to access your NextCloud server. You will need to add trusted domains through which it can be accessed.
Replace <domain name>
with the domain name/IP address you want to set. Make sure to remove <>
while typing.
Set Trusted Domains
sudo nextcloud.occ config:system:set trusted domains 1 --value=<domain name>
Get Trusted Domains
sudo nextcloud.occ config:system:get trusted domains
Step 5: Finalize NextCloud
Open your web browser and enter the public IP address or DNS of your EC2 instance.
Complete the initial setup wizard, providing the required information such as admin username, password, and database configuration.
Customize Nextcloud settings according to your preferences, including storage location, external storage options, and encryption settings.
Conclusion
Congratulations! 🎉 You have successfully self-hosted Nextcloud on AWS EC2 using the snap package. With Nextcloud, you have full control over your data and can enjoy secure file hosting, sharing, and collaboration features. Enjoy the benefits of self-hosted cloud storage with Nextcloud on AWS!
Thank you for reading! If you found this blog post helpful, please consider sharing it with others who might benefit. Feel free to check out my other blog posts and visit my socials!