-
-
Save qa1/e61ff8abc5499555ecae0f305383d8af to your computer and use it in GitHub Desktop.
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MySql, MongoDB, PhpMyAdmin, Git, Node.js, Bower, Gulp, Docker, Composer(with asset plugin), Dnsmasq)
This file contains hidden or 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/bash | |
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process." | |
read USERNAME | |
if [ -z "$USERNAME" ] ; then | |
echo "Exiting... Done." | |
exit | |
else | |
echo "Adding user to 'sudo' group..." | |
sudo usermod -aG sudo $USERNAME | |
echo "Adding needed repos" | |
sudo add-apt-repository ppa:ondrej/php | |
echo "Initializing script..." | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
echo "Addin apt fast" | |
sudo add-apt-repository ppa:apt-fast/stable | |
sudo apt-get update | |
sudo apt-get -y install apt-fast | |
echo "Installing Nginx..." | |
sudo apt-fast install -y nginx | |
echo "Adding rule to 'ufw' firewall" | |
sudo ufw allow 'Nginx HTTP' | |
echo "Installing MySQL..." | |
sudo apt-fast install -y mysql-server | |
# sudo mysql_secure_installation | |
echo "Installing PHP 7 and its components: [cli,common,fpm,curl,gd, intl,zip,xsl,mbstring,mysql]..." | |
sudo apt-fast install -y php7.0-cli | |
sudo apt-fast install -y php7.0-common | |
sudo apt-fast install -y php7.0 | |
sudo apt-fast install -y php7.0-fpm | |
sudo apt-fast install -y php7.0-curl | |
sudo apt-fast install -y php7.0-gd | |
sudo apt-fast install -y php7.0-intl | |
sudo apt-fast install -y php7.0-zip | |
sudo apt-fast install -y php7.0-xsl | |
sudo apt-fast install -y php7.0-mbstring | |
sudo apt-fast install -y php7.0-mysql | |
# required by phpmyadmin | |
sudo apt-fast install -y php-gettext | |
# required for installing xdebug | |
sudo apt-fast install -y php7.0-dev | |
# PhpMyAdmin | |
echo "Installing PhpMyAdmin..." | |
sudo apt-fast install phpmyadmin | |
mkdir -p /var/www/localhost | |
sudo ln -s /usr/share/phpmyadmin/ /var/www/localhost/pma | |
echo "Configuring PHP..." | |
sudo sed -i s/\;cgi\.fix_pathinfo\s*\=\s*1/cgi.fix_pathinfo\=0/ /etc/php/7.0/fpm/php.ini | |
# Composer | |
echo "Installing Composer..." | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer | |
echo "Installing Composer Asset plugin..." | |
sudo composer global require "fxp/composer-asset-plugin:~1.1" | |
echo "Installing Dnsmasq..." | |
sudo apt-fast install dnsmasq | |
echo "Pointing all *.dev domains to 127.0.0.1" | |
echo "address=/.dev/127.0.0.1" >> /etc/dnsmasq.conf | |
sudo /etc/init.d/dnsmasq restart | |
echo "Restarting PHP, Nginx and MySQL services..." | |
sudo /etc/init.d/php7.0-fpm restart | |
sudo /etc/init.d/nginx restart | |
sudo /etc/init.d/mysql restart | |
echo "Installing MongoDB..." | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 | |
sudo echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list | |
sudo apt-fast update | |
sudo apt-fast install -y --allow-unauthenticated mongodb-org | |
sudo echo '[Unit] | |
Description=High-performance, schema-free document-oriented database | |
After=network.target | |
[Service] | |
User=mongodb | |
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf | |
[Install] | |
WantedBy=multi-user.target' > /etc/systemd/system/mongodb.service | |
sudo systemctl start mongodb | |
sudo systemctl status mongodb | |
sudo systemctl enable mongodb | |
echo "Installing GIT..." | |
sudo apt-fast install -y git | |
echo "Installing Node.js" | |
sudo apt-fast install -y nodejs | |
sudo ln -s /usr/bin/nodejs /usr/bin/node | |
sudo apt-fast install -y build-essential | |
sudo apt-fast install -y npm | |
sudo ln -s /usr/bin/nodejs /usr/bin/node | |
echo "Installing Bower..." | |
sudo npm install -g bower | |
echo "Installing Gulp..." | |
sudo npm install -g gulp | |
echo "Installing Grunt..." | |
sudo npm install -g grunt-cli | |
echo "Installing DOCKER..." | |
sudo apt-fast update | |
sudo apt-fast install -y apt-transport-https ca-certificates | |
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >> /etc/apt/sources.list.d/docker.list | |
sudo apt-fast update | |
sudo apt-fast purge -y lxc-docker | |
sudo apt-cache policy docker-engine | |
sudo apt-fast update | |
sudo apt-fast install -y linux-image-extra-$(uname -r) | |
sudo apt-fast install -y docker-engine | |
echo "Adding user to 'docker' group..." | |
sudo usermod -aG docker $USERNAME | |
echo "Starting docker service..." | |
sudo /etc/init.d/docker start | |
echo "Testing docker..." | |
sudo docker run hello-world | |
echo "Removing unneeded dependencies" | |
sudo apt-fast autoremove | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment