Admin center:OCS server with normal user privilege

From OCS Inventory NG
Jump to: navigation, search

“setup ocs as nonroot user” on the forum

Installation:

#apache
wget http://www.apache.net.pl/httpd/httpd-2.2.14.tar.gz
tar xvzf httpd-2.2.14.tar.gz
cd httpd-2.2.14/
./configure  --enable-ssl --enable-cgi --prefix=/opt/ocs/apache
make
make install
cd

#php
wget http://pl2.php.net/get/php-5.3.0.tar.bz … net/mirror
tar xvjf php-5.3.0.tar.bz2
cd php-5.3.0
./configure --enable-zip  --enable-soap --with-mysql --prefix=/opt/ocs/php  --disable-cli  --with-apxs2=/opt/ocs/apache/bin/apxs --with-config-file-path=/opt/ocs/php/ --disable-inline-optimization
make
make install
cd

#perl
wget http://www.cpan.org/src/perl-5.10.1.tar.gz
tar xvzf perl-5.10.1.tar.gz
cd perl-5.10.1
sh Configure -Dprefix=/opt/ocs/perl -des
make
make install
cd

#local cpan smile
/opt/ocs/perl/bin/perl -MCPAN -e 'install DBI'
/opt/ocs/perl/bin/perl -MCPAN -e 'install Apache::DBI'
/opt/ocs/perl/bin/perl -MCPAN -e 'install Net::IP'
/opt/ocs/perl/bin/perl -MCPAN -e 'install XML::Simple'
/opt/ocs/perl/bin/perl -MCPAN -e 'install DBD::mysql'


#mod_perl
wget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz
tar xvzf mod_perl-2.0-current.tar.gz
cd mod_perl-2.0.4/
/opt/ocs/perl/bin/perl Makefile.PL MP_APXS=/opt/ocs/apache/bin/apxs APACHE_PREFIX=/opt/ocs/apache USE_APACI=1 NO_HTTPD=1 PREP_HTTPD=1 EVERYTHING=1
make
make install
cd



# CZEK: sciezki!
cp ./httpd.conf  ./apache/conf/
vim ./apache/conf/httpd.conf

#ocs
wget http://downloads.sourceforge.net/projec … mirror=dfn
tar xvzf OCSNG_UNIX_SERVER-1.02.1.tar.gz
mkdir ocsinventory-server
mkdir ocsinventory-server/download
cp -r ./OCSNG_UNIX_SERVER-1.02.1/ocsreports/ ./ocsinventory-server/
cp -r ./OCSNG_UNIX_SERVER-1.02.1/Apache/binutils/ ./ocsinventory-server/
cd ./OCSNG_UNIX_SERVER-1.02.1/Apache/
/opt/ocs/perl/bin/perl Makefile.PL
make
make install
cd


and this is the httpd.conf:

NameVirtualHost *:1234                               
Listen 1234                                           
Listen 1235                                           
ServerName test                                     

DirectoryIndex index.html index.html.var index.htm index.shtml index.cgi index.php

LoadModule perl_module /opt/ocs/apache/modules/mod_perl.so
LoadModule php5_module /opt/ocs/apache/modules/libphp5.so
<IfModule mod_php5.c>                                     
       AddType application/x-httpd-php .php               
       php_value post_max_size         16m               
       php_value upload_max_filesize   16m               
</IfModule>                                               


<VirtualHost *:1234>
        ServerAdmin webmaster@localhost

        DocumentRoot /opt/ocs/apache/htdocs
        <Directory />                     
                Options FollowSymLinks     
                AllowOverride None         
        </Directory>                       
        <Directory /opt/ocs/apache/htdocs>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None                       
                Order allow,deny                         
                allow from all                           
        </Directory>                                     

        ErrorLog /opt/ocs/apache/logs/error_log
        LogLevel warn                         
        CustomLog /opt/ocs/apache/logs/access_log combined

</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost _default_:1235>
        ServerAdmin webmaster@localhost

        DocumentRoot /opt/ocs/apache/htdocs

        <Directory /opt/ocs/apache/htdocs/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None                       
                Order allow,deny                         
                allow from all                           
        </Directory>                                     

        Alias /ocsreports /opt/ocs/ocsinventory-server/ocsreports
        Alias /glpi /opt/ocs/glpi                               


        ErrorLog /opt/ocs/apache/logs/ssl_error_log

        LogLevel warn

        CustomLog /opt/ocs/apache/logs/ssl_access_log combined

        SSLEngine on

        SSLCertificateFile    /opt/ocs/server.crt
        SSLCertificateKeyFile /opt/ocs/server.key

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars         
        </FilesMatch>                         
        <Directory /usr/lib/cgi-bin>           
                SSLOptions +StdEnvVars         
        </Directory>                           

        BrowserMatch ".*MSIE.*" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0 

</VirtualHost>
</IfModule>   

Alias /download   /opt/ocs/ocsinventory-server/download

<Directory /opt/ocs/ocsinventory-server/ocsreports/>
       Options Indexes FollowSymLinks               
       DirectoryIndex index.php                     


       <IfModule mod_php5.c>
               AddType application/x-httpd-php .php
                php_value post_max_size         16m
                php_value upload_max_filesize   16m
       </IfModule>                                 
</Directory>                                       



<IfModule mod_perl.c>
  PerlSwitches -I/opt/ocs/lib/
  PerlSetEnv OCS_MODPERL_VERSION 2

  PerlSetEnv OCS_DB_HOST 10.10.10.14
  PerlSetEnv OCS_DB_PORT 3306       
  PerlSetEnv OCS_DB_NAME ocs_test   
  PerlSetEnv OCS_DB_LOCAL ocs_test 
  PerlSetEnv OCS_DB_USER ocs_test   
  PerlSetVar OCS_DB_PWD ocs_test
                                   
  PerlSetEnv OCS_OPT_LOGPATH "/opt/ocs/apache/logs"
                                                   
  PerlSetEnv OCS_OPT_DBI_PRINT_ERROR 0             
                                                   
  PerlAddVar OCS_OPT_TRUSTED_IP 127.0.0.1         

                                                   
  PerlSetEnv OCS_OPT_WEB_SERVICE_ENABLED 0         
  PerlSetEnv OCS_OPT_WEB_SERVICE_RESULTS_LIMIT 100

  PerlSetEnv OCS_OPT_COMPRESS_TRY_OTHERS 1
                                         
  PerlSetEnv OCS_OPT_OPTIONS_NOT_OVERLOADED 1

  PerlSetEnv OCS_OPT_LOGLEVEL 2
  PerlSetEnv OCS_OPT_PROLOG_FREQ 12
  PerlSetEnv OCS_OPT_AUTO_DUPLICATE_LVL 15
  PerlSetEnv OCS_OPT_SECURITY_LEVEL 0     
  PerlSetEnv OCS_OPT_LOCK_REUSE_TIME 600 
  PerlSetEnv OCS_OPT_TRACE_DELETED 0     
                                         
  PerlSetEnv OCS_OPT_FREQUENCY 0         
  PerlSetEnv OCS_OPT_INVENTORY_DIFF 1     
  PerlSetEnv OCS_OPT_INVENTORY_TRANSACTION 1
  PerlSetEnv OCS_OPT_INVENTORY_WRITE_DIFF 1
  PerlSetEnv OCS_OPT_INVENTORY_CACHE_ENABLED 1
  PerlSetEnv OCS_OPT_INVENTORY_CACHE_REVALIDATE 7
  PerlSetEnv OCS_OPT_INVENTORY_CACHE_KEEP 1     

  PerlSetEnv OCS_OPT_DOWNLOAD 1
  PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LENGTH 10
  PerlSetEnv OCS_OPT_DOWNLOAD_CYCLE_LATENCY 60
  PerlSetEnv OCS_OPT_DOWNLOAD_FRAG_LATENCY 60
  PerlSetEnv OCS_OPT_DOWNLOAD_GROUPS_TRACE_EVENTS 1
  PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LATENCY 60   
  PerlSetEnv OCS_OPT_DOWNLOAD_TIMEOUT 7           
                                                   
  PerlSetEnv OCS_OPT_DEPLOY 0                     
                                                   
  PerlSetEnv OCS_OPT_ENABLE_GROUPS 1               
  PerlSetEnv OCS_OPT_GROUPS_CACHE_OFFSET 43200     
  PerlSetEnv OCS_OPT_GROUPS_CACHE_REVALIDATE 43200
                                                   
  PerlSetEnv OCS_OPT_IPDISCOVER 2                 
  PerlSetEnv OCS_OPT_IPDISCOVER_BETTER_THRESHOLD 1
  PerlSetEnv OCS_OPT_IPDISCOVER_LATENCY 100       
  PerlSetEnv OCS_OPT_IPDISCOVER_MAX_ALIVE 14       
  PerlSetEnv OCS_OPT_IPDISCOVER_NO_POSTPONE 0     
  PerlSetEnv OCS_OPT_IPDISCOVER_USE_GROUPS 1       
                                                   
  PerlSetEnv OCS_OPT_GENERATE_OCS_FILES 0         
  PerlSetEnv OCS_OPT_OCS_FILES_FORMAT OCS         
  PerlSetEnv OCS_OPT_OCS_FILES_OVERWRITE 0         
  PerlSetEnv OCS_OPT_OCS_FILES_PATH /tmp           

  PerlSetEnv OCS_OPT_PROLOG_FILTER_ON 0
  PerlSetEnv OCS_OPT_INVENTORY_FILTER_ENABLED 0
  PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP 0
  PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP_CACHE_TIME 300
  PerlSetEnv OCS_OPT_INVENTORY_FILTER_ON 0

  PerlSetEnv OCS_OPT_REGISTRY 1

  PerlSetEnv OCS_OPT_SESSION_VALIDITY_TIME 600
  PerlSetEnv OCS_OPT_SESSION_CLEAN_TIME 86400
  PerlSetEnv OCS_OPT_INVENTORY_SESSION_ONLY 0

  PerlSetEnv OCS_OPT_PROXY_REVALIDATE_DELAY 3600
  PerlSetEnv OCS_OPT_UPDATE 0

  PerlModule Apache::DBI
  PerlModule Compress::Zlib
  PerlModule XML::Simple

  PerlModule Apache::Ocsinventory
  PerlModule Apache::Ocsinventory::Server::Constants
  PerlModule Apache::Ocsinventory::Server::System
  PerlModule Apache::Ocsinventory::Server::Communication
  PerlModule Apache::Ocsinventory::Server::Inventory
  PerlModule Apache::Ocsinventory::Server::Duplicate

  PerlModule Apache::Ocsinventory::Server::Capacities::Registry
  PerlModule Apache::Ocsinventory::Server::Capacities::Update
  PerlModule Apache::Ocsinventory::Server::Capacities::Ipdiscover
  PerlModule Apache::Ocsinventory::Server::Capacities::Download
  PerlModule Apache::Ocsinventory::Server::Capacities::Notify


  <Location /ocsinventory>
        SetHandler perl-script
        PerlHandler Apache::Ocsinventory
  </Location>

  PerlModule Apache::Ocsinventory::SOAP

  <location /ocsinterface>
       SetHandler perl-script
      PerlHandler "Apache::Ocsinventory::SOAP"

  </location>
</IfModule>