Skip to content

Instantly share code, notes, and snippets.

@thomich
Last active December 21, 2017 12:24
Show Gist options
  • Save thomich/312f32c047eae5113e07cb3470f689df to your computer and use it in GitHub Desktop.
Save thomich/312f32c047eae5113e07cb3470f689df to your computer and use it in GitHub Desktop.
Install Flectra On Ubuntu 16.04 LTS
#!/bin/bash
sudo adduser --system --quiet --shell=/bin/bash --home=/home/flectra --gecos 'flectra' --group flectra
sudo passwd flectra
sudo usermod -a -G adm,sudo flectra
sudo mkdir /etc/flectra && sudo mkdir /opt/flectra && sudo mkdir /var/log/flectra/
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install postgresql postgresql-server-dev-9.5 build-essential python3-pillow python3-lxml python-ldap3 python3-dev python3-pip python3-setuptools npm nodejs git gdebi libldap2-dev libsasl2-dev libxml2-dev libxslt1-dev libjpeg-dev zlib1g-dev -y
sudo git clone --depth=1 --branch=master https://github.com/flectrahq/flectra.git /opt/flectra/server
sudo chown flectra:flectra /opt/flectra/ -R && sudo chown flectra:flectra /var/log/flectra/ -R && cd /opt/flectra/server && sudo pip3 install -r requirements.txt
sudo npm install -g less less-plugin-clean-css -y && sudo ln -s /usr/bin/nodejs /usr/bin/node
cd /tmp && wget https://downloads.wkhtmltopdf.org/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && sudo gdebi -n wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && rm wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/ && sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/
wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && sudo gunzip GeoLiteCity.dat.gz && sudo mkdir /usr/share/GeoIP/ && sudo mv GeoLiteCity.dat /usr/share/GeoIP/
sudo su - postgres -c "createuser -sP flectra1"
sudo su - flectra -c "/opt/flectra/server/flectra-bin --addons-path=/opt/flectra/server/addons -s --stop-after-init"
sudo mv /home/flectra/.flectrarc /etc/flectra/flectra-server.conf
sudo sed -i "s,^\(logfile = \).*,\1"/var/log/flectra/flectra-server.log"," /etc/flectra/flectra-server.conf
sudo sed -i "s,^\(logrotate = \).*,\1"True"," /etc/flectra/flectra-server.conf
sudo sed -i "s,^\(proxy_mode = \).*,\1"True"," /etc/flectra/flectra-server.conf
sudo cp /opt/flectra/server/debian/init /etc/init.d/flectra-server && sudo chmod +x /etc/init.d/flectra-server
#sudo ln -s /opt/flectra/server/flectra-bin /usr/bin/flectra
sudo update-rc.d -f flectra-server defaults
sudo service flectra-server start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment