One place for hosting & domains

      How To Install and Configure ownCloud on Debian 9


      Introduction

      ownCloud is an open-source file sharing server and collaboration platform that can store your personal content, like documents and pictures, in a centralized location. This allows you to take control of your content and security by not relying on third-party content hosting services like Dropbox.

      In this tutorial, we will install and configure an ownCloud instance on a Debian 9 server.

      Prerequisites

      In order to complete the steps in this guide, you will need the following:

      • A sudo user and firewall on your server: You can create a user with sudo privileges and set up a basic firewall by following the Debian 9 initial server setup guide.
      • A LAMP stack: ownCloud requires a web server, a database, and PHP to function properly. Setting up a LAMP stack (Linux, Apache, MySQL, and PHP) server fulfills all of these requirements. Follow this guide to install and configure this software.
      • An SSL certificate: How you set this up depends on whether or not you have a domain name that resolves to your server.
        • If you have a domain name… the easiest way to secure your site is with Let’s Encrypt, which provides free, trusted certificates. Follow the Let’s Encrypt guide for Apache to set this up.
        • If you do not have a domain… and you are just using this configuration for testing or personal use, you can use a self-signed certificate instead. This provides the same type of encryption, but without the domain validation. Follow the self-signed SSL guide for Apache to get set up.

      Step 1 – Installing ownCloud

      The ownCloud server package does not exist within the default repositories for Debian. However, ownCloud maintains a dedicated repository for the distribution that we can add to our server.

      To begin, let’s install a few components to help us add the ownCloud repositories. The apt-transport-https package allows us to use the deb https:// in our apt sources list to indicate external repositories served over HTTPS:

      • sudo apt update
      • sudo apt install curl apt-transport-https

      Next, download the ownCloud release key using the curl command and import it with the apt-key utility with the add command:

      • curl https://download.owncloud.org/download/repositories/production/Debian_9.0/Release.key | sudo apt-key add -

      The ‘Release.key’ file contains a PGP (Pretty Good Privacy) public key which apt will use to verify that the ownCloud package is authentic.

      In addition to importing the key, create a file called owncloud.list in the sources.list.d directory for apt. The file will contain the address to the ownCloud repository.

      • echo 'deb http://download.owncloud.org/download/repositories/production/Debian_9.0/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list

      Now, we can use the package manager to find and install ownCloud. Along with the main package, we will also install a few additional PHP libraries that ownCloud uses to add extra functionality. Update your local package index and install everything by typing:

      • sudo apt update
      • sudo apt install php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip owncloud-files

      Everything we need is now installed on the server, so next we can finish the configuration and we can begin using the service.

      Step 2 — Adjusting the Document Root

      The ownCloud package we installed copies the web files to /var/www/owncloud on the server. Currently, the Apache virtual host configuration is set up to serve files out of a different directory. We need to change the DocumentRoot setting in our configuration to point to the new directory.

      You find which virtual host files reference your domain name or IP address using the apache2ctl utility with the DUMP_VHOSTS option. Filter the output by your server’s domain name or IP address to find which files you need to edit in the next few commands:

      • sudo apache2ctl -t -D DUMP_VHOSTS | grep server_domain_or_IP

      The output will probably look something like this:

      Output

      *:443 server_domain_or_IP (/etc/apache2/sites-enabled/server_domain_or_IP-le-ssl.conf:2) port 80 namevhost server_domain_or_IP (/etc/apache2/sites-enabled/server_domain_or_IP.conf:1)

      In the parentheses, you can see each of the files that reference the domain name or IP address we’ll use to access ownCloud. These are the files you’ll need to edit.

      For each match, open the file in a text editor with sudo privileges:

      • sudo nano /etc/apache2/sites-enabled/server_domain_or_IP.conf

      Inside, search for the DocumentRoot directive. Change the line so that it points to the /var/www/owncloud directory:

      Example DocumentRoot edit

      <VirtualHost *:80>
          . . .
          DocumentRoot /var/www/owncloud
          . . .
      </VirtualHost>
      

      Save and close the file when you are finished. Complete this process for each of the files that referenced your domain name (or IP address if you did not configure a domain for your server).

      When you are finished, check the syntax of your Apache files to make sure there were no detectable typos in your configuration:

      • sudo apache2ctl configtest

      Output

      Syntax OK

      Depending on your configuration, you may see a warning about setting ServerName globally. As long as the output ends with Syntax OK, you can ignore that warning. If you see additional errors, go back and check the files you just edited for mistakes.

      If your syntax check passed, reload the Apache service to activate the new changes:

      • sudo systemctl reload apache2

      Apache should now know how to server your ownCloud files.

      Step 3 – Configuring the MySQL Database

      Before we move on to the web configuration, we need to set up the database. During the web-based configuration process, we will need to provide an database name, a database username, and a database password so that ownCloud can connect and manage its information within MySQL.

      Begin by logging into your database with the MySQL administrative account:

      If you set up password authentication for a MySQL administrative account, you may have to use this syntax instead:

      Create a dedicated database for ownCloud to use. We will name the database owncloud for clarity:

      • CREATE DATABASE owncloud;

      Note: Every MySQL statement must end with a semi-colon (;). Be sure to check that this is present if you are experiencing an issue.

      Next, create a separate MySQL user account to manage the newly created database. Creating one-function databases and accounts is a good idea from a management and security standpoint. As with the naming of the database, choose a username that you prefer. We elected to go with the name owncloud in this guide.

      • GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'owncloud_database_password';

      Warning: Be sure to put an actual password where the command states: owncloud_database_password

      With the user assigned access to the database, perform the flush privileges operation to ensure that the running instance of MySQL knows about the recent privilege assignment:

      You can now exit the MySQL session by typing:

      With the ownCloud server installed and the database set up, we are ready to turn our attention to configuring the ownCloud application.

      Step 4 – Configuring ownCloud

      To access the ownCloud web interface, open a web browser and navigate to the following address:

      https://server_domain_or_IP
      

      Note: If you are using a self-signed SSL certificate, you will likely be presented with a warning because the certificate is not signed by one of your browser's trusted authorities. This is expected and normal. Click the appropriate button or link to proceed to the ownCloud admin page.

      You should see the ownCloud web configuration page in your browser.

      Create an admin account by choosing a username and a password. For security purposes it is not recommended to use something like "admin" for the username:

      ownCloud Admin Account

      Next, leave the Data folder setting as-is and scroll down to the database configuration section.

      Fill out the details of the database name, database username, and database password you created in the previous section. If you used the settings from this guide, both the database name and username will be owncloud. Leave the database host as localhost:

      ownCloud database configuration

      Click the Finish setup button to finish configuring ownCloud using the information you've provided. You will be taken to a login screen where you can sign in using your new account:

      ownCloud login screen

      On your first login, a screen will appear where you can download applications to sync your files on various devices. You can download and configure these now or do it at a later time. When you are finished, click the x in the top-right corner of the splash screen to access the main interface:

      ownCloud Main Interface

      Here, you can create or upload files to your personal cloud.

      Conclusion

      ownCloud can replicate the capabilities of popular third-party cloud storage services. Content can be shared between users or externally with public URLs. The advantage of ownCloud is that the information is stored in a place that you control and manage without a third party.

      Explore the interface and for additional functionality, install plugins using ownCloud's app store.



      Source link

      Subscribe to Linode Status Updates


      Updated by Linode Contributed by Linode

      Use promo code DOCS10 for $10 credit on a new account.

      The Linode Status Page provides real-time system status and maintenance updates via email, SMS, and Atom and RSS feed. All Linode customers are encouraged to subscribe to Linode Status notifications to stay up to date with any events that may impact your service.

      When you sign up for Linode status updates via email or SMS, you can fine-tune which service updates you receive. These different topic areas are referred to as components. If, for example, all your Linodes are restricted to the Newark Data Center, you may only wish to subscribe to the Newark component. You can also subscribe to individual incident notifications.

      Status Update Components

      • Linode Manager and API
      • Hosted DNS Service
      • London
      • Newark
      • Atlanta
      • Dallas
      • Fremont
      • Tokyo 1
      • Tokyo 2
      • Singapore
      • Frankfurt

      Subscribe to Updates

      To subscribe to Linode system status and maintenance updates:

      1. Navigate to the Linode Status Page.

      2. Click on the Subscribe to Updates button and select your preferred notification format. The available options are email, SMS, and RSS feed.

        Subscribe to Linode status updates.

        Email or SMS

      • If selecting email or SMS, provide your contact information and click on the Subscribe via Email or Subscribe via SMS button.

      • You will be brought to the Notifications Subscription page where you can select which components to be updated on.

      • Click on the Update Preferences button.

        • If you are signing up for email notifications, you will need to check your email and confirm the subscription before you will start to receive updates.

        • If you are signing up for SMS notifications, you will receive a text message with instructions on how to confirm your subscription.

        RSS

      • If selecting RSS, click on the Atom Feed or RSS Feed link. You will be brought to a page with the raw XML feed.

      • Copy the page’s URL. Navigate to your RSS aggregator and paste the URL when setting up the feed.

      Subscribe to an Incident

      To subscribe to updates for a specific incident:

      1. Navigate to the Linode Status Page.

      2. Find the incident you would like to follow and click on its heading. You will be brought to that incident’s page.

      3. Click on the Subscribe to Updates button and provide your Email and/or telephone number.

      Update Notification Preferences or Unsubscribe

      You can update your component preferences or cancel your subscription to Linode status and maintenance updates at any time. To update your preferences or to unsubscribe:

      1. Navigate to the Linode Status Page.

      2. Click on the Subscribe to Updates button and select the notification format you would like to update or unsubscribe from.

        Email or SMS

      • Enter in your contact information and click on the Subscribe to Updates button.

      • You will be brought to your Notification Subscription page. Update your preferences, as needed, and click on the Update Preferences button.

      • If you would like to unsubscribe, click on the Cancel Subscription link in the Subscriber section of the page and follow the prompt.

      Note

      You can unsubscribe from SMS notifications by replying to any text message notification with the word “STOP”.

      RSS

      • To unsubscribe from Linode status updates via RSS, use your RSS aggregator’s settings to remove the feed.

      Join our Community

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Debian 9


      Introduction

      The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications. This is an acronym that describes a Linux operating system, with an Nginx web server. The backend data is stored in the MySQL database and the dynamic processing is handled by PHP.

      In this guide, you’ll install a LEMP stack on a Debian server using the packages provided by the operating system.

      Prerequisites

      To complete this guide, you will need a Debian 9 server with a non-root user with sudo privileges. You can set up a user with these privileges in our Initial Server Setup with Debian 9 guide.

      Step 1 — Installing the Nginx Web Server

      In order to display web pages to our site visitors, we are going to employ Nginx, a modern, efficient web server.

      All of the software we will be using for this procedure will come directly from Debian’s default package repositories. This means we can use the apt package management suite to complete the installation.

      Since this is our first time using apt for this session, we should start off by updating our local package index. We can then install the server:

      • sudo apt update
      • sudo apt install nginx

      On Debian 9, Nginx is configured to start running upon installation.

      If you have the ufw firewall running, you will need to allow connections to Nginx. You should enable the most restrictive profile that will still allow the traffic you want. Since we haven’t configured SSL for our server yet, in this guide, we will only need to allow traffic on port 80.

      You can enable this by typing:

      • sudo ufw allow 'Nginx HTTP'

      You can verify the change by typing:

      You should see HTTP traffic allowed in the displayed output:

      Output

      Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx HTTP ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx HTTP (v6) ALLOW Anywhere (v6)

      Now, test if the server is up and running by accessing your server's domain name or public IP address in your web browser. If you do not have a domain name pointed at your server and you do not know your server's public IP address, you can find it by typing one of the following into your terminal:

      • ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's//.*$//'

      This will print out a few IP addresses. You can try each of them in turn in your web browser.

      Type one of the addresses that you receive in your web browser. It should take you to Nginx's default landing page:

      http://your_domain_or_IP
      

      Nginx default page

      If you see the above page, you have successfully installed Nginx.

      Step 2 — Installing MySQL to Manage Site Data

      Now that we have a web server, we need to install MySQL, a database management system, to store and manage the data for our site.

      You can install this easily by typing:

      • sudo apt install mysql-server

      Note: In Debian 9 a community fork of the MySQL project – MariaDB – is packaged as the default MySQL variant. While, MariaDB works well in most cases, if you need features found only in Oracle's MySQL, you can install and use packages from a repository maintained by the MySQL developers. To install the official MySQL server, use our tutorial How To Install the Latest MySQL on Debian 9.

      The MySQL database software is now installed, but its configuration is not complete.

      To secure the installation, we can run a security script that will ask whether we want to modify some insecure defaults. Begin the script by typing:

      • sudo mysql_secure_installation

      You will be asked to enter the password for the MySQL root account. We haven't set this yet, so just hit ENTER. Then you'll be asked you if you want to set that password. You should type y then set a root password.

      For the rest of the questions the script asks, you should press y, followed by the ENTER key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made.

      At this point, your database system is now set up and secured. Let's set up PHP.

      Step 3 — Installing PHP for Processing

      We now have Nginx installed to serve our pages and MySQL installed to store and manage our data. However, we still don't have anything that can generate dynamic content. That's where PHP comes in.

      Since Nginx does not contain native PHP processing like some other web servers, we will need to install fpm, which stands for "fastCGI process manager". We will tell Nginx to pass PHP requests to this software for processing. We'll also install an additional helper package that will allow PHP to communicate with our MySQL database backend. The installation will pull in the necessary PHP core files to make that work.

      Then install the php-fpm and php-mysql packages:

      • sudo apt install php-fpm php-mysql

      We now have our PHP components installed. Next we'll configure Nginx to use them.

      Step 4 — Configuring Nginx to Use the PHP Processor

      Now we have all of the required components installed. The only configuration change we still need is to tell Nginx to use our PHP processor for dynamic content.

      We do this on the server block level (server blocks are similar to Apache's virtual hosts). We're going to leave the default Nginx configuration alone and instead create a new configuration file and new web root directory to hold our PHP files. We'll name the configuration file and the directory after the domain name or hostname that the server should respond to.

      First, create a new directory in /var/www to hold the PHP site:

      • sudo mkdir /var/www/your_domain

      Then, open a new configuration file in Nginx's sites-available directory:

      • sudo nano /etc/nginx/sites-available/your_domain

      This will create a new blank file. Paste in the following bare-bones configuration:

      /etc/nginx/sites-available/your_domain

      server {
          listen 80;
          listen [::]:80;
      
          root /var/www/your_domain;
          index index.php index.html index.htm;
      
          server_name your_domain;
      
          location / {
              try_files $uri $uri/ =404;
          }
      
          location ~ .php$ {
              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
          }
      }
      

      This is a very basic configuration that listens on port 80 and serves files from the web root we just created. It will only respond to requests to the name provided after server_name, and any files ending in .php will be processed by the php-fpm process before Nginx sends the results to the user.

      Save and close the file when you're done customizing it.

      Activate your configuration by linking to the config file from Nginx's sites-enabled directory:

      • sudo ln -s /etc/nginx/sites-available/your_domain.conf /etc/nginx/sites-enabled/

      This will tell Nginx to use the configuration next time it is reloaded. First, test your configuration for syntax errors by typing:

      If any errors are reported, go back and recheck your file before continuing.

      When you are ready, reload Nginx to make the changes:

      • sudo systemctl reload nginx

      Next we'll create a file in our new web root directory to test out PHP processing.

      Step 5 — Create a PHP File to Test Configuration

      Your LEMP stack should now be completely set up. We can test it to validate that Nginx can correctly hand .php files off to our PHP processor.

      We can do this by creating a test PHP file in our document root. Open a new file called info.php within your document root in your text editor:

      • sudo nano /var/www/your_domain/info.php

      Type or paste the following lines into the new file. This is valid PHP code that will return information about our server:

      /var/www/your_domain/info.php

      <?php
        phpinfo();
      ?>
      

      When you are finished, save and close the file.

      Now, you can visit this page in your web browser by visiting your server's domain name or public IP address followed by /info.php:

      http://your_domain/info.php
      

      You should see a web page that has been generated by PHP with information about your server:

      PHP page info

      If you see a page that looks like this, you've set up PHP processing with Nginx successfully.

      After verifying that Nginx renders the page correctly, it's best to remove the file you created as it can actually give unauthorized users some hints about your configuration that may help them try to break in.

      For now, remove the file by typing:

      • sudo rm /var/www/html/info.php

      You can always regenerate this file if you need it later.

      Conclusion

      You should now have a LEMP stack configured on your Debian server. This gives you a very flexible foundation for serving web content to your visitors.



      Source link