Guest User

Untitled

a guest
Aug 12th, 2011
1,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. install nocproject from source on Centos 6.0
  2.  
  3. Проверяем версию python:
  4.  
  5. # python -V
  6. Python 2.6.5
  7.  
  8. Устанавливаем postgresql
  9. # yum install postgresql-server postgresql-libs postgresql-devel postgresql-contrib postgresql-plpython
  10.  
  11. Указанный в документации вариант установки setuptools отказался работать.
  12. Скачиваем последнюю версию:
  13.  
  14. # wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
  15. # tar -xvzf setuptools-0.6c11.tar.gz
  16. # cd setuptools-0.6c11
  17. # python setup.py install
  18.  
  19. Я устанавливал Centos c LiveCD, поэтому доустанавливаем нужные пакеты:
  20.  
  21. # yum install python-devel
  22. # yum install gmp gmp-devel gmp-static
  23. # yum install libsmi libsmi-devel
  24. # yum install mercurial
  25. # yum install hg
  26.  
  27. Добавляем репозиторий MongoDB:
  28.  
  29. # vim /etc/yum.repos.d/10gen.repo
  30.  
  31. [10gen]
  32. name=10gen Repository
  33. baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
  34. gpgcheck=0
  35.  
  36. #
  37. # yum install mongo-10gen mongo-10gen-server
  38. # yum install libtool httpd-devel apr-devel apr
  39.  
  40.  
  41. # easy_install psycopg2
  42. #easy_install gmpy
  43. #easy_install pycrypto
  44.  
  45. Fping в родных репозитариях я не нашел, а так как подключать другие мне было лень - поставил так:
  46. #wget http://pkgs.repoforge.org/fping/fping-2.4-1.b2.3.el5.rf.i386.rpm
  47. #rpm --install fping-2.4-1.b2.3.el5.rf.i386.rpm
  48.  
  49. #easy_install netifaces
  50.  
  51. #/sbin/service postgresql initdb
  52. #/sbin/service postgresql start
  53.  
  54. Настраиваем mongod:
  55.  
  56. #/sbin/service mongod start
  57. # mongo
  58. use noc
  59. db.addUser('noc', '12345');
  60. db.auth('noc','12345');
  61. quit
  62. #/sbin/service mongod restart
  63.  
  64. Postgres:
  65.  
  66. #su - postgres
  67.  
  68. $ createuser noc
  69. $ Shall the new role be a superuser? (y/n) n
  70. $ Shall the new role be allowed to create databases? (y/n) n
  71. $ Shall the new role be allowed to create more new roles? (y/n) n
  72. $ exit
  73.  
  74. NOC Project:
  75.  
  76. #hg clone http://hg.nocproject.org/noc noc
  77.  
  78. #groupadd noc
  79. #useradd -g noc -s /bin/sh -d /home/noc noc
  80.  
  81. #python setup.py install
  82. #cd /opt/noc/
  83. #./scripts/post-install
  84.  
  85.  
  86. # su - noc
  87.  
  88. $ python setup.py install
  89. $ cd /opt/noc/
  90. $ ./scripts/post-install
  91. $ exit
  92.  
  93. В документации написано, что права root:root необходимы только для каталогов /opt/noc/local и /opt/noc/static/doc
  94. Так вот - ключи не генерились до тех пор, пока я не выставил права на /opt/noc/etc/ssh
  95.  
  96.  
  97. Устанавливаем FastCGI:
  98.  
  99. # wget wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
  100. # tar -xvzf mod_fastcgi-current.tar.gz
  101. # cd mod_fastcgi-2.4.6/
  102. # cp -p Makefile.AP2 Makefile
  103.  
  104. # make top_dir=/usr/lib/httpd
  105. # make install top_dir=/usr/lib/httpd
  106.  
  107. Добавляем модуль в httpd.conf:
  108.  
  109. LoadModule fastcgi_module /usr/lib/httpd/modules/mod_fastcgi.so
  110.  
  111. Правим httpd.conf:
  112.  
  113. FastCGIExternalServer /opt/noc/noc.fcgi -socket /tmp/noc.fcgi
  114. <VirtualHost *:80>
  115. DocumentRoot /opt/noc
  116. ServerName kovreng.relinfo.ru
  117. Alias /media /opt/noc/contrib/lib/django/contrib/admin/media/
  118. RewriteEngine On
  119. RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
  120. RewriteRule ^/(static.*)$ /$1 [QSA,L,PT]
  121. RewriteCond %{REQUEST_FILENAME} !-f
  122. RewriteRule ^/(.*)$ /noc.fcgi/$1 [QSA,L]
  123. <Directory /opt/noc>
  124. Order allow,deny
  125. Allow from all
  126. </Directory>
  127. <Location /media>
  128. Order allow,deny
  129. Allow from all
  130. </Location>
  131. </VirtualHost>
  132.  
  133. # /sbin/service httpd restart
  134.  
  135. Смотрим, где у нас находятся файлы:
  136. rsync, gpg, tar, smilint, mongodump, dig, pg_dump, smidump, ssh, gzip, hg - и правим соответствующие пути в файле
  137. /opt/noc/etc/noc.conf (Секции [cm] vcs_path и [path])
  138.  
  139. Проверяем права на каталог репозитория:
  140. # ll /var/repo
  141. total 4
  142. drwxrwxrwx. 3 noc noc 4096 Aug 12 11:21 config
  143.  
  144.  
  145. Настраиваем активатор (файл /opt/noc/etc/noc-activator.conf)
  146.  
  147. [activator]
  148. name = noc
  149. listen_instance = 0
  150. listen_traps =
  151. listen_syslog =
  152. listen_pm_data = 127.0.0.1
  153. secret = noc
  154. software_update = true
  155. max_scripts = 10
  156. pm_data_secret = noc
  157.  
  158. Стартуем ;)
  159.  
  160. # cd /opt/noc
  161. # ./scripts/noc-launcher.py start
  162.  
  163. Логинимся в систему: http://host
  164. Учетная запись по умолчанию noc/noc
  165.  
  166. Заходим в меню:
  167. Service Activation › Activators ›
  168. И создаем активатор, аналогично тому, который прописан в /opt/noc/etc/noc-activator.conf
  169. Все ;)
Advertisement
Add Comment
Please, Sign In to add comment