Visualizzazione post con etichetta Webservice. Mostra tutti i post
Visualizzazione post con etichetta Webservice. Mostra tutti i post

giovedì 14 giugno 2012

Migrate PhpBB3 on Ubuntu server

PhpBB version: 3.0.9
Backend: Mysql
Mode: Fcgi



Dump the database

ubuntu~# mysqldump -u root -p phpbb3 > /tmp/phpbb3.sql


On the new machine

new~# apt-get update && apt-get install phpbb3


During the installation, choose to configure mysql/phpbb3 via debconf and answer about passwords in this order
* Mysql root password
* Phpbb3 database password
* Phpbb3 admin interface password

Afterwords, setup the web server. You have a configuration example in /etc/phpbb3/apache2.conf; you can directly copy this file in your /etc/apache2/sites-available directory and run

new:/etc/phpbb3# cp apache2.conf /etc/apache2/sites-available/phpbb3
new:/etc/phpbb3# cd /etc/apache2/sites-available/
new:/etc/apache2/sites-available# a2ensite phpbb3 && service apache2 reload


Try to login and surf the admin interface (APC). If you had a custom theme in the previous server, do the follow:

ubuntu~# scp -r /srv/phpbb3/theme/ (or wherever it is) new:/usr/share/phpbb3/styles


Important , make a sym link in /etc/phpbb3/styles directory to make phpbb see the custom theme

new~# cd /etc/phpbb3/styles
new:/etc/phpbb3/styles# ln -s /usr/share/phpbb3/styles/theme theme


Once the link is ok, configure the new theme in the APC (administrative panel)

If everything seems to be fine, move on and restore the database

new~# mysql -u root -p phpbb3 < phpbb3.sql


Configure FCGI

new~# apt-get install php5-cgi
new~# cd /etc/apache2/
new:/etc/apache2/# a2dismod php5
new:/etc/apache2/# service apache2 restart


Setup fcgi environment

new~# cd /srv (or wherever you'll locate it)
new:/srv# mkdir php-fcgi
new:/srv# cd (alt+.)
new:/srv/php-fcgi# ls
phpbb.fcgi
phpbbrc -> /etc/php5/cgi/


phpbb.fcgi

#!/bin/sh
PHP_FCGI_MAX_REQUESTS=10000
PHP_FCGI_CHILDREN=0
export PHPRC=/srv/php-fcgi/php53rc
export PHP_FCGI_MAX_REQUESTS PHP_FCGI_CHILDREN
# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/bin/php-cgi


NOTE: phpbbrc is a link to /etc/php5/cgi/ directory

The virtualhost section should be something like

<VirtualHost *:80>
    ServerName forum.example.org
    DocumentRoot /usr/share/phpbb3/www
    ErrorLog /var/log/apache2/forum_error.log
    CustomLog /var/log/apache2/forum_access.log combined
    Alias / /usr/share/phpbb3/www/

   <Directory>
      Order allow,deny
      Allow from all
      Options +ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper /srv/php-fcgi/phpbb.fcgi .php
   </Directory>
</VirtualHost>



Try to load a forum page and check with

new~# ps ax | grep cg[i]
2248 ? S 0:00 /usr/bin/php-cgi


that php-cgi is running ..

lunedì 28 novembre 2011

OpenERP 6 on Fedora 15

postgresql installation


[fedora@lovelock ~]$ sudo yum install postgresql-server postgresql-libs postgresql



Initialize postgresql db and start the daemon:


[fedora@lovelock ~]$ /etc/init.d/postgresql initdb
Initializing database:                                     [  OK  ]
[fedora@lovelock ~]$ /etc/init.d/postgresql start
Starting postgresql (via systemctl):                       [  OK  ]



postgresql user
Become postgres and create the db user:


[fedora@lovelock]$ su - postgres
-bash-4.2$ createuser openerp
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n



openerp user and environment
Create openerp system user and give a him a password:


[fedora@lovelock]$ sudo adduser --system openerp
[fedora@lovelock]$ sudo passwd openerp
Changing password for user openerp.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.



Create the OpenERP release directory:


[fedora@lovelock]$ su openerp -c mkdir /home/openerp/6



setup and test the server
Download the server tarball and unpack it:


[fedora@lovelock]$ su - openerp
[openerp@lovelock]$ cd 6
[openerp@lovelock]$ wget http://www.openerp.com/download/stable/source/openerp-server-6.0.0.tar.gz
[openerp@lovelock]$ tar xvf openerp-server-6.0.0.tar.gz


Install dependencies for the server:


[fedora@lovelock]$ sudo yum install python-lxml.i686 python-mako python-dateutil python-psycopg2 pychart pydot pytz python-vobject python-reportlab PyYAML python-imaging




NOTE: to generally test openerp releases, you don't need to perform a complete installation. Inside the /bin directory, in the untarred openerp archive, you can run "opnenerp-server.py". Running openerp-server.py will also notify you for every missing dependence.



[openerp@lovelock]$ cd openerp-server-6.0.0/bin
[openerp@lovelock]$ ./openerp-server.py"
...
[2011-11-18 17:07:43,573][?] INFO:server:OpenERP version - 6.0.0
[2011-11-18 17:07:43,574][?] INFO:server:addons_path - /home/openerp/6/openerp-server-6.0.0/bin/addons
[2011-11-18 17:07:43,575][?] INFO:server:database hostname - localhost
[2011-11-18 17:07:43,576][?] INFO:server:database port - 5432
[2011-11-18 17:07:43,577][?] INFO:server:database user - openerp
[2011-11-18 17:07:43,578][?] INFO:server:initialising distributed objects services
[2011-11-18 17:07:43,940][?] INFO:web-services:starting HTTP service at 0.0.0.0 port 8069
[2011-11-18 17:07:43,944][?] INFO:web-services:starting HTTPS service at 0.0.0.0 port 8071
[2011-11-18 17:07:43,946][?] INFO:web-services:Registered XML-RPC over HTTP
[2011-11-18 17:07:43,948][?] INFO:web-services:starting NET-RPC service at 0.0.0.0 port 8070
[2011-11-18 17:07:43,950][?] INFO:server:Starting 3 services
[2011-11-18 17:07:43,952][?] INFO:server:OpenERP server is running, waiting for connections...



..ctrl+c to exit the test.

install the server


[fedora@lovelock]$ su - root
[root@lovelock]# yum install python-setuptools
[root@lovelock]# cd /home/openerp/6/openerp-server-6.0.0
[root@lovelock]# python setup.py install
...
copying doc/migrate/3.4.0-4.0.0/post-tiny.py -> /usr/share/doc/openerp-server-6.0.0/migrate/3.4.0-4.0.0
running install_egg_info
Copying openerp_server.egg-info to /usr/lib/python2.7/site-packages/openerp_server-6.0.0-py2.7.egg-info
running install_scripts
copying build/scripts-2.7/openerp-server -> /usr/bin
changing mode of /usr/bin/openerp-server to 755
[root@lovelock]#



Copy the configuration file for the server:


[root@lovelock]# cp doc/openerp-server.conf /etc/openerp-server.cfg
[root@lovelock]# chown openerp.openerp /etc/openerp-server.cfg



setup and test the client
Install client dependencies:


[fedora@lovelock]$ sudo yum install python-lxml.i686 python-mako python-dateutil python-psycopg2 pychart pydot pytz python-vobject python-reportlab PyYAML python-imaging pygtk2 glade2 python-matplotlib python-dateutil pytz pydot hippo-canvas-python mx-devel python-imaging


Download openerp-client tarball and untar it:


[fedora@lovelock]$ su - openerp
[openerp@lovelock]$ cd 6
[openerp@lovelock]$ wget http://www.openerp.com/download/stable/source/openerp-client-6.0.0.tar.gz
[openerp@lovelock]$ tar xvf openerp-client-6.0.0.tar.gz



Test openerp-client:


[openerp@lovelock]$ cd openerp-client-6.0.0/bin
[openerp@lovelock]$ python openerp-client.py



install the client


[fedora@lovelock]$ su - root
[root@lovelock]# cd /home/openerp/6/openerp-client-6.0.0
[root@lovelock]# python setup.py install



setup and test openerp-web
OpenERP-web dependencies:


yum install python-cherrypy python-formencode python-babel



Download OpenERP-web tarball and unpack it:


[fedora@lovelock]$ su - openerp
[openerp@lovelock]$ cd 6
[openerp@lovelock]$ wget http://www.openerp.com/download/stable/source/openerp-web-6.0.0.tar.gz
[openerp@lovelock]$ tar xvf openerp-web-6.0.0.tar.gz



Run OpenERP-web:


[openerp@lovelock]$ cd openerp-web-6.0.0
[openerp@lovelock]$ python openerp-web.py
[21/Nov/2011:05:12:44] ENGINE Bus STARTING
[21/Nov/2011:05:12:44] ENGINE Started monitor thread '_TimeoutMonitor'.
[21/Nov/2011:05:12:44] ENGINE Started monitor thread 'Autoreloader'.
[21/Nov/2011:05:12:44] ENGINE Serving on 0.0.0.0:8080
[21/Nov/2011:05:12:44] ENGINE Bus STARTED



install openerp-web


[openerp@lovelock]$ su - root
[root@lovelock]# cd /home/openerp/6/openerp-web-6.0.0
[root@lovelock]# python setup.py install
...
Using /usr/lib/python2.7/site-packages
Finished processing dependencies for openerp-web==6.0.0



Put the openerp-web configuration file in /etc:


[root@lovelock]# cp doc/openerp-web.cfg /etc
[root@lovelock]# chown openerp.openerp /etc/openerp-web.cfg



Uncomment log section:


[root@lovelock]# vim /etc/openerp-web.cfg
change:
...
#log.access_file = "/var/log/openerp-web/access.log"
#log.error_file = "/var/log/openerp-web/error.log"
...
to:
...
log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"
...



Create openerp log files dir:


[root@lovelock]# mkdir /var/log/openerp-web
[root@lovelock]# chown openerp.openerp /var/log/openerp-web



init scripts
I've found these scripts on-line, optimized for CentOS Linux, so thanks to the author for avoid me to rewrite both from scratch. I've made few modifications there, and now they works on Fedora.

Put these files in /etc/init.d/ directory and give "x" permissions to the both.

Download (right mouse click and "Save link as..."):


openerp-server
openerp-web




[root@lovelock]# cd /etc/init.d/
[root@lovelock]# wget http://www.simoneroselli.eu/files/2011/11/openerp-server.txt
[root@lovelock]# wget http://www.simoneroselli.eu/files/2011/11/openerp-web.txt



[root@lovelock]# mv openerp-server.txt openerp-server
[root@lovelock]# mv openerp-web.txt openerp-web



[root@lovelock]# chmod +x openerp-*



Make pid directory for the daemons:


[root@lovelock]# mkdir /var/run/openerp
[root@lovelock]# chown openerp.openerp /var/run/openerp



Start the daemons


[root@lovelock]# /etc/init.d/openerp-server start
[root@lovelock]# /etc/init.d/openerp-web start