感谢支持
我们一直在努力

Submin2安装在CentOS 5和Apache2.4.4

硬着头皮,一个一个问题的解决,终于见到曙光,成功搭建完成。
具体的安装步骤分四个部分:

  • apache安装
  • python安装
  • submin安装
  • apache配置
  • 问题汇总

1 编译apache2.4.4
——————————————————–
安装apache中间由于涉及到很多依赖的插件,因此需要先完成apr,pcre等安装才能进行apache安装。
具体的安装操作命令如下:
a) apr安装
wget http://www.apache.org/dist/apr/apr-1.4.6.tar.gz
tar -xzvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure –prefix=/opt/apr –enable-threads
make
make install
b) apr-util安装
wget http://www.apache.org/dist/apr/apr-util-1.5.1.tar.gz
tar -xzvf apr-util-1.5.1.tar.gz
cd apr-util-1.5.1
./configure –prefix=/opt/apr –with-apr=/opt/apr
make
make install

c) pcre安装
wget http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.gz/download
tar -xzvf pcre-8.32.tar.gz
cd pcre-8.32
./configure –prefix=/opt/pcre
make
make install

d) apache2.4.4安装
wget http://www.apache.org/dist/httpd/httpd-2.4.4.tar.gz
tar -xzvf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure –prefix=/opt/apache24 –with-pcre=/opt/pcre –with-apr=/opt/apr –with-apr-util=/opt/apr  –enable-cgid  –enable-cgi
make clean
make
make install

 

2. 安装python2.7.3
——————————————————-
由于submin需要使用到sqlite3数据库,因此在安装python2.7.3的时候,把sqlite3模块安装上。但2.7.3的安装脚本中存在bug,需要打最新的patch解决。具体的步骤如下:
yum search sqlite3
yum install sqlite-devel
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar -xvjf Python-2.7.3.tar.bz2
cd Python-2.7.3
more README
wget http://bugs.python.org/file25647/sqlite3_int64_v2.patch
patch -p1 < sqlite3_int64_v2.patch
./configure
make
make install

3. 安装submin
———————————————————
安装submin过程比较简单的,但在初始化环境的时候遇到了问题,在submin的脚本中需要设置apache的启动用户组,我使用的nobody组,但在submin的脚本中没有,最后手工添加解决。
wget http://supermind.nl/submin/current/submin-2.1.0-1.tar.gz
tar -zxvf submin-2.1.0-1.tar.gz
cd submin-2.1.0-1
python setup.py install

submin2-admin /var/lib/submin initenv jackey.jiao@infowarelab.com

4. 配置apache
——————————————————-
配置apache,主要是设置submin的conf文件,另外需要dbd,authz,cgi的module就可以。如果启动过程发现缺少,就打开配置即可。
另外一个问题就是在配置完毕后,访问submin报403错误,后查到是,submin的脚本是在apache2.2的基础上开发的,没有支持apache2.4.4,需要设置符合apache2.4.4的访问策略。
[root@localhost ~]#
[root@localhost ~]# tail -10f /opt/apache24/conf/httpd.conf
#BrowserMatch “MSIE 10.0;” bad_DNT
#
#
#RequestHeader unset DNT env=bad_DNT
#

Include /var/lib/submin/conf/apache-webui-cgi.conf
Include /var/lib/submin/conf/apache-svn.conf

5. 问题汇总
Please provide a location for the Subversion repositories. For new Subversion
repositories, the default setting is ok. If the path is not absolute, it will
be relative to the submin environment. If you want to use an existing
repository, please provide the full pathname to the Subversion parent
directory (ie. /var/lib/svn).

Path to the repository? [svn]>

Please provide a location for the git repositories. For new git repositories,
the default setting is ok. If the path is not absolute, it will be relative to
the submin environment. If you want to use an existing repository, please
provide the full pathname to the git parent directory (ie. /var/lib/git).

Path to the git repositories? [git]>

Please provide a location for the parent dir of Trac environments. For a new
installation, the default setting is ok. If you don’t want to use Trac, the
default setting is also ok. For existing Trac environments, please provide
the full path.

Path to trac environment? [trac]>

Please provide a hostname that can be used to reach the web interface. This
hostname will be used in communication to the user (a link in email, links
in the web interface).

Hostname? [localhost]>

The HTTP path tells Submin where the website is located relative to the root.
This is needed for proper working of the website. Submin will be accesible
from /submin, Subversion will be accessible from /svn.
If you use Trac, it will be accessible from /trac.

HTTP base? [/]>
Traceback (most recent call last):
File “/usr/bin/submin2-admin”, line 6, in
sa.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 82, in run
return self.execute(self.argv[2:])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 158, in execute
rc = Class.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 200, in run
self.interactive()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 118, in interactive
self.create_env()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 175, in create_env
self.sa.execute([‘unixperms’, ‘fix’])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 158, in execute
rc = Class.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_unixperms.py”, line 128, in run
subcmd(self.argv[1:])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_unixperms.py”, line 38, in subcmd_fix
self._fix(”)
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_unixperms.py”, line 49, in _fix
user = apache.pw_uid
AttributeError: ‘NoneType’ object has no attribute ‘pw_uid’
[root@localhost conf]#

—————————————————————————-
def apache_user(self, preferred=”):
“””Returns most probably www-user”””
from pwd import getpwnam
users = []
known = [preferred, ‘www-data’, ‘httpd’, ‘apache’, ‘_www’,
‘wwwrun’, ‘www’, ‘nobody’]
“c_unixperms.py” 128L, 3021C written
—————————————————————————–

[root@localhost conf]# rm -rf /var/lib/submin/
[root@localhost conf]#
[root@localhost conf]# submin2-admin /var/lib/submin initenv jackey.jiao@infowarelab.com

Please provide a location for the Subversion repositories. For new Subversion
repositories, the default setting is ok. If the path is not absolute, it will
be relative to the submin environment. If you want to use an existing
repository, please provide the full pathname to the Subversion parent
directory (ie. /var/lib/svn).

Path to the repository? [svn]>

Please provide a location for the git repositories. For new git repositories,
the default setting is ok. If the path is not absolute, it will be relative to
the submin environment. If you want to use an existing repository, please
provide the full pathname to the git parent directory (ie. /var/lib/git).

Path to the git repositories? [git]>

Please provide a location for the parent dir of Trac environments. For a new
installation, the default setting is ok. If you don’t want to use Trac, the
default setting is also ok. For existing Trac environments, please provide
the full path.

Path to trac environment? [trac]>

Please provide a hostname that can be used to reach the web interface. This
hostname will be used in communication to the user (a link in email, links
in the web interface).

Hostname? [localhost]>

The HTTP path tells Submin where the website is located relative to the root.
This is needed for proper working of the website. Submin will be accesible
from /submin, Subversion will be accessible from /svn.
If you use Trac, it will be accessible from /trac.

HTTP base? [/]>
Apache files created:
/var/lib/submin/conf/apache-webui-cgi.conf
/var/lib/submin/conf/apache-webui-wsgi.conf
/var/lib/submin/conf/apache-svn.conf
/var/lib/submin/conf/apache-trac-modpython.conf
/var/lib/submin/conf/apache-trac-cgi.conf
/var/lib/submin/conf/apache-trac-fcgid.conf
/var/lib/submin/conf/apache-trac-modwsgi.conf

Please include the relevent files in your apache config. If you have
selected to generate all files (recommended), do not include all files,
but only select one version (e.g. svn and webui-cgi but not webui-wsgi).

Also make sure that you have the appropriate modules installed and enabled.
Depending on your choices, these may include: mod_dav_svn, mod_authz_svn,
mod_authn_dbd, mod_dbd, mod_wsgi, mod_cgi, mod_cgid and mod_python
Traceback (most recent call last):
File “/usr/bin/submin2-admin”, line 6, in
sa.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 82, in run
return self.execute(self.argv[2:])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 158, in execute
rc = Class.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 200, in run
self.interactive()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 118, in interactive
self.create_env()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_initenv.py”, line 178, in create_env
self.sa.execute([‘trac’, ‘init’])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/subminadmin.py”, line 158, in execute
rc = Class.run()
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_trac.py”, line 96, in run
subcmd(self.argv[1:])
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/c_trac.py”, line 39, in subcmd_init
if not trac.exists():
File “/usr/local/lib/python2.7/site-packages/submin/subminadmin/trac.py”, line 17, in exists
return trac.tracAdminExists()
File “/usr/local/lib/python2.7/site-packages/submin/models/trac.py”, line 61, in tracAdminExists
if e.errno == errno.ENOENT: # could not find executable
NameError: global name ‘errno’ is not defined
[root@localhost conf]# [root@localhost conf]#

——————————————————————————
55 raise TracAdminError(‘ ‘.join(cmd), e.returncode, e.output)
56
57 def tracAdminExists():
58 try:
59 trac_admin_command(‘/tmp’, [‘help’])
60 except OSError, e:
61 if e.errno == os.errno.ENOENT: # could not find executable
62 return False
63 raise
64
65 return True

———————————————————————————

HTTP base? [/]>
Apache files created:
/var/lib/submin/conf/apache-webui-cgi.conf
/var/lib/submin/conf/apache-webui-wsgi.conf
/var/lib/submin/conf/apache-svn.conf
/var/lib/submin/conf/apache-trac-modpython.conf
/var/lib/submin/conf/apache-trac-cgi.conf
/var/lib/submin/conf/apache-trac-fcgid.conf
/var/lib/submin/conf/apache-trac-modwsgi.conf

Please include the relevent files in your apache config. If you have
selected to generate all files (recommended), do not include all files,
but only select one version (e.g. svn and webui-cgi but not webui-wsgi).

Also make sure that you have the appropriate modules installed and enabled.
Depending on your choices, these may include: mod_dav_svn, mod_authz_svn,
mod_authn_dbd, mod_dbd, mod_wsgi, mod_cgi, mod_cgid and mod_python
Could not find ‘trac-admin’ command. If you want to use Trac, please install trac and run: `submin2-admin /var/lib/submin trac init`
You have new mail in /var/spool/mail/root
[root@localhost conf]#

———————————————————
与apache2.4.4存在兼容性问题,权限控制有所不同。需要修改submin产生的apache配置文件访问权限控制
参考:http://httpd.apache.org/docs/2.4/upgrading.html#access

[Thu Mar 28 03:04:39.708109 2013] [mpm_event:notice] [pid 29444:tid 47465972401248] AH00489: Apache/2.4.4 (Unix) configured — resuming normal operations
[Thu Mar 28 03:04:39.708399 2013] [core:notice] [pid 29444:tid 47465972401248] AH00094: Command line: ‘/opt/apache25/bin/httpd’
[Thu Mar 28 03:05:33.391673 2013] [authz_core:error] [pid 29448:tid 1116485952] [client 172.16.2.52:51455] AH01630: client denied by server configuration: /usr/local/lib/python2.7/site-packages/submin/static/www
[Thu Mar 28 03:05:37.697600 2013] [authz_core:error] [pid 29448:tid 1126975808] [client 172.16.2.52:51455] AH01630: client denied by server configuration: /usr/local/lib/python2.7/site-packages/submin/static/www/
[Thu Mar 28 03:05:42.465937 2013] [authz_core:error] [pid 29448:tid 1137465664] [client 172.16.2.52:51455] AH01630: client denied by server configuration: /usr/local/lib/python2.7/site-packages/submin/static/www/a.html
[Thu Mar 28 03:06:04.876683 2013] [mpm_event:notice] [pid 29444:tid 47465972401248] AH00494: SIGHUP received. Attempting to restart

Order allow,deny
Allow from all
Options ExecCGI FollowSymLinks
AddHandler cgi-script py cgi pl

SetEnv SUBMIN_ENV /var/lib/submin

Require all granted
Options ExecCGI FollowSymLinks
AddHandler cgi-script py cgi pl

SetEnv SUBMIN_ENV /var/lib/submin

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

赞(0) 打赏
转载请注明出处:服务器评测 » Submin2安装在CentOS 5和Apache2.4.4
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