Skip to content

Instantly share code, notes, and snippets.

@matbrgz
Last active April 4, 2021 04:24
Show Gist options
  • Save matbrgz/f58d7468ae90ef33aac32693fab668ba to your computer and use it in GitHub Desktop.
Save matbrgz/f58d7468ae90ef33aac32693fab668ba to your computer and use it in GitHub Desktop.
#!/bin/bash
# Author: MatheusRV
# Source:
# License:
# Instructions:
#Bash Config
#vi .bash_aliases.
#export PATH=~/.composer/vendor/bin:$PATH.
#source .bashrc.
# Init
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade
sudo apt-get install -y software-properties-common python-software-properties build-essential curl jq libnss3-tools libssl-dev ca-certificates
#Apache2
sudo apt-get -y install apache2
#Config for Dev folder
sudo rm -f /etc/apache2/sites-available/000-default.conf
sudo bash -c 'echo "<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /mnt/d/Cloud/OneDrive/Dev
<Directory /mnt/d/Cloud/OneDrive/Dev>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>" >> /etc/apache2/sites-available/000-default.conf'
sudo /etc/init.d/apache2 restart
#Allowing rewrite rules
sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart
#Allow autoindex for editing apache directory listing
sudo a2enmod autoindex
#Instaling a new theme for apache directory listing
wget https://github.com/AdamWhitcroft/Apaxy/archive/master.tar.gz && sudo tar -xvzf master.tar.gz && sudo cp -r apaxy-master /mnt/d/Cloud/OneDrive/Dev/apaxy-master $$ rm -f -R apaxy-master
sudo bash -c 'echo "" >> /mnt/d/Cloud/OneDrive/Dev/.htaccess'
# Hiding Error [core:warn] Protocol not available: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT - https://github.com/Microsoft/WSL/issues/1953
sudo bash -c 'echo "AcceptFilter https none
AcceptFilter http none" >> /etc/apache2/apache2.conf'
#NGINX
sudo apt-get -y install nginx
#PHP 7.2
sudo add-apt-repository -y ppa:ondrej/php && sudo apt-get update
sudo apt-get -y install php7.2 php7.2-fpm php7.2-mbstring php7.2-curl php7.2-xml php7.2-pdo php7.2-json mcrypt php7.2-zip php7.2-mysql php7.2-dev libapache2-mod-php7.2
#PHP 7.1
sudo add-apt-repository -y ppa:ondrej/php && sudo apt-get update
sudo apt-get -y install php7.1 php7.1-mbstring php7.1-xml php7.1-pdo php7.1-json mcrypt php7.1-zip php7.1-dev libapache2-mod-php7.1
#PHP5.6
sudo add-apt-repository -y ppa:ondrej/php && sudo apt-get update
#Composer
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | sudo php -- --install-dir=/usr/local/bin --filename=composer --quite
sudo chown -R $USER ~/.composer/
#Laravel Global
composer global require "laravel/installer"
# Laracogs
composer global require yab/laracogs-installer
sudo apt-get install sendmail
#MySQL
sudo apt-get -y install mysql-server mysql-client
sudo usermod -d /var/lib/mysql/ mysql
#phpmyadmin
sudo /etc/init.d/mysql stop && service mysqld stop && sudo apt-get -y install phpmyadmin
#sudo bash -c 'echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf'
#Laravel Default .env DB user
mysql -u root -p -e "CREATE DATABASE homestead /*\!40100 DEFAULT CHARACTER SET utf8 */;"
mysql -u root -p -e "CREATE USER homestead@localhost IDENTIFIED BY 'secret';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON homestead.* TO 'homestead'@'localhost';"
mysql -u root -p -e "FLUSH PRIVILEGES;"
#Postgree
sudo apt-get -y install postgresql postgresql-common
#Redis
sudo apt-get -y install redis-server
##MSSQL
##Requiriments: Apache2 && PHP
#SQL Server Ubuntu
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - && sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)" && sudo apt-get update
sudo apt-get -y install mssql-server && sudo /opt/mssql/bin/mssql-conf setup && sudo systemctl status mssql-server
#SQL Server comand-line tools
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - && sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/prod.list)" && sudo apt-get update
sudo apt-get install -y mssql-tools unixodbc-dev &&
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
#Microsoft Drivers for PHP for SQL Server
sudo pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system && a2dismod mpm_event && a2enmod mpm_prefork && a2enmod php7.1
echo "extension=sqlsrv.so" >> /etc/php/7.1/apache2/php.ini
echo "extension=pdo_sqlsrv.so" >> /etc/php/7.1/apache2/php.ini
sudo systemctl restart apache2
#NVM
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
exec "$SHELL"
nvm install node && nvm use node && npm install -g yarn
#Pyenv
sudo apt install python-pip
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"
pyenv install 2.7.8
exec "$SHELL"
#Go
curl -s -L https://gist.githubusercontent.com/besser/2280c49ed0c8ffc43502e6b63241ed00/raw/58ccd0a1edb6de6cc249c0f094f00a40da77c64d/wsl-go-install.sh | sudo bash
#RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
exec "$SHELL"
rvm install ruby
exec "$SHELL"
#Jekyll
gem install jekyll bundler
#Vagrant
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
sudo apt-get purge virtualbox
sudo apt-get remove virtualbox-dkms
#Docker
#Instal Docket Store for Windows
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
“deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable”
sudo apt-get update
sudo apt-get install -y docker-ce
docker -H localhost:2375 images
#Configuring ~/.bashrc
sudo bash -c 'echo "cd /mnt/d/Cloud/OneDrive/Dev" >> ~/.bashrc'
#Cleaning
sudo apt-get -y autoremove && sudo apt-get -y autoclean && sudo apt-get -y clean
#Extra
# https://gist.github.com/nidorx/888592768f861f4335ba6efe4206dcb8
# https://gist.github.com/MadLittleMods/0e38f03774fb16e8d698175e505f1f3e
Copy link

ghost commented Mar 18, 2018

O comando apaxy está errado.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment