Environment Ubuntu16+nginx+python2.7.12+postgresql9.5+odoo 10.0 Community
#!/bin/bash#author:[email protected] #date: 2017-09-06#description: Deploying Odoo 10.0 Shell Ubuntu >=14odoo_options =gevent-c/usr/local/odoo/odoo.configodoo_parent_path=/usr/local odoo_path=/usr/local/odoosvc_odoo_user_name= odoosvc_nginx_user_name=nginxodoo_config_path= $odoo _path+/odoo.configodoo_pwd=123456echo ' =================== Create user Odoo for Odoo serivce================== ' sudo useradd $svc _odoo_user_namesudo passwd $svc _odoo_user_nameecho ' ===================create user nginx for nginx======================== ' sudo useradd $svc _nginx_user_namesudo passwd $ Svc_nginx_user_nameecho ' ===================install soft gcc,git,nginx.......=================== ' sudo apt-get Updatesudo apt-get install gcc git nginx postgresql python python-dev libxml2-dev libxslt-dev Zlib1g-dev Libldap2-dev Lib Sasl2-devecho ' ===================git check out Odoo source code ... ================= ' sudo rm-rf $odoo _pathsudo mkdir $odoo _pathsudo git clone https://github.com/odoo/odoo.git $odoo _pathechO ' =================== pip install-r requirements.txt===================== ' sudo pip install-r $odoo _path/requirements . Txtsudo apt-get install-y npmsudo ln-s/usr/bin/nodejs/usr/bin/nodesudo npm install-g lessecho ' ====================c Onfig PostgreSQL user info.....=================== ' sudo su-postgres psql-c ' createuser-s-p-l-e Odoo ' echo ' ======== ==========create odoo.config================================== ' #修改文件夹权限sudo chmod o+rw/var/libsudo chmod o+rw/var/ Logsudo cat> $odoo _path/odoo.config<<eof[options]addons_path =/usr/local/odoo/odoo/addons,/usr/local/ ODOO/ADDONSADMIN_PASSWD = Admincsv_internal_sep =, Data_dir =/var/lib/odoodb_host = Falsedb_maxconn = 64db_name = Falsedb _password = $odoo _pwddb_port = falsedb_template = Template1db_user = $svc _odoo_user_namedbfilter =. *demo = {}email_from = Falsegeoip_database =/usr/share/geoip/geolitecity.datimport_partial =limit_memory_hard = 2684354560limit_memory_ Soft = 2147483648limit_request = 8192limit_time_cpu = 60limit_time_real = 120limit_time_real_cron = -1list_db = truelog_db = Falselog_db_level = Warninglog_handler =: INFOlo G_level = Infologfile =/var/log/odoo/log.txtlogrotate = Falselongpolling_port = 8072max_cron_threads = 2osv_memory_age_ Limit = 1.0osv_memory_count_limit = Falsepg_path = Nonepidfile = Noneproxy_mode = Falsereportgz = Falseserver_wide_modules = Web,web_kanbansmtp_password = Falsesmtp_port = 25smtp_server = Localhostsmtp_ssl = Falsesmtp_user = Falsesyslog = False Test_commit = falsetest_enable = Falsetest_file = Falsetest_report_directory = Falsetranslate_modules = [' all ']unaccent = Falsewithout_demo = Falseworkers = 0xmlrpc = Truexmlrpc_interface =xmlrpc_port = 8069eof# Configure Odoo service echo ' ================= ==========config odoo.service======================= ' sudo mkdir/usr/lib/systemd/systemsudo cat>/usr/lib/ Systemd/system/odoo.service<<eof[unit]description=odooafter=postgresql.service[service]type=simpleuser= Odoogroup=odooexecstart=/usr/local/odoo/odoo-bin $odoo_options[install]wantedby=multi-user.targeteofecho ' ================================enble odoo.service========== ========== ' sudo systemctl daemon-realodsudo systemctl enable/usr/lib/systemd/system/odoo.serviceecho ' ============= ===================restart odoo.service================== ' sudo systemctl restart Odoo.servicesudo systemctl status odoo.service# configuration nginx# First backup echo ' ===============================config nginx========================== ' sudo rename/ etc/nginx/nginx.conf/etc/nginx_conf_backuphttp_host= ' $http _host ' remote_addr= ' $remote _addr ' scheme= ' $scheme ' http _upgrade= ' $http _upgrade ' sudo cat>/etc/nginx/nginx.conf<<eof worker_processes 2; events {use epoll; worker_connections 65535;} http {include mime.types; Default_type Application/octet-stream; sendfile On Server_tokens off; Keepalive_timeout 10; Tcp_nodelay on; gzip on; Upstream slist{server 127.0.0.1:8072;} server {listen; server_name localhost; location/{Proxy_pass_header server; Proxy_set_header Host $http _Host Proxy_redirect off; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header X-scheme $scheme; Proxy_http_version 1.1; Proxy_set_header Upgrade $http _upgrade; Proxy_set_header Connection "Upgrade"; Proxy_pass http://slist; client_max_boy_size:20m; }}}eofsudo systemctl daemon-realod# backup Sites-availablesudo cp/etc/nginx/sites-available/default/home/$svc _nginx_ User_name/sites-available_defaultsudo rm-rf/etc/nginx/sites-available/default# resolving failed to read PID from File/run/ngi Nx.pid:Invalid argumentsudo mkdir-p/etc/systemd/system/nginx.service.d printf "[Service]\nexecstartpost=/bin/sleep 0.1\n ">/etc/systemd/system/nginx.service.d/override.confsudo systemctl daemon-realodsudo nginx-s Reloadsudo Systemctl Restart Nginx.servicesudo systemctl status Nginx.service
Odoo 10 deployment Shell to be improved