Fedora - Make free encrypted backups to the cloud on Fedora - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - Make free encrypted backups to the cloud on Fedora (/thread-93752.html) |
Fedora - Make free encrypted backups to the cloud on Fedora - xSicKxBot - 02-25-2020 Make free encrypted backups to the cloud on Fedora <div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora.png" width="394" height="155" title="" alt="" /></div><div><p>Most free cloud storage is limited to 5GB or less. Even Google Drive is limited to 15GB. While not heavily advertised, IBM offers free accounts with a whopping <strong>25GB</strong> of cloud storage for free. This is not a limited time offer, and you don’t have to provide a credit card. It’s absolutely free! Better yet, since it’s S3 compatible, most of the S3 tools available for backups should work fine.</p> <p>This article will show you how to use restic for encrypted backups onto this free storage. Please also refer to <a href="https://fedoramagazine.org/use-restic-encrypted-backups/">this previous Magazine article about installing and configuring restic.</a> Let’s get started!</p> <p> <span id="more-30087"></span> </p> <h2>Creating your free IBM account and storage</h2> <p>Head over to the IBM cloud services site and follow the steps to sign up for a free account here: <a href="https://cloud.ibm.com/registration">https://cloud.ibm.com/registration</a>. You’ll need to verify your account from the email confirmation that IBM sends to you.</p> <p>Then log in to your account to bring up your dashboard, at <a href="https://cloud.ibm.com/">https://cloud.ibm.com/</a>. </p> <p>Click on the <strong>Create resource</strong> button.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora.png" alt="" class="wp-image-30130" /></figure> <p>Click on <strong>Storage</strong> and then <strong>Object Storage</strong>.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-1.png" alt="" class="wp-image-30139" /></figure> <p>Next click on the <strong>Create Bucket</strong> button.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-2.png" alt="" class="wp-image-30142" /></figure> <p>This brings up the <strong>Configure your resource</strong> section.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-3.png" alt="" class="wp-image-30145" /></figure> <p>Next, click on the<strong><em> </em>Create</strong> button to use the default settings.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-4.png" alt="" class="wp-image-30148" /></figure> <p>Under<strong> Predefined buckets</strong> click on the <strong>Standard</strong> box:</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-5.png" alt="" class="wp-image-30149" /></figure> <p>A unique bucket name is automatically created, but it’s suggested that you change this.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-6.png" alt="" class="wp-image-30182" /></figure> <p>In this example, the bucket name is changed to <strong>freecloudstorage<em>.</em></strong></p> <p>Click on the <strong>Next</strong> button after choosing a bucket name:</p> <figure class="wp-block-image size-large is-resized"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-7.png" alt="" class="wp-image-30184" width="169" height="39" /></figure> <p>Continue to click on the <strong>Next</strong> button until you get the the <strong>Summary</strong> page:</p> <figure class="wp-block-image size-large is-resized"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-8.png" alt="" class="wp-image-30190" width="1327" height="476" /></figure> <p>Scroll down to the <strong>Endpoints</strong> section.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-9.png" alt="" class="wp-image-30199" /></figure> <p>The information in the <strong>Public</strong> section is the location of your bucket. This is what you need to specify in restic when you create your backups. In this example, the location is <strong>s3.us-south.cloud-object-storage.appdomain.cloud</strong>.</p> <h2>Making your credentials</h2> <p>The last thing that you need to do is create an access ID and secret key. To start, click on <strong>Service credentials</strong>.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-10.png" alt="" class="wp-image-30201" /></figure> <p>Click on the <strong>New credential</strong> button.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-11.png" alt="" class="wp-image-30202" /></figure> <p>Choose a name for your credential, make sure you check the <strong>Include HMAC Credential</strong> box and then click on the <strong>Add</strong> button. In this example I’m using the name<strong> resticbackup</strong>.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-12.png" alt="" class="wp-image-30204" /></figure> <p>Click on <strong>View credentials</strong>.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-13.png" alt="" class="wp-image-30208" /></figure> <p>The <em>access_key_id</em> and <em>secret_access_key</em> is what you are looking for. (For obvious reasons, the author’s details here are obscured.)</p> <p>You will need to export these by calling them with the <em>export</em> alias in the shell, or putting them into a backup script.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-14.png" alt="" class="wp-image-30212" /></figure> <h2>Preparing a new repository</h2> <p>Restic refers to your backup as a <em>repository</em>, and can make backups to any bucket on your IBM cloud account. First, setup the following environment variables using your <em>access_key_id</em> and <em>secret_access_key</em> that you retrieved from your IBM cloud bucket. These can also be set in any backup script you may create.</p> <pre class="wp-block-preformatted">$ export AWS_ACCESS_KEY_ID=<MY_ACCESS_KEY> $ export AWS_SECRET_ACCESS_KEY=<MY_SECRET_ACCESS_KEY></pre> <p>Even though you are using IBM Cloud and not AWS, as previously mentioned, IBM Cloud storage is S3 compatible, and restic uses its interal AWS commands for any S3 compatible storage. So these AWS keys really refer to the keys from your IBM bucket.</p> <p>Create the repository by initializing it. A prompt appears for you to type a password for the repository. <strong><em>Do not lose this password because your data is irrecoverable without it!</em></strong></p> <pre class="wp-block-preformatted">restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET init</pre> <p>The <em>PUBLIC_ENDPOINT_LOCATION</em> was specified in the Endpoint section of your Bucket summary.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/make-free-encrypted-backups-to-the-cloud-on-fedora-15.png" alt="" class="wp-image-30221" /></figure> <p>For example:</p> <pre class="wp-block-preformatted">$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage init</pre> <h2>Creating backups</h2> <p>Now it’s time to backup some data. Backups are called <em>snapshots</em>. Run the following command and enter the repository password when prompted.</p> <pre class="wp-block-preformatted">restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET backup files_to_backup</pre> <p>For example:</p> <pre class="wp-block-preformatted">$ <strong>restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage backup Documents/</strong> Enter password for repository: repository 106a2eb4 opened successfully, password is correct Files: 51 new, 0 changed, 0 unmodified Dirs: 0 new, 0 changed, 0 unmodified Added to the repo: 11.451 MiB processed 51 files, 11.451 MiB in 0:06 snapshot 611e9577 saved</pre> <h2>Restoring from backups</h2> <p>Now that you’ve backed up some files, it’s time to make sure you know how to restore them. To get a list of all of your backup snapshots, use this command:</p> <pre class="wp-block-preformatted">restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET snapshots</pre> <p>For example:</p> <pre class="wp-block-preformatted">$ <strong>restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage snapshots</strong> Enter password for repository: ID Date Host Tags Directory ------------------------------------------------------------------- 106a2eb4 2020-01-15 15:20:42 client /home/curt/Documents</pre> <p>To restore an entire snapshot, run a command like this:</p> <pre class="wp-block-preformatted">restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore snapshotID --target restoreDirectory</pre> <p>For example:</p> <pre class="wp-block-preformatted">$ <strong>restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore 106a2eb4 --target ~</strong> Enter password for repository: repository 106a2eb4 opened successfully, password is correct restoring <Snapshot 106a2eb4 of [/home/curt/Documents]</pre> <p>If the directory still exists on your system, be sure to specify a different location for the<em> restoreDirectory. </em>For example:</p> <pre class="wp-block-preformatted">restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore 106a2eb4 --target /tmp</pre> <p>To restore an individual file, run a command like this:</p> <pre class="wp-block-preformatted">restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET restore snapshotID --target restoreDirectory --include filename</pre> <p>For example:</p> <pre class="wp-block-preformatted">$ <strong>restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore 106a2eb4 --target /tmp --include file1.txt</strong> Enter password for repository: restoring <Snapshot 106a2eb4 of [/home/curt/Documents] at 2020-01-16 15:20:42.833131988 -0400 EDT by curt@client> to /tmp</pre> <hr class="wp-block-separator" /> <p><em>Photo by <a href="https://unsplash.com/@alexmachado?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Alex Machado</a> on <a href="https://unsplash.com/s/photos/backups-to-cloud?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>.</em></p> <p>[EDITORS NOTE: The Fedora Project is <a href="https://getfedora.org/sponsors/">sponsored</a> by <a href="https://redhat.com">Red Hat</a>, which is owned by <a href="https://www.ibm.com/cloud/redhat">IBM</a>.]</p> <p>[EDITORS NOTE: Updated at 1647 UTC on 24 February 2020 to correct a broken link.]</p> </div> https://www.sickgaming.net/blog/2020/02/24/make-free-encrypted-backups-to-the-cloud-on-fedora/ |