Skip to content

Instantly share code, notes, and snippets.

@motaher13
Last active July 31, 2021 12:34
Show Gist options
  • Save motaher13/ac12a69502e9253503ae61bbb236dd16 to your computer and use it in GitHub Desktop.
Save motaher13/ac12a69502e9253503ae61bbb236dd16 to your computer and use it in GitHub Desktop.
Ubuntu Lamp Stack setup
# instal lampp
--apache
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw allow in "Apache Full"
--php
sudo apt install php libapache2-mod-php
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php index.$
</IfModule>
sudo systemctl restart apache2
sudo nano /var/www/html/info.php
<?php
phpinfo ();
?>
localhost/info.php
--mysql
sudo apt update
sudo apt install mysql-server
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '000';
FLUSH PRIVILEGES;
exit
--phpmyadmin
sudo apt-get install phpmyadmin php-mbstring php-gettext -y
or: sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
(use space bar to select apache)
(set password '000' )
sudo nano /etc/apache2/apache2.conf
add this line
Include /etc/phpmyadmin/apache.conf
sudo /etc/init.d/apache2 restart
localhost/phpmyadmin
login -> 'root', '000'
----------------end--------------------
# uninstall lampp
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
# This will remove PHP
sudo apt-get purge `dpkg -l | grep php7.2| awk '{print $2}' |tr "\n" " "`
sudo apt-get purge php7.*
sudo apt-get autoremove --purge
whereis php
sudo rm -rf /etc/php
# This will remove MYSql
sudo service mysql stop
sudo apt-get remove --purge *mysql\*
sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
rm -rf /etc/mysql
sudo apt-get autoremove
sudo apt-get autoclean
----------------end--------------------
# install xampp
> download xampp from https://www.apachefriends.org/download.html
> chmod +x xampp-linux-*-installer.run
> sudo ./xampp-linux-*-installer.run
> cd /usr/share/applications
> sudo touch xampp.desktop
> sudo nano xampp.desktop
> paste following text
[Desktop Entry]
Encoding=UTF-8
Name=XAMPP Control Panel
Comment=Start and Stop XAMPP
Exec=sudo /opt/lampp/manager-linux-x64.run
Icon=/opt/lampp/htdocs/favicon.ico
Categories=Application
Type=Application
Terminal=true
> Hit Windows button and type 'xampp'
# add 'mysql' path
>sudo nano ~/.bashrc
paste -> alias mysql='/opt/lampp/bin/mysql -u root'
>source ~/.bashrc
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment