snapd_snapd使管理Nextcloud变得轻而易举

snapd

As I’ve described in both my Linux in Action book and Linux in Motion course, Nextcloud is a powerful way to build a file sharing and collaboration service using only open source software running on your own secure infrastructure. It’s DropBox, Skype, and Google Docs all rolled into one, but without the vendor lock-in, security, and privacy fears.

正如我在《 Linux in Action》一书和《 Linux in Motion》课程中所描述的那样,Nextcloud是一种仅使用在自己的安全基础架构上运行的开源软件来构建文件共享和协作服务的强大方法。 DropBox,Skype和Google Docs全部整合为一个,但没有供应商锁定,安全性和隐私担忧。

While the platform is certainly well-designed and polished, the initial installation can be tricky. Looking for proof? Try manually installing Nextcloud on an Ubuntu 18.04 server using any one of the detailed instructions available around the internet. Sometimes everything goes smoothly, but not always. You might encounter packages no longer supported by the official upstream repositories or changed dependencies. Don’t blame the people who wrote those guides: blame the pace of change in official Linux software repositories.

虽然平台肯定经过了精心设计和完善,但初始安装可能会很棘手。 寻找证据? 尝试使用Internet上任何可用的详细说明之一,在Ubuntu 18.04服务器上手动安装Nextcloud。 有时一切进展顺利,但并非总是如此。 您可能会遇到官方上游存储库不再支持的软件包或已更改的依赖项。 不要怪罪那些指南的编写者:怪怪官方Linux软件存储库的变化步伐。

使用快照安装Nextcloud (Using snapd to Install Nextcloud)

There is a better way, but it’s got its own dark side.

有更好的方法,但是它有其自身的阴暗面。

As I wrote in this article, Canonical’s snapd package management system was designed to simplify the safe and predictable distribution of software across multiple Linux distributions and releases. And it works. Take the Nextcloud snap. Rather than investing 15 minutes, a lot of terminal typing — and some serious troubleshooting when things don’t go the way you’d hoped — preparing the underlying software stack on your server for Nextcloud works with a single command:

如我在本文中所写 ,Canonical的快照式软件包管理系统旨在简化跨多个Linux发行版和发行版的安全且可预测的软件发行。 而且有效。 以Nextcloud快照。 无需花费15分钟的时间,而是需要进行大量终端输入操作(以及在事情不尽如人意时进行一些严重的故障排除),而是只需一个命令即可在服务器上为Nextcloud准备基础软件堆栈:

snap install nextcloud

That’s it. No really. The snap system will stand up a working Nextcloud server for you, complete with backend layers running standalone instances of MySQL, Apache, Redis, and PHP. Try it yourself on your snap-enabled Linux machine.

而已。 不完全是。 快照系统将为您架起一台正在运行的Nextcloud服务器,并具有运行MySQL,Apache,Redis和PHP的独立实例的后端层。 在支持快照的 Linux机器上自己尝试。

So far so good. You can now manually set up an admin account and assign a password (hopefully better than the one in this example):

到目前为止,一切都很好。 现在,您可以手动设置一个管理员帐户并分配一个密码(希望比本示例中的密码更好):

nextcloud.manual-install admin password

One more step. By default, Nextcloud will accept HTTP requests addressed to localhost from the server itself. But, as will usually be the case, you’ll probably be setting things up on a remote or virtual server (like an AWS EC2 instance, for instance). So you’ll need to tell Nextcloud to expect remote browser requests made to your IP address or domain name. This is how it might look. Note how you assign a separate ID number (1 and 2 in this example) for each domain.

再一步。 默认情况下,Nextcloud将从服务器本身接受发给localhost的 HTTP请求。 但是,通常情况下,您可能会在远程或虚拟服务器(例如,AWS EC2实例)上进行设置。 因此,您需要告诉Nextcloud期望对您的IP地址或域名发出的远程浏览器请求。 这就是它的外观。 请注意如何为每个域分配一个单独的ID号(在此示例中为1和2)。

nextcloud.occ config:system:set trusted_domains 1 \
    --value=nextcloud.bootstrap-it.com$ nextcloud.occ \ 
    config:system:set trusted_domains 2 \
    --value=192.168.2.45

Those values will be saved to the config.php file, which you can read for yourself.

这些值将保存到config.php文件中,您可以自己阅读。

cat /var/snap/nextcloud/current/nextcloud/config/config.php

With that done, you should now be able to browse to the Nextcloud server’s IP address (or domain name) and log yourself into the admin console using the admin credentials you set up just before. I’ll let you explore the interface on your own.

完成此操作后,您现在应该能够浏览到Nextcloud服务器的IP地址(或域名),并使用之前设置的管理凭据将自己登录到管理控制台。 我将让您自己探索界面。

Nextcloud故障排除和管理 (Nextcloud Troubleshooting and Administration)

But I did say that the Nextcloud snap had its dark side, didn’t I? Well, suppose something goes wrong. Suppose, one fine day, your users are unexpectedly prevented from logging in normally to the Nextcloud UI. Even login attempts by admin users fail. Your first and only option at this point is to SSH into the server.

但是我确实说过,Nextcloud的一面是阴暗的,不是吗? 好吧,假设出了点问题。 假设有一天,出人意料地阻止了您的用户正常登录Nextcloud UI。 甚至管理员用户的登录尝试也会失败。 此时,您的第一个也是唯一的选择是SSH进入服务器。

