前提条件
这个教程的基础是你的电脑上已经安装了 java 和 python 。并需要以下三步来确保符合安装条件。
Step 1 确认已经安装了基础包
使用命令 rpm -qa | grep selinux
, rpm -q policycoreutils
和 rpm -qa | grep setroubleshoot
来确认你已经安装了 SELinux 包。如果没有,则需要先安装上。
确认你已经安装了下面几个: selinux-policy-targeted, selinux-policy, libselinux, libselinux-python, libselinux-utils, policycoreutils, setroubleshoot, setroubleshoot-server, setroubleshoot-plugins。
作为 Linux 的root用户,使用下面的命令来安装上面所列内容中你没有安装的包。
yum install package-name
下面这几个的安装是可选的: policycoreutils-gui,selinux-policy-devel,mcstrans 。
Step 2 打开 SELinux
使用命令 /usr/sbin/getenforce
or /usr/sbin/sestatus
来检查 SELinux 的状态,命令 getenforce 会返回 Enforcing
, Permissive
或者 Disabled
。如果返回Enforcing
则说明SELinux是打开的(SELinux规则会被执行):
# /usr/sbin/getenforce
Enforcing
如果 SELinux 是 disabled 状态,你需要在安装ckan之前打开它。
在打开 SELinux 之前,文件系统的每个文件必须用 SELinux 内容所标记。在这之前,限制的部分可能被定义为允许状态,使得你的系统不能正确启动,为此,要确保 /etc/selinux/config
文件中 ELINUX=permissive
:
[root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
然后作为 Linux的 root
身份,执行命令 reboot
来重启计算机,这样在在下一次启动的过程中,文件系统会被标记。
Step 3 安装python需要的包
在安装的第9步中,定义的 WSGI 文件需要 python 的 paste.deploy
和 paste.script
包,你可以通过下面的指令来确定是否安装:
# python
>>> from paste.deploy import loadapp
>>> from paste.script.util.logging_config import fileConfig
如果执行命令后没有报错,则你可直接跳过下面安装的步骤,如果提示没有相关的包,并且你安装了pip
包,那么你可以直接通过下面两个语句安装这两个包:
pip install PasteDeploy
pip install PasteScript
提示: 包 paste.deploy
和 paste.script
与paste
包是不一样的。你可以通过 Ctrl+D
或 exit
指令退出 python 环境。
具备以上条件后你就可以开始安装CKAN了!
1. 安装所需的包
安装并激活 CentOS Release 库
# yum install centos-release
更新并重启你的系统
# yum update
# shutdown -r now
安装后面我们需要用到的 wget
和 policycoreutils-python
# yum in