Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gigsforlinux/aa767caa029c63baf9eb0e4acad9cadd to your computer and use it in GitHub Desktop.
Save gigsforlinux/aa767caa029c63baf9eb0e4acad9cadd to your computer and use it in GitHub Desktop.
Install Laravel Using LAMP Stack (Linux, Apache, MySQL, PHP7)
#!/bin/sh
# YouTube: https://youtu.be/FIEDwzMRdBw
# Things to so after install Ubuntu 20.04
sudo -i
apt update -y
apt upgrade -y
apt update -y
apt install build-essential checkinstall
apt install ubuntu-restricted-extras
apt install software-properties-common
add-apt-repository ppa:nilarimogard/webupd8
apt update
apt install launchpad-getkeys
launchpad-getkeys
add-apt-repository ppa:git-core/ppa
apt update -y
apt upgrade -y
apt update -y
apt install git
git config --global user.name "YourName"
git config --global user.email youremail@gmail.com
apt upgrade -y
apt -f install
apt autoremove
apt -y autoclean
apt -y clean
apt update
reboot
# Install Apache
sudo apt update
sudo apt upgrade
sudo apt install apache2
sudo ufw allow in "Apache Full"
apache2 -v
nano /etc/apache2/apache2.conf
# Add
ServerName 127.0.1.1
# Find and update AllowOverride All
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# ctrl+s and ctrl+x
sudo service apache2 start
sudo systemctl enable apache2
sudo service apache2 restart
sudo service apache2 reload
sudo service apache2 status
sudo apt install curl
sudo ufw allow ssh
sudo ufw allow 2222/tcp
# Visit: http://localhost/
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo apt install php libapache2-mod-php php-mysql
sudo apt install php7.4-common php7.4-cli php7.4-gd php7.4-mysql php7.4-curl php7.4-intl php7.4-mbstring php7.4-bcmath php7.4-imap php7.4-xml php7.4-zip
sudo nano /etc/apache2/mods-enabled/dir.conf
# add
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
# for save and exit ctrl+s + ctrl+x
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
composer --version
cd /var/www/html/
git clone https://github.com/laravel/laravel.git
cd laravel
chmod -R 755 /var/www/html/laravel
chmod -R 777 /var/www/html/laravel/storage
composer install
php artisan serve
mv .env.example .env
a2enmod rewrite
php artisan key:generate
# Install MariaDB & check version, start,stop & restart Apache
apt install mariadb-server mariadb-client
mysql_secure_installation
nano /usr/lib/systemd/system/mariadb.service
# Update
LimitNOFILE=infinity
ctrl+s and ctrl+x
systemctl daemon-reload
systemctl restart mariadb
systemctl status mariadb
systemctl is-enabled mariadb
mysql
create database lerevel;
CREATE USER 'netadmin'@'%' IDENTIFIED BY 'L@Rave;786';
GRANT ALL PRIVILEGES ON *.* TO 'netadmin'@'%';
use lerevel;
FLUSH PRIVILEGES;
exit
systemctl restart mysql
apt update -y
apt upgrade -y
sudo nano .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=netadmin
DB_PASSWORD=L@Rave;786
sudo apt update
sudo apt install phpmyadmin php-mbstring php-gettext
sudo nano /etc/apache2/apache2.conf
# Then add the following line to the end of the file:
Include /etc/phpmyadmin/apache.conf
# save ctrl+x then y and hit enter. Then restart apache:
sudo service apache2 restart
# visit: http://localhost/phpmyadmin/
user: netadmin
pass: L@Rave;786
sudo php artisan config:cache
sudo php artisan make:auth
sudo php artisan migrate
nano /etc/apache2/sites-available/000-default.conf
# remove all text or comment text
<VirtualHost *:80>
ServerName localhost
ServerAdmin admin@hakase-labs.io
DocumentRoot /var/www/html/laravel/public
<Directory /var/www/html/laravel>
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo service mysql restart
sudo service apache2 restart
sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment