Last active
October 22, 2021 05:02
-
-
Save hersonls/5362498 to your computer and use it in GitHub Desktop.
How to install Django+Supervisor+Gunicorn+Nginx in a Ubuntu Server.Needed to adjust append settings, like append virtualenvwrapper settings in user .profile file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Update packages | |
apt-get update | |
# Installing services | |
echo "==============================" | |
echo "Install web services" | |
echo "==============================" | |
apt-get -y install nginx supervisor | |
# Installing environment apps | |
echo "==============================" | |
echo "Install env apps" | |
echo "==============================" | |
apt-get -y install git python-pip python-dev nodejs npm openjdk-6-jre | |
# Installing tools | |
echo "==============================" | |
echo "Install tools" | |
echo "==============================" | |
apt-get -y install vim | |
# Optionals | |
echo "==============================" | |
echo "Install PostgreSQL" | |
echo "==============================" | |
apt-get -y install postgresql-client postgresql postgresql-contrib | |
# echo "==============================" | |
# echo "Install MySQL" | |
# echo "==============================" | |
# apt-get -y install mysql-server libmysqlclient-dev phpmyadmin | |
# Configure locale pt_BR | |
locale-gen --no-purge --lang pt_BR | |
# Adding supervisor settings to handle configuration files at project root path. | |
echo "files = /home/*/*/*/supervisor.conf ; look for configuration in /home/<user_home>/<domain>/<project_name>/supervisor.conf" >> /etc/supervisor/supervisord.conf | |
# Change apache default port | |
sed -i.orig s/80/8080/g /etc/apache2/ports.conf | |
service apache2 restart | |
# Configure node | |
ln -s /usr/bin/nodejs /usr/bin/node | |
# JPEG, ZLIB, FREETYPE2, LITTLECMS | |
sudo -y apt-get install libjpeg-dev libpng-dev zlib1g-dev liblcms1-dev python-dev | |
# Configuring JPEG, ZLIB, FREETYPE2, LITTLECMS | |
sudo ln -s /usr/lib/$(uname -p)-linux-gnu/libfreetype.so /usr/lib/ | |
sudo ln -s /usr/lib/$(uname -p)-linux-gnu/libz.so /usr/lib/ | |
sudo ln -s /usr/lib/$(uname -p)-linux-gnu/libjpeg.so /usr/lib/ | |
sudo ln -s /usr/lib/$(uname -p)-linux-gnu/liblcms.so /usr/lib/ | |
# Install virstualenvwrapper | |
sudo pip install virtualenvwrapper | |
cat >>/etc/skel/.profile <<EOF | |
# Virtualenvwrapper Settings | |
export WORKON_HOME=~/.virtualenvs | |
source /usr/local/bin/virtualenvwrapper.sh | |
EOF | |
mkdir /etc/skel/logs | |
# Security | |
apt-get -y install fail2ban | |
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment