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[35mgooderp 33[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等)