热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

HowToRunprivacyIDEAWithApache2AndMySQLOnUbuntu14.0_MySQL

HowToRunprivacyIDEAWithApache2AndMySQLOnUbuntu14.04LTS
UbuntuApache

Howto run privacyIDEA with Apache2 and MySQL On Ubuntu 14.04 LTS

We use the latest 1.0dev0ofprivacyIDEA. It is available via thepython package indexor viagithub.

We assume that you have an Apache2 and MySQL database installed. This example was done on Ubuntu 14.04 LTS.

Install dependencies

We are using the python virtualenv. So the installation will get all correct versions of its depending python modules.

We also need to install some development packages:

apt-get install python-dev python-virtualenv libldap2-dev libsasl2-dev libmysqlclient-dev

We will install privacyidea to /srv/privacyidea:

cd /srv virtualenv privacyidea
cd privacyidea
source bin/activate

Note:source bin/activate will enter the python virtualenv. All python packages you install via pip will not be installed to your main system but to /srv/privacyidea. We assume that you downloaded the privacyidea version 1.0dev0. (Or install it directly from pypi)

pip install privacyIDEA-1.0dev0.tar.gz

This will also install all dependencies. Some of the packages need to be compiled, this is why we installed the development packages in the first step. As we will use MySQL as the database, we need to install the python package:

pip install MySQL-python

Now we will create the database and the database user:

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 42
Server version: 5.5.35-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> create database privacyidea;
Query OK, 1 row affected (0.00 sec)mysql> grant all privileges on privacyidea.* to "privacyidea"@"localhost" identified by "yourPassword";
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> quit;
Bye

Prepare configuration

Create the configuration directory:

mkdir /etc/privacyidea

Add the user, the wsgi script will run as:

useradd -r privacyidea

Copy the configuration examples:

cp etc/privacyidea/* /etc/privacyidea/
mv /etc/privacyidea/privacyidea.ini.example /etc/privacyidea/privacyidea.ini

In /etc/privacyidea/privacyidea.ini adapt the following lines:

sqlalchemy.url = mysql://privacyidea:yourPassword@localhost/privacyidea
args = ('/var/log/privacyidea/privacyidea.log','a', 10000000, 4)
who.log_file = /var/log/privacyidea/privacyidea.log
privacyideaURL = https://yourServer
privacyideaURL.disable_SSL=True

create your own encryption key:

privacyidea-create-enckey -f /etc/privacyidea/privacyidea.ini

Fix access rights:

privacyidea-fix-access-rights -f /etc/privacyidea/privacyidea.ini -u privacyidea

Create the database:

paster setup-app /etc/privacyidea/privacyidea.ini

Create admin users

In the first step, we will use admin users from a password file /etc/privacyidea/admin-users. Later you can define realms in privacyidea.ini, that contain admin users.

privacyidea-create-pwidresolver-user -u admin -i 1000 > /etc/privacyidea/admin-users

If you create an admin user "admin", you can login as "admin@admin".

Setup Apache

Finally we setup Apache, we install mod-wsgi and enable a bunch of modules:

apt-get install libapache2-mod-wsgi
a2enmod headers
a2enmod auth_digest
a2enmod ssl
a2dissite 000-default

Copy the example apache config to its place:

cp etc/apache2/sites-available/privacyidea /etc/apache2/sites-available/

Note:With Apache 2.4 the file needs to be renamed to privacyidea.conf

Now adapt privaycyidea.conf:

WSGIScriptAlias / /etc/privacyidea/privacyideaapp.wsgi
WSGIPythonHome /srv/privacyideasi

Note:With Apache 2.4 you need to change the access statement to "Require all granted", otherwise you will get "AH01630: client denied by server configuration".

As we want to run with SSL, you need to create self signed certificates:

privacyidea-create-certificate -f /etc/apache2/sites-available/privacyidea.conf
privacyidea-create-certificate -f /etc/apache2/sites-available/privacyidea

Now enable your site:

a2ensite privacyidea

Restart apache and login with the administrator "admin@admin" you created earlier.
推荐阅读
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 安装mysqlclient失败解决办法
    本文介绍了在MAC系统中,使用django使用mysql数据库报错的解决办法。通过源码安装mysqlclient或将mysql_config添加到系统环境变量中,可以解决安装mysqlclient失败的问题。同时,还介绍了查看mysql安装路径和使配置文件生效的方法。 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • Java String与StringBuffer的区别及其应用场景
    本文主要介绍了Java中String和StringBuffer的区别,String是不可变的,而StringBuffer是可变的。StringBuffer在进行字符串处理时不生成新的对象,内存使用上要优于String类。因此,在需要频繁对字符串进行修改的情况下,使用StringBuffer更加适合。同时,文章还介绍了String和StringBuffer的应用场景。 ... [详细]
  • 【MicroServices】【Arduino】装修甲醛检测,ArduinoDart甲醛、PM2.5、温湿度、光照传感器等,数据记录于SD卡,Python数据显示,UI5前台,微服务后台……
    这篇文章介绍了一个基于Arduino的装修甲醛检测项目,使用了ArduinoDart甲醛、PM2.5、温湿度、光照传感器等硬件,并将数据记录于SD卡,使用Python进行数据显示,使用UI5进行前台设计,使用微服务进行后台开发。该项目还在不断更新中,有兴趣的可以关注作者的博客和GitHub。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • Oracle10g备份导入的方法及注意事项
    本文介绍了使用Oracle10g进行备份导入的方法及相关注意事项,同时还介绍了2019年独角兽企业重金招聘Python工程师的标准。内容包括导出exp命令、删用户、创建数据库、授权等操作,以及导入imp命令的使用。详细介绍了导入时的参数设置,如full、ignore、buffer、commit、feedback等。转载来源于https://my.oschina.net/u/1767754/blog/377593。 ... [详细]
  • 本文介绍了一些Java开发项目管理工具及其配置教程,包括团队协同工具worktil,版本管理工具GitLab,自动化构建工具Jenkins,项目管理工具Maven和Maven私服Nexus,以及Mybatis的安装和代码自动生成工具。提供了相关链接供读者参考。 ... [详细]
  • ubuntu用sqoop将数据从hive导入mysql时,命令: ... [详细]
  • 分享css中提升优先级属性!important的用法总结
    web前端|css教程css!importantweb前端-css教程本文分享css中提升优先级属性!important的用法总结微信门店展示源码,vscode如何管理站点,ubu ... [详细]
  • 2016 linux发行版排行_灵越7590 安装 linux (manjarognome)
    RT之前做了一次灵越7590黑苹果炒作业的文章,希望能够分享给更多不想折腾的人。kawauso:教你如何给灵越7590黑苹果抄作业​zhuanlan.z ... [详细]
  • Android日历提醒软件开源项目分享及使用教程
    本文介绍了一款名为Android日历提醒软件的开源项目,作者分享了该项目的代码和使用教程,并提供了GitHub项目地址。文章详细介绍了该软件的主界面风格、日程信息的分类查看功能,以及添加日程提醒和查看详情的界面。同时,作者还提醒了读者在使用过程中可能遇到的Android6.0权限问题,并提供了解决方法。 ... [详细]
  • 本文介绍了在Web应用系统中,数据库性能是导致系统性能瓶颈最主要的原因之一,尤其是在大规模系统中,数据库集群已经成为必备的配置之一。文章详细介绍了主从数据库架构的好处和实验环境的搭建方法,包括主数据库的配置文件修改和设置需要同步的数据库等内容。MySQL的主从复制功能在国内外大型网站架构体系中被广泛采用,本文总结了作者在实际的Web项目中的实践经验。 ... [详细]
author-avatar
mobiledu2502874483
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有