With the increasing demand for secure and accessible cloud storage solutions, self-hosted options like ownCloud have gained popularity among individuals and organizations. ownCloud allows users to create a private cloud environment, enabling them to store, share, and sync files securely. In this guide, we will walk you through the process of installing ownCloud on Ubuntu 18.04, providing you with a comprehensive step-by-step tutorial.
Prerequisites:
- A server running Ubuntu 18.04.
- Access to a terminal with sudo privileges.
- A domain name pointed to your server (optional but recommended for accessing ownCloud remotely).
Step 1: Update System Packages
Before installing any new software, it’s crucial to ensure that your system’s package repository is up to date. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install LAMP Stack
ownCloud relies on a LAMP (Linux, Apache, MySQL, PHP) stack to function. Install Apache, MySQL, PHP, and other necessary PHP modules using the following command:
sudo apt install apache2 mysql-server php php-mysql php-xml php-zip php-gd php-curl php-mbstring
During the MySQL installation process, you will be prompted to set a root password. Make sure to choose a strong password and remember it for future reference.
Step 3: Configure MySQL
Secure your MySQL installation by running the following command and following the prompts:
sudo mysql_secure_installation
Step 4: Create ownCloud Database and User
Login to MySQL as the root user:
sudo mysql -u root -p
Once logged in, create a new database for ownCloud and a dedicated user with appropriate privileges:
CREATE DATABASE owncloud;
CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Replace 'your_password'
with a strong password of your choice.
Step 5: Download ownCloud
Navigate to the Apache web root directory and download the latest version of ownCloud using the following commands:
cd /var/www/html
sudo wget https://download.owncloud.org/community/owncloud-x.y.z.zip
Replace x.y.z
with the version number you want to install.
Step 6: Extract and Set Permissions
Extract the downloaded ownCloud archive and set appropriate permissions:
sudo unzip owncloud-x.y.z.zip
sudo chown -R www-data:www-data owncloud
Step 7: Configure Apache
Create a new Apache configuration file for ownCloud:
sudo nano /etc/apache2/sites-available/owncloud.conf
Add the following configuration to the file:
Alias /owncloud "/var/www/html/owncloud/"
<Directory /var/www/html/owncloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/owncloud
SetEnv HTTP_HOME /var/www/html/owncloud
</Directory>
Save and close the file, then enable the newly created configuration and restart Apache:
sudo a2ensite owncloud.conf
sudo systemctl restart apache2
Step 8: Complete Installation via Web Interface
Open a web browser and navigate to http://your_domain/owncloud
or http://server_ip/owncloud
if you don’t have a domain. Follow the on-screen instructions to complete the installation process, providing the database information when prompted.
Step 9: Finalize Configuration
Once the installation is complete, you’ll be prompted to create an admin account and configure additional settings. Follow the setup wizard to finalize the configuration according to your preferences.
Congratulations! You have successfully installed ownCloud on your Ubuntu 18.04 server. You can now start using ownCloud to store, share, and sync your files securely.
This guide has provided you with a detailed walkthrough of the installation process, but remember to regularly update ownCloud and your server to ensure optimal performance and security. Enjoy the benefits of having your own cloud storage solution!