我尝试按照 guide 中的说明在 Ubuntu 22.04 上安装 CKAN 2.10,但运行 CKAN 失败,我收到 python 错误消息“PermissionError: [Errno 13] Permission returned: '/var/lib/ckan'”,当我与从“package”成功安装相比,我可以看到文件夹 /var/lib/ckan 丢失。 我在通过 SSH 访问的远程 Ubuntu 服务器上进行安装,并且更新了 ckan.ini 文件以反映新的主机地址。检查 ckan.ini 用户列表,我可以看到默认用户已创建 有什么建议可能是错误的吗?
我已经更新了 ckan.ini 文件以反映远程主机安装,并仔细与远程主机上的软件包安装进行了比较,没有
`
`Traceback (most recent call last):
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/werkzeug/serving.py", line 324, in run_wsgi
execute(self.server.app)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/werkzeug/serving.py", line 313, in execute
application_iter = app(environ, start_response)
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/config/middleware/flask_app.py", line 82, in __call__
return self.app(environ, start_response)
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/config/middleware/common_middleware.py", line 87, in __call__
return self.app(environ, start_response)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/flask/app.py", line 2091, in __call__
return self.wsgi_app(environ, start_response)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/beaker/middleware.py", line 156, in __call__
return self.wrap_app(environ, session_start_response)
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/config/middleware/common_middleware.py", line 31, in __call__
return self.app(environ, start_response)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/flask/app.py", line 1440, in handle_exception
server_error = self.ensure_sync(handler)(server_error)
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/config/middleware/flask_app.py", line 624, in error_handler
return base.render(
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/lib/base.py", line 107, in render
return flask_render_template(template_name, **extra_vars)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/flask/templating.py", line 147, in render_template
return _render(
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/flask/templating.py", line 128, in _render
rv = template.render(context)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/templates/error_document_template.html", line 1, in top-level template code
{% extends "page.html" %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckanext/activity/templates/page.html", line 1, in top-level template code
{% ckan_extends %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/templates/page.html", line 1, in top-level template code
{% extends "base.html" %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckanext/activity/templates/base.html", line 1, in top-level template code
{% ckan_extends %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/templates/base.html", line 71, in top-level template code
{%- block styles %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckanext/activity/templates/base.html", line 4, in block 'styles'
{{ super() }}
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/templates/base.html", line 74, in block 'styles'
{% asset theme %}
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/lib/jinja_extensions.py", line 338, in _call
h.include_asset(args[0])
File "/home/alkragh/ckan/lib/default/src/ckan/ckan/lib/webassets_tools.py", line 112, in include_asset
urls = [url_for_static_or_external(url) for url in bundle.urls()]
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/bundle.py", line 833, in urls
urls.extend(bundle._urls(new_ctx, extra_filters, *args, **kwargs))
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/bundle.py", line 767, in _urls
self._build(ctx, extra_filters=extra_filters, force=False,
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/bundle.py", line 609, in _build
update_needed = ctx.updater.needs_rebuild(self, ctx) \
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/updater.py", line 173, in needs_rebuild
super(TimestampUpdater, self).needs_rebuild(bundle, ctx) or \
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/updater.py", line 103, in needs_rebuild
return self.check_bundle_definition(bundle, ctx)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/updater.py", line 82, in check_bundle_definition
if not ctx.cache:
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/bundle.py", line 50, in __getattr__
return self.getattr(self._parent, item)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/bundle.py", line 58, in getattr
return getattr(object, item)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/env.py", line 509, in _get_cache
cache = get_cache(self._storage['cache'], self)
File "/home/alkragh/ckan/lib/default/lib/python3.10/site-packages/webassets/cache.py", line 236, in get_cache
os.makedirs(directory)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/lib/ckan'
`
“PermissionError”表示
/var/lib/ckan
目录的所有权不正确。要解决此问题,请将所有权更改为运行 CKAN 实例的用户。例如,如果您使用 Nginx 运行 CKAN,则 Nginx 用户(通常在 Ubuntu 上为 www-data
)必须具有 /var/lib/ckan
的读取、写入和执行权限。您可以使用以下命令进行设置:
sudo chown www-data /var/lib/ckan
sudo chmod u+rwx /var/lib/ckan
这应该通过确保正确的用户具有目录的完全访问权限来解决权限问题。