?i»?

Your IP : 18.191.92.107


Current Path : /home/scgforma/www/cloud/core/doc/admin/maintenance/
Upload File :
Current File : /home/scgforma/www/cloud/core/doc/admin/maintenance/backup.html

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Backup &mdash; Nextcloud 13 Administration Manual 13 documentation</title>
    
    <link rel="stylesheet" href="../_static/" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/main.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/styles.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '13',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
    <script type="text/javascript" src="../_static/bootstrap-3.1.0/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
    <link rel="top" title="Nextcloud 13 Administration Manual 13 documentation" href="../contents.html" />
    <link rel="up" title="Maintenance" href="index.html" />
    <link rel="next" title="Restoring backup" href="restore.html" />
    <link rel="prev" title="Maintenance" href="index.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#1d2d44">

  </head>
  <body role="document">


<div class="wrap container not-front">
  <div class="content row">
  <main class="main">
    
			<div class="row">
				<div class="col-md-3">
					<div class="sidebar">
            <h1>Nextcloud 13 Administration Manual</h1>
            
            <div class="sidebar-search">
              <form class="headersearch" action="../search.html" method="get">
                <input type="text" value="" name="q" id="q" class="form-control" /> 
                <button  class="btn btn-default" type="submit" id="searchsubmit">Search</button>
              </form>
            </div>
            
							<div class="menu-support-container">
								<ul id="menu-support" class="menu">
									<ul>
                    <li><a href="../contents.html">Table of Contents</a></li>
									</ul>
                  <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release_notes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_server/index.html">Server configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_user/index.html">User management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_files/index.html">File sharing and management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../file_workflows/index.html">File workflows</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_database/index.html">Database configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_mimetypes/index.html">Mimetypes management</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Maintenance</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="">Backup</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#maintenance-mode">Maintenance mode</a></li>
<li class="toctree-l3"><a class="reference internal" href="#backup-folders">Backup folders</a></li>
<li class="toctree-l3"><a class="reference internal" href="#backup-database">Backup database</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="restore.html">Restoring backup</a></li>
<li class="toctree-l2"><a class="reference internal" href="upgrade.html">How to upgrade</a></li>
<li class="toctree-l2"><a class="reference internal" href="update.html">Upgrade via built-in updater</a></li>
<li class="toctree-l2"><a class="reference internal" href="manual_upgrade.html">Upgrade manually</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_upgrade.html">Upgrade via packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="migrating.html">Migrating to a different server</a></li>
<li class="toctree-l2"><a class="reference internal" href="migrating_owncloud.html">Migrating from ownCloud</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../issues/index.html">Issues and troubleshooting</a></li>
</ul>

								</ul>
							</div>
					</div>
				</div>
        

				<div class="col-md-9">
					<div class="page-content">
            
<ul class="prevnext-title list-unstyled list-inline">
  <li class="prev">
    <a href="index.html" title="Previous Chapter: Maintenance"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm">&laquo; Maintenance</span>
    </a>
  </li>
  <li class="next">
    <a href="restore.html" title="Next Chapter: Restoring backup"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm">Restoring backup &raquo;</span>
    </a>
  </li>
</ul>
						
  <div class="section" id="backup">
<h1>Backup<a class="headerlink" href="#backup" title="Permalink to this headline">¶</a></h1>
<p>To backup an Nextcloud installation there are four main things you need to retain:</p>
<ol class="arabic simple">
<li>The config folder</li>
<li>The data folder</li>
<li>The theme folder</li>
<li>The database</li>
</ol>
<div class="section" id="maintenance-mode">
<h2>Maintenance mode<a class="headerlink" href="#maintenance-mode" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal"><span class="pre">maintenance:mode</span></code> locks the sessions of logged-in users and prevents new logins in order to prevent inconsistencies of your data. You must run <code class="docutils literal"><span class="pre">occ</span></code> as the HTTP user, like this example on Ubuntu Linux:</p>
<div class="highlight-python"><div class="highlight"><pre>$ sudo -u www-data php occ maintenance:mode --on
</pre></div>
</div>
<p>You may also put your server into this mode by editing <code class="file docutils literal"><span class="pre">config/config.php</span></code>.
Change <code class="docutils literal"><span class="pre">&quot;maintenance&quot;</span> <span class="pre">=&gt;</span> <span class="pre">false</span></code> to <code class="docutils literal"><span class="pre">&quot;maintenance&quot;</span> <span class="pre">=&gt;</span> <span class="pre">true</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre>&lt;?php

 &quot;maintenance&quot; =&gt; true,
</pre></div>
</div>
<p>Don&#8217;t forget to change it back to <code class="docutils literal"><span class="pre">false</span></code> when you are finished.</p>
</div>
<div class="section" id="backup-folders">
<h2>Backup folders<a class="headerlink" href="#backup-folders" title="Permalink to this headline">¶</a></h2>
<p>Simply copy your config, data and theme folders (or even your whole Nextcloud install and data folder) to a place outside of
your Nextcloud environment. You could use this command:</p>
<div class="highlight-python"><div class="highlight"><pre>rsync -avx nextcloud/ nextcloud-dirbkp_`date +&quot;%Y%m%d&quot;`/
</pre></div>
</div>
</div>
<div class="section" id="backup-database">
<h2>Backup database<a class="headerlink" href="#backup-database" title="Permalink to this headline">¶</a></h2>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Before restoring a backup see <a class="reference internal" href="restore.html"><em>Restoring backup</em></a></p>
</div>
<div class="section" id="mysql-mariadb">
<h3>MySQL/MariaDB<a class="headerlink" href="#mysql-mariadb" title="Permalink to this headline">¶</a></h3>
<p>MySQL or MariaDB, which is a drop-in MySQL replacement, is the recommended
database engine. To backup MySQL/MariaDB:</p>
<div class="highlight-python"><div class="highlight"><pre>mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] &gt; nextcloud-sqlbkp_`date +&quot;%Y%m%d&quot;`.bak
</pre></div>
</div>
</div>
<div class="section" id="sqlite">
<h3>SQLite<a class="headerlink" href="#sqlite" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>sqlite3 data/owncloud.db .dump &gt; nextcloud-sqlbkp_`date +&quot;%Y%m%d&quot;`.bak
</pre></div>
</div>
</div>
<div class="section" id="postgresql">
<h3>PostgreSQL<a class="headerlink" href="#postgresql" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>PGPASSWORD=&quot;password&quot; pg_dump [db_name] -h [server] -U [username] -f nextcloud-sqlbkp_`date +&quot;%Y%m%d&quot;`.bak
</pre></div>
</div>
</div>
</div>
</div>


            
<ul class="prevnext-title list-unstyled list-inline">
  <li class="prev">
    <a href="index.html" title="Previous Chapter: Maintenance"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm">&laquo; Maintenance</span>
    </a>
  </li>
  <li class="next">
    <a href="restore.html" title="Next Chapter: Restoring backup"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm">Restoring backup &raquo;</span>
    </a>
  </li>
</ul>
					</div>
				</div>
			</div>
  </main>  
  </div>
</div>
  </body>
</html>