OpenERP 5.0.2一体机安装程序对于Ubuntu 8.04.3 LTS(服务器和桌面)
该脚本自动在Ubuntu 8.04.3 LTS(服务器或桌面)上设置openerp-server-5.0.2-0和openerp-client-5.0.2-0&openerp-web-5.0.2-0。 目标是提供OpenERP for Linux的一体化安装程序。
https://www.youcl.com/info/5330
要求
全新安装的Ubuntu 8.04.3 LTS服务器或桌面无Apache和Postgres。 只需要系统的核心,所以在安装Ubuntu Server时,不要选择软件选择菜单( OpenSSH Server
除外)中的LAMP Server
或PostgreSQL Server
进行安装。 此脚本安装Apache和Postgres,并期望处理默认的配置文件。
提示 :从零开始安装Ubuntu 8.04.3 LTS后,在虚拟机中测试此脚本。 在桥接网络中运行虚拟机(主机和guest虚拟机具有相同的子网,并且可以从LAN访问)。
测试:
- Ubuntu 8.04.3 LTS服务器,电脑平台amd64(64位)
- Ubuntu 8.04.3 LTS桌面,电脑平台i386(32位)
使用以下命令将此脚本作为非root用户运行:
$ chmod +x openerp-allinone-setup-5.0.2-0.sh
$ ./openerp-allinone-setup-5.0.2-0.sh
您将被要求:
1)您的URL的DNS名称
2)您的OpenERP Web服务将收听IP地址
3)OpenERP数据库管理员密码
4)Apache SSL的SSL证书设置
附加信息:
- 在运行脚本之前设置您的Ubuntu系统的网络。 通过ping可以从PC /客户端访问。 记下正确的IP地址。
- 运行脚本时,输入以前的IP地址。
- 该脚本仅修改服务器端。 需要在LAN的DNS服务器或PC的主机文件( http://en.wikipedia.org/wiki/Hosts_file )上更新DNS系统。 看看脚本的最后一个重要信息。
- “无效安全证书”错误消息是正确的,因为SSL证书已被创建用于测试目的。
-
/ opt
是下载了.tar.gz文件的工作目录。 - Apache被配置为OpenERP Web的前端,并将所有传入的HTTP流量重定向到HTTPS。
- Ubuntu的防火墙设置为打开以下端口:SSH,HTTP,HTTPS,8069和8070(用于OpenERP GTK客户端的远程访问)。
- 添加openerp-server和openerp-web的启动/初始化脚本。
- Ubuntu 8.04.3 LTS提供与OpenERP 5.0.2兼容的Postgresql 8.3和Python 2.5.2。 OpenERP 5.0.2与Ubuntu 9.04不兼容,作为默认的python 2.4或需要python 2.5(Ubuntu 9.04附带默认的python 2.6)。 Ubuntu 9.04不是LTS(长期支持)。
启动/启动脚本:
- /etc/init.d/openerp-server
- /etc/init.d/openerp-web
该脚本结束指出您的OpenERP网站的URL及其相应的密码。
免责声明:虽然这个新安装程序比在Ubuntu 9.04上为OpenERP Web 5.0.1创建的安装程序更简单,但建议进行 更多的测试 。目前我对初步结果感到满意。 脚本的
内容openerp-allinone-setup-5.0.2-0.sh
:
#!/bin/bash clear stty erase '^?' OSREQUIREMENT=`awk '/Ubuntu 8.04.3 LTS/ {print $0}' /etc/issue` #Ubuntu 8.04.3 LTS \n \l if [ -z "$OSREQUIREMENT" ]; then echo "This program must be executed on Ubuntu Server 8.04.3 LTS" exit 1 fi echo "---------------------------------------------------------------------" echo "Enter DNS name for your URL: " echo "Press ENTER for default one (openerpweb.com)" read url if [ -z "$url" ] then url=openerpweb.com fi echo "\"your DNS name is\" = "$url"" echo "---------------------------------------------------------------------" echo echo "---------------------------------------------------------------------" echo "Modifying /etc/hosts file. Enter your IP address: " echo "Press ENTER for default one (127.0.1.1)" read ipaddrvar if [ -z "$ipaddrvar" ]; then ipaddrvar=127.0.1.1 fi echo "\"your IP address is\" = "$ipaddrvar"" echo "---------------------------------------------------------------------" echo echo "---------------------------------------------------------------------------" echo "Please enter the Administrator Password " echo "You will need to remember this password to administer your OpenERP database" echo "Press ENTER for default one (openerp)" echo "---------------------------------------------------------------------------" read passwvar if [ -z "$passwvar" ]; then passwvar=openerp fi echo "\"your Administrator Password is\" = "$passwvar"" PATH=/usr/bin:/sbin:/bin:/usr/sbin #/usr/sbin/adduser --no-create-home --quiet --system openerp (ubuntu) sudo /usr/sbin/adduser --quiet --system openerp #/usr/sbin/adduser -m -r -s /bin/bash openerp (RHEL) sudo apt-get install wget -y cd /opt sudo wget http://www.openerp.com/download/stable/source/openerp-server-5.0.2-0.tar.gz sudo wget http://www.openerp.com/download/stable/source/openerp-client-5.0.2-0.tar.gz sudo wget http://www.openerp.com/download/stable/source/openerp-web-5.0.2-0.tar.gz sudo tar xvzf openerp-server-5.0.2-0.tar.gz;sudo tar xvzf openerp-client-5.0.2-0.tar.gz;sudo tar xvzf openerp-web-5.0.2-0.tar.gz sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get install -y python python-dev build-essential python-setuptools python-psycopg2 python-reportlab python-egenix-mxdatetime python-xml python-tz python-pychart python-pydot python-lxml python-libxslt1 python-vobject graphviz python-libxml2 python-imaging bzr # openerp-client requirements: sudo apt-get install -y python-gtk2 python-glade2 xpdf # Ubuntu 8.04.3 LTS Server requires xauth binary to remotely display linux applications like openerp-client: sudo apt-get install xauth -y #sudo apt-get install postgresql-8.3 postgresql-client-8.3 pgadmin3 -y sudo apt-get install postgresql-8.3 postgresql-client-8.3 -y #Postgres Database configuration: #sudo vi /etc/postgresql/8.3/main/pg_hba.conf #Replace the following line: ## “local” is for Unix domain socket connections only #local all all ident sameuser #with: ##”local” is for Unix domain socket connections only #local all all md5 sudo sed -i 's/\(local[[:space:]]*all[[:space:]]*all[[:space:]]*\)\(ident[[:space:]]*sameuser\)/\1md5/g' /etc/postgresql/8.3/main/pg_hba.conf #Restart Postgres: sudo /etc/init.d/postgresql-8.3 restart #Create a user account called openerp with password “openerp” and with privileges to create Postgres databases: #sudo su postgres #createuser openerp -P # Enter password for new role: (openerp) # Enter it again: # 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 sudo -u postgres createuser openerp --no-superuser --createdb --no-createrole sudo -u postgres psql template1 -U postgres -c "alter user openerp with password '$passwvar'" cd /opt/openerp-server-5.0.2-0 sudo python setup.py install cd /opt/openerp-client-5.0.2-0 sudo python setup.py install cd /opt/openerp-web-5.0.2-0 sudo python setup.py install cd /opt ##################################################################################### # openerp-server init script ##################################################################################### cat > /tmp/openerp-server <<"EOF" #!/bin/sh ### BEGIN INIT INFO # Provides: openerp-server # Required-Start: $syslog # Required-Stop: $syslog # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Enterprise Resource Management software # Description: OpenERP is a complete ERP and CRM software. ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/openerp-server NAME=openerp-server DESC=openerp-server USER=openerp test -x ${DAEMON} || exit 0 set -e case "${1}" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=/etc/openerp-server.conf echo "${NAME}." ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo echo "${NAME}." ;; restart|force-reload) echo -n "Restarting ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo sleep 1 start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=/etc/openerp-server.conf echo "${NAME}." ;; *) N=/etc/init.d/${NAME} echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 EOF sudo cp /tmp/openerp-server /etc/init.d/ sudo chmod +x /etc/init.d/openerp-server #Create /var/log/openerp with proper ownership: sudo mkdir -p /var/log/openerp sudo touch /var/log/openerp/openerp.log sudo chown -R openerp.root /var/log/openerp/ ##################################################################################### # openerp-server config file ##################################################################################### cat > /tmp/openerp-server.conf <<"EOF2" # /etc/openerp-server.conf(5) - configuration file for openerp-server(1) [options] # Enable the debugging mode (default False). #verbose = True # The file where the server pid will be stored (default False). #pidfile = /var/run/openerp.pid # The file where the server log will be stored (default False). logfile = /var/log/openerp/openerp.log # The IP address on which the server will bind. # If empty, it will bind on all interfaces (default empty). #interface = localhost interface = # The TCP port on which the server will listen (default 8069). port = 8069 # Enable debug mode (default False). #debug_mode = True # Launch server over https instead of http (default False). secure = False # Specify the SMTP server for sending email (default localhost). smtp_server = localhost # Specify the SMTP user for sending email (default False). smtp_user = False # Specify the SMTP password for sending email (default False). smtp_password = False # Specify the database name. db_name = # Specify the database user name (default None). db_user = openerp # Specify the database password for db_user (default None). db_password = # Specify the database host (default localhost). db_host = # Specify the database port (default None). db_port = 5432 EOF2 sudo cp /tmp/openerp-server.conf /etc/ sudo chown openerp.root /etc/openerp-server.conf sudo chmod 640 /etc/openerp-server.conf sudo sed -i "s/db_password =/db_password = $passwvar/g" /etc/openerp-server.conf ##################################################################################### # openerp-web init script ##################################################################################### sudo cp /usr/lib/python2.5/site-packages/openerp_web-5.0.2_0-py2.5.egg/scripts/openerp-web /etc/init.d/ sudo chmod +x /etc/init.d/openerp-web sudo cp /usr/lib/python2.5/site-packages/openerp_web-5.0.2_0-py2.5.egg/config/openerp-web.cfg /etc/ #ln -s /usr/lib/python2.5/site-packages/openerp_web-5.0.2_0-py2.5.egg/config/openerp-web.cfg /etc/openerp-web.cfg sudo chown openerp.root /etc/openerp-web.cfg sudo chmod 640 /etc/openerp-web.cfg #Create /var/log/openerp-web.log with proper ownership: sudo mkdir -p /var/log/openerp-web sudo touch /var/log/openerp-web/access.log sudo touch /var/log/openerp-web/error.log sudo chown -R openerp.root /var/log/openerp-web/ #Now run following command to start the OpenERP Web automatically on system startup (Debian/Ubuntu): sudo update-rc.d openerp-server start 21 2 3 4 5 . stop 21 0 1 6 . sudo update-rc.d openerp-web start 70 2 3 4 5 . stop 20 0 1 6 . ############################################################################################ #HTTPS and Proxy with Apache sudo apt-get -y install apache2 ############################################################################################ # /etc/apache2/sites-available/default-ssl (Available in Ubuntu9.04, but not in Ubuntu8.04) # apache2-ssl-certificate script/package is missing in Ubuntu8.04 ############################################################################################ cat > /tmp/default <<"EOF3" NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName openerpweb.com Redirect / https://openerpweb.com/ DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> EOF3 sudo cp /tmp/default /etc/apache2/sites-available/default sudo chown root.root /etc/apache2/sites-available/default sudo chmod 644 /etc/apache2/sites-available/default cat > /tmp/default-ssl <<"EOF4" NameVirtualHost *:443 <VirtualHost *:443> ServerName openerpweb.com ServerAdmin webmaster@localhost #DocumentRoot /var/www/ SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem <Proxy *> Order deny,allow Allow from all </Proxy> ProxyRequests Off ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ErrorLog /var/log/apache2/error-ssl.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access-ssl.log combined ServerSignature On </VirtualHost> EOF4 sudo cp /tmp/default-ssl /etc/apache2/sites-available/default-ssl sudo chown root.root /etc/apache2/sites-available/default-ssl sudo chmod 644 /etc/apache2/sites-available/default-ssl sudo mkdir /etc/apache2/ssl sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem # Apache Modules: sudo a2enmod ssl # We enable default-ssl site after creating "/etc/apache2/sites-available/default-ssl" file (not available in Ubuntu8.04) sudo a2ensite default-ssl sudo a2enmod rewrite sudo a2enmod suexec sudo a2enmod include sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod proxy_connect sudo a2enmod proxy_ftp #Add your server’s IP address and URL in /etc/hosts: # $ sudo vi /etc/hosts #Replace # 127.0.0.1 localhost # 127.0.0.1 yourhostname yourhostnamealias #With # # 127.0.0.1 localhost # 192.168.x.x openerpweb.com yourhostname yourhostnamealias sudo sed -i "s/\(^127\.0\.1\.1[[:space:]]*\)\([[:alnum:]].*\)/#\0\n$ipaddrvar $url \2/g" /etc/hosts sudo sed -i "s/openerpweb\.com/$url/g" /etc/apache2/sites-available/default sudo sed -i "s/openerpweb\.com/$url/g" /etc/apache2/sites-available/default-ssl sudo /etc/init.d/apache2 restart # FIREWALL: sudo ufw enable sudo ufw allow ssh sudo ufw allow http sudo ufw allow https # OpenERP port (GTK client): sudo ufw allow 8069/tcp # OpenERP port (GTK client): sudo ufw allow 8070/tcp sudo /etc/init.d/openerp-server start sudo /etc/init.d/openerp-web start clear echo echo "------------------------------------------------------------------------------------------------------------------------------------------------" echo " THE REMAINING STEPS CAN BE CONFIGURED FROM THE WEB INTERFACE (OPENERP WEB)" echo echo " 1. Register the DNS Name \"$url\" with its corresponding IP address ($ipaddrvar)." echo " \"$url\" is the external URL of OpenERP Web. Make sure this URL is reachable by your Web clients (Open ERP users)" echo " In Linux this can be done locally by adding the following line to /etc/hosts file:" echo echo " $ipaddrvar $url" echo echo " The hosts file is located in different locations in different operating systems and versions: \"http://en.wikipedia.org/wiki/Hosts_file\"" echo " The hosts file is a computer file used to store information on where to find a node on a computer network. " echo " This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or a replacement of) the Domain Name System (DNS) on " echo " networks of varying sizes. Unlike DNS, the hosts file is under the control of the local computer's administrator" echo echo " 2. Your OpenERP Web Service can now be reached with a web browser at: \"http://$url\"" echo echo " 3. WELCOME TO OPENERP: -> Click on \"Databases\" -> CREATE A NEW DATABASE:" echo " 3.1 Super Administrator Password: admin" echo " 3.2 New Name of the database: xxx " echo " 3.3 Load Demo Data (y/n)" echo " 3.4 Default language: ... " echo " 3.5 Administrator Password: $passwvar" echo " 3.6 Confirm Administrator Password: $passwvar" echo echo " 4. WELCOME TO OPENERP:" echo " 4.1 Database: xxx " echo " 4.2 Administrator Username: admin " echo " 4.3 Administrator Password: $passwvar" echo " 4.4 Click on \"Login\"" echo echo " 5. INSTALLATION & CONFIGURATION. You will now be asked to install and configure modules and users required by your Enterprise" echo " 5.1 Click on \"Logout\"" echo echo " 6. WELCOME TO OPENERP: You can now log in with the following users" echo " 6.1 User \"demo\" / Password \"demo\", in case you clicked on \"Load Demo Data\"" echo " 6.2 User \"admin\" / Password \"$passwvar\"" echo " 6.3 Users created by you during step #4" echo "------------------------------------------------------------------------------------------------------------------------------------------------" echo " Notes:" echo " * OpenERP GTK Client can be run as non-root with the command \"openerp-client\"" echo " (Make sure you enable X11 Forwarding on your SSH remote session)" echo " * Ports 8069 & 8070 are open for remote access of OpenERP GTK clients " echo
以前的脚本和相关内容可以在http://opensourceconsulting.wordpress.com/2009/08/13/openerp-allinone-setup-5-0-2-0-sh/找到。