• ODOO(ERP源码安装)


    cat /etc/centos-release
    CentOS Linux release 7.4.1708 (Core)
    uname -r
    3.10.0-693.el7.x86_64


    IP:192.168.1.233


    PostgreSQL + Python = GoodERP


    #手动安装:
    groupadd gooderp
    useradd -g gooderp gooderp
    echo "123456" | passwd --stdin gooderp
    usermod -aG wheel gooderp

    #设置gooderp用户权限
    sed -i '/%wheel/agooderp ALL=(ALL) NOPASSWD: ALL' /etc/sudoers

    #下载源码:
    su - gooderp -c "sudo mkdir /source_package"
    su - gooderp -c "cd /source_package && sudo git clone http://github.com/osbzr/gooderp_addons"
    su - gooderp -c "cd /source_package && sudo git clone http://github.com/osbzr/base"
    su - gooderp -c "cd ~ && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash"

    #安装nodejs
    su - gooderp -c "curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash"
    su - gooderp -c "echo export NVM_DIR="$HOME/.nvm" >> ~/.bashrc"
    su - gooderp -c 'echo "[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"" >> ~/.bashrc'
    su - gooderp -c 'echo "[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"" >> ~/.bashrc'
    sleep 3
    su - gooderp -c 'source ~/.bashrc'

    #安装nodejs
    su - gooderp -c 'nvm install --lts'
    #安装less
    su - gooderp -c 'npm install -g less'

    #安装postgresql(使用root用户)
    yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
    #安装服务端
    yum -y install postgresql10-server
    #安装客户端
    yum -y install postgresql10
    #初始化postgresql数据库
    /usr/pgsql-10/bin/postgresql-10-setup initdb
    #启动postgresql
    systemctl start postgresql-10
    #设置开机启动服务
    systemctl enable postgresql-10

    #安装python(pyenv)
    su - gooderp -c 'curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash'
    su - gooderp -c 'echo export PATH="/home/gooderp/.pyenv/bin:$PATH" >> ~/.bashrc'
    su - gooderp -c 'echo eval "$(pyenv init -)" >> ~/.bashrc'
    su - gooderp -c 'echo eval "$(pyenv virtualenv-init -)" >> ~/.bashrc'
    su - gooderp -c 'source ~/.bashrc'
    #安装python
    yum -y install readline-devel zlib-devel bzip2-devel libsqlite3x-devel openssl-devel
    su - gooderp -c 'pyenv install 2.7.14'
    su - gooderp -c 'pyenv global 2.7.14 && pip install --upgrade pip'
    yum -y install libxml2-devel python-devel openldap-devel libxslt libxslt-devel gcc*
    su - gooderp -c 'pip install -r /source_package/base/requirements.txt'
    su - gooderp -c 'pip install simplejson httplib2' #如果这两个没有安装则安装界面会没有css样式

    #安装wkhtmltopdf
    su - gooderp -c 'cd /source_package && sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm'
    su - gooderp -c 'sudo yum -y install /source_package/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm'

    #配置数据库
    echo -e "33[31m自定义建立数据库用户:33[0m"
    echo -e "-d: --createdb 33[31m此角色可以创建新数据库33[0m"
    echo -e "-U: --username=USERNAME 33[31m联接用户(不是要创建的用户名)33[0m"
    echo -e "-R: --no-createrole 33[31m这个角色没有创建其它角色的权限(默认)33[0m"
    echo -e "-S: --no-superuser 33[31m角色不能是超级用户(默认)33[0m"
    echo -e "-P: --pwprompt 33[31m给新角色指定口令33[0m"
    echo -e "33[35mgooderp33[0m 是要在postgres数据库中创建的新用户"
    echo -e "33[34m请牢记自己下来输入的密码33[0m"

    su - postgres -c 'createuser -d -U postgres -R -S -P gooderp'

    #修改两个文件夹的权限不然会报错
    su - gooderp -c 'sudo chown -Rf gooderp.gooderp /source_package/{base,gooderp_addons}'
    #之后启动gooderp
    su - gooderp -c 'cd /source_package/ && python base/odoo-bin --addons-path=gooderp_addons &'

    #注:gooderp用户的密码为123456

     

    VIA: https://www.jianshu.com/p/8e808d65dc43

    脚本安装:(如复制脚本可能会出现编码不对情况,请注意)

    #!/bin/bash
    PID=`echo $$`

    echo -e "33[35m

    该脚本只在CentOS 7.4.1708版本上进行了测试,
    其他Linux发行版本并未进行测试(如Ubuntu、Debian、Mint、Fedora、FreeBSD、SUSE等)
    33[0m
    "
    get_char()
    {
      SAVEDSTTY=`stty -g`
      stty -echo
      stty raw
      dd if=/dev/tty bs=1 count=1 2> /dev/null
      stty -raw

      stty echo
      stty $SAVEDSTTY
    }

    kk=11
    echo "按任意键开始安装....."
    while [ $kk -gt 0 ];do
    echo -n $kk
    sleep 1
    kk=$(($kk - 1))
    echo -ne " "
    done

    char=`get_char`
    if [ $char == 'q' ];then
        kill -9 $PID
    fi


    groupadd gooderp
    useradd -g gooderp gooderp
    echo "123456" | passwd --stdin gooderp
    usermod -aG wheel gooderp

    #设置gooderp用户权限
    sed -i '/%wheel/agooderp ALL=(ALL) NOPASSWD: ALL' /etc/sudoers

    #判断GIT
    which git
    if [ $? -ne 0 ];then
        yum -y install git
    fi
    #下载源码:
    su - gooderp -c "sudo mkdir /source_package"
    su - gooderp -c "cd /source_package && sudo git clone http://github.com/osbzr/gooderp_addons"
    su - gooderp -c "cd /source_package && sudo git clone http://github.com/osbzr/base"
    su - gooderp -c "cd ~ && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash"

    #安装nodejs
    su - gooderp -c "curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash"
    su - gooderp -c "echo export NVM_DIR="$HOME/.nvm" >> ~/.bashrc"
    su - gooderp -c 'echo "[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"" >> ~/.bashrc'
    su - gooderp -c 'echo "[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"" >> ~/.bashrc'
    sleep 3
    su - gooderp -c 'source ~/.bashrc'

    #安装nodejs
    su - gooderp -c 'nvm install --lts'
    #安装less
    su - gooderp -c 'npm install -g less'

    #安装postgresql(使用root用户)
    cd /source_package
    wget https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
    yum -y install pgdg-redhat10-10-2.noarch.rpm
    #安装服务端
    yum -y install postgresql10-server
    #安装客户端
    yum -y install postgresql10
    #初始化postgresql数据库
    /usr/pgsql-10/bin/postgresql-10-setup initdb
    #启动postgresql
    systemctl start postgresql-10
    #设置开机启动服务
    systemctl enable postgresql-10

    #安装python(pyenv)
    su - gooderp -c 'curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash'
    su - gooderp -c 'echo export PATH="/home/gooderp/.pyenv/bin:$PATH" >> ~/.bashrc'
    su - gooderp -c 'echo eval "$(pyenv init -)" >> ~/.bashrc'
    su - gooderp -c 'echo eval "$(pyenv virtualenv-init -)" >> ~/.bashrc'
    su - gooderp -c 'source ~/.bashrc'
    #安装python
    yum -y install readline-devel zlib-devel bzip2-devel libsqlite3x-devel openssl-devel
    su - gooderp -c 'pyenv install 2.7.14'
    su - gooderp -c 'pyenv global 2.7.14 && pip install --upgrade pip'
    yum -y install libxml2-devel python-devel openldap-devel libxslt libxslt-devel gcc*
    su - gooderp -c 'pip install -r /source_package/base/requirements.txt'
    su - gooderp -c 'pip install simplejson httplib2' #如果这两个没有安装则安装界面会没有css样式

    #安装wkhtmltopdf
    su - gooderp -c 'cd /source_package && sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm'
    su - gooderp -c 'sudo yum -y install /source_package/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm'

    #配置数据库
    echo -e "33[31m自定义建立数据库用户:33[0m"
    echo -e "-d: --createdb 33[31m此角色可以创建新数据库33[0m"
    echo -e "-U: --username=USERNAME 33[31m联接用户(不是要创建的用户名)33[0m"
    echo -e "-R: --no-createrole 33[31m这个角色没有创建其它角色的权限(默认)33[0m"
    echo -e "-S: --no-superuser 33[31m角色不能是超级用户(默认)33[0m"
    echo -e "-P: --pwprompt 33[31m给新角色指定口令33[0m"
    echo -e "33[35m gooderp 33[0m是要在postgres数据库中创建的新用户"
    echo -e "33[34m请牢记自己接下来输入的密码33[0m"

    su - postgres -c 'createuser -d -U postgres -R -S -P gooderp'

    #修改两个文件夹的权限不然会报错(以root用户执行)
    chown -Rf gooderp.gooderp /source_package/{base,gooderp_addons}
    #之后启动gooderp
    su - gooderp -c 'cd /source_package/ && python base/odoo-bin --addons-path=gooderp_addons &'

    #postgres Ident 认证设置
    sudo sed -i '/# IPv6 local connections/ihost all all 0.0.0.0/0 md5' /var/lib/pgsql/10/data/pg_hba.conf
    echo "[Service]" >> /usr/lib/systemd/system/gooderp.service
    echo "Type=simple" >> /usr/lib/systemd/system/gooderp.service
    echo "User=gooderp" >> /usr/lib/systemd/system/gooderp.service
    echo "ExecStart=/home/gooderp/.pyenv/versions/2.7.14/bin/python /source_package/base/odoo-bin --addons-path=/source_package/gooderp_addons" >> /usr/lib/systemd/system/gooderp.service
    echo "[Install]" >> /usr/lib/systemd/system/gooderp.service
    echo "WantedBy=multi-user.targe" >> /usr/lib/systemd/system/gooderp.service
    #让配置文件生效
    sudo systemctl daemon-reload
    #开机自启
    sudo systemctl enable gooderp.service

    浏览器访问: IP:8069

    欢迎加入QQ群一起讨论Linux、开源等技术

  • 相关阅读:
    osip状态机分析
    配置tomcat 加载指定的jar
    oracle创建用户并指定表空间
    CentOS7通过rsync+crontab实现两台服务器文件同步
    CentOS7配置MySQL5.7主备
    CentOS7本地安装MySQL5.7
    设置mysql 事务锁超时时间 innodb_lock_wait_timeout
    获取指定年月的第一天与最后一天
    Nginx 反向代理504 Gateway Time-out
    ubuntu下安装配置apache2与php
  • 原文地址:https://www.cnblogs.com/smlile-you-me/p/10458224.html
Copyright © 2020-2023  润新知