I’m sure this won’t be your first administration experience on a Linux server. You’re wearing a fully-stocked tool belt and — to be honest about it — you’re actually looking forward to the challenge.

我敢肯定,这不会是您第一次在Linux服务器上进行管理。 您戴着一条存货充足的工具带,而且,老实说,您实际上是在期待挑战。

But wait! What’s this? The /etc/ directory contains no files with any obvious connection to the Apache, Redis, and MySQL services that you know are running, and the logs in /var/log/ are all mysteriously quiet. Even systemctl status doesn’t offer any hope. So much for your fully-stocked Linux tool belt.

可是等等! 这是什么? / etc /目录中没有包含与您正在运行的Apache,Redis和MySQL服务有任何明显连接的文件,并且/ var / log /中的日志都非常安静。 甚至systemctl的状态也没有任何希望。 您的库存充足的Linux工具带就这么多了。

Then, like the proverbial ton of bricks, it hits you: you installed Nextcloud using snapd. All the old rules don’t apply. Where are you going to go for help on this one? Well, if I may humbly suggest, you could start by reading my Managing Ubuntu Snaps article. That will explain where snapd hides important snap-based configuration files on your file system. It will also introduce you to some helpful snap admin tools.

然后,就像成堆的砖头一样,它给您带来了冲击:您使用snapd安装了Nextcloud。 所有旧规则都不适用。 您打算在哪里寻求帮助? 好吧,如果我谦虚地建议,您可以先阅读我的《管理Ubuntu Snaps》文章 。 这将说明快照在何处隐藏文件系统中重要的基于快照的配置文件。 它还将向您介绍一些有用的快照管理工具。

However, the rest of this article will focus on the Nextcloud project’s own command line tools — tools that can help you through some serious administration magic.

但是,本文的其余部分将重点介绍Nextcloud项目自己的命令行工具-这些工具可以帮助您克服一些严重的管理难题。

You already saw the Nextcloud CLI at work when you created your admin user and added one or two new trusted domains. One more important setup step is adding TLS encryption to your web service. The odds are that you would normally use the Electronic Freedom Frontier’s certbot tool to get a free cert from Let’s Encrypt. But that won’t work here…because snap. Instead, you’ll run Nextcloud’s own tool for requesting and installing a Let’s Encrypt certificate:

创建管理员用户并添加一个或两个新的受信任域时,您已经看到Nextcloud CLI在工作。 另一个重要的设置步骤是将TLS加密添加到您的Web服务。 很有可能您通常会使用Electronic Freedom Frontier的certbot工具从Let's Encrypt获得免费证书。 但这在这里是行不通的……因为快点。 相反,您将运行Nextcloud自己的工具来请求和安装Let's Encrypt证书:

nextcloud.enable-https lets-encrypt

But for a full overview of the whole range of available CLI operations, run nextcloud.occ. You’ll be shown a long list of facilities along with their descriptions and some syntax guidance. Spend a couple of minutes looking through what that command displayed on your machine.

但是,要全面了解所有可用的CLI操作,请运行nextcloud.occ。 系统将为您显示一长串设施,以及它们的描述和一些语法指导。 花几分钟看一下该命令在计算机上显示的内容。

nextcloud.occ

You could, for instance, list all the applications currently available to Nextcloud organized by Enabled or Disabled.

例如,您可以列出由Enabled或Disabled组织的Nextcloud当前可用的所有应用程序。

nextcloud.occ app:list
Enabled:
  - accessibility: 1.1.0
  - activity: 2.8.2
  - calendar: 1.6.4
  - cloud_federation_api: 0.1.0
  - comments: 1.5.0
  - dav: 1.8.1
  - federatedfilesharing: 1.5.0
  - federation: 1.5.0
[..]

Your next step might be to disable one of the currently enabled apps (or vice versa):

下一步可能是禁用一个当前启用的应用程序(反之亦然):

nextcloud.occ app:disable calendar

You can use app:update to manually update all or specified apps:

您可以使用app:update手动更新所有或指定的应用程序:

nextcloud.occ app:update --all
spreed new version available: 5.0.3
spreed updated

Someone forget a password? You can reset it:

有人忘记密码了吗? 您可以重置它:

nextcloud.occ user:resetpassword admin2
Enter a new password: 
Confirm the new password: 
Successfully reset password for admin2

I’m sure you’re getting the idea: you use top-level commands — like app, user, and maintenance — and add a colon and then a secondary command like list. Everything is nicely arranged into fairly intuitive domains. Here are some examples:

我确信您已经明白了:您使用顶级命令(例如appusermaintenance) ,并添加冒号,然后添加辅助命令(例如list)。 一切都很好地安排在相当直观的域中。 这里有些例子:

nextcloud.occ app:list
nextcloud.occ user:add
nextcloud.occ maintenance:repair

Finally, the status command will print some basic version information:

最后, status命令将打印一些基本的版本信息:

nextcloud.occ status
  - installed: true
  - version: 15.0.7.0
  - versionstring: 15.0.7
  - edition:

I think you’ve got the basics you’ll need to find your way around. The rest is up to you.

我认为您已经具备了找到所需的基础知识。 其余的取决于您。

Looking for more? You might enjoy my books and Pluralsight courses on Linux, AWS, and Docker-related topics.

寻找更多? 您可能会喜欢我的 书籍和 有关Linux,AWS和Docker相关主题的 Pluralsight课程

翻译自: https://www.freecodecamp.org/news/snapd-nextcloud/

snapd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值