User Tools

Site Tools


setuplampubuntu22

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
setuplampubuntu22 [2025/04/28 22:20] – created tektinkerssetuplampubuntu22 [2025/04/29 00:26] (current) tektinkers
Line 1: Line 1:
-Commands to Setup a LAMP server in Ubuntu 22.+[[https://docs.tektinkers.com|TinkersDocs Home]] 
 +[[https://www.tektinkers.com|Back to tektinkers.com]]
  
-Installing Apache+====== Commands to Setup a LAMP server in Ubuntu 22. ======
  
-sudo apt update +**Installing Apache** 
-sudo apt install apache2 +<code>sudo apt update</code> 
-sudo ufw app list +<code>sudo apt install apache2</code> 
-sudo ufw allow in "Apache" +<code>sudo ufw app list</code> 
-sudo ufw status+<code>sudo ufw allow in "Apache"</code> 
 +<code>sudo ufw status</code>
  
-Check Website's URL via IP or DNS+//Check Website's URL via IP or DNS//
  
-Installing MySQL+**Installing MySQL**
  
-sudo apt install mysql-server +<code>sudo apt install mysql-server</code> 
-sudo mysql +<code>sudo mysql</code> 
-ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; +//change "root" and "password" to whatever you want// 
-exit +<code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code> 
-sudo mysql_secure_installation+<code>exit</code> 
 +<code>sudo mysql_secure_installation</code>
  
-Installing PHP+**Installing PHP**
  
-sudo apt install php libapache2-mod-php php-mysql +<code>sudo apt install php libapache2-mod-php php-mysql</code> 
-php -v +<code>php -v</code> 
-sudo nano /etc/apache2/mods-enabled/dir.conf+<code>sudo nano /etc/apache2/mods-enabled/dir.conf</code>
  
-Change:+//Change:// 
 +<code>
 <IfModule mod_dir.c> <IfModule mod_dir.c>
-    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm+DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
 </IfModule> </IfModule>
 +</code>
  
-To:+__To:__ 
 +<code>
 <IfModule mod_dir.c> <IfModule mod_dir.c>
-    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm+DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
 </IfModule> </IfModule>
 +</code>
  
-sudo systemctl restart apache2 +<code>sudo systemctl restart apache2</code> 
-sudo systemctl status apache2+<code>sudo systemctl status apache2</code>
  
-Installing other PHP Packages: +//Installing other PHP Packages:// 
-sudo apt install php-cli+<code>sudo apt install php-cli</code>
  
-Creating a Virtual Host for Apache+**Creating a Virtual Host for Apache**
  
-sudo mkdir /var/www/your_domain +//Change "your_domain" to the name you want// 
-sudo chown -R $USER:$USER /var/www/your_domain +<code>sudo mkdir /var/www/your_domain</code> 
-sudo nano /etc/apache2/sites-available/your_domain.conf+<code>sudo chown -R $USER:$USER /var/www/your_domain</code> 
 +<code>sudo nano /etc/apache2/sites-available/your_domain.conf</code>
  
-Copy / Paste into blank file:+//Copy / Paste into blank file:// 
 +<code>
 <VirtualHost *:80> <VirtualHost *:80>
     ServerName your_domain     ServerName your_domain
Line 56: Line 65:
     CustomLog ${APACHE_LOG_DIR}/access.log combined     CustomLog ${APACHE_LOG_DIR}/access.log combined
 </VirtualHost> </VirtualHost>
 +</code>
  
-sudo a2ensite your_domain +<code>sudo a2ensite your_domain</code> 
-sudo a2dissite 000-default +<code>sudo a2dissite 000-default</code> 
-sudo apache2ctl configtest +<code>sudo apache2ctl configtest</code> 
-sudo systemctl reload apache2+<code>sudo systemctl reload apache2</code>
  
-MySQL: Creating Users and Databases+**MySQL: Creating Users and Databases**
  
-CREATE DATABASE example_database; +//Change "example_database", "example_user" and "password" to whatever you want:// 
-CREATE USER 'example_user'@'%' IDENTIFIED BY 'password';+<code>CREATE DATABASE example_database;</code> 
 +<code>CREATE USER 'example_user'@'%' IDENTIFIED BY 'password';</code>
  
-Change password of users: +//OPTIONAL - Change password of users:// 
-ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';+<code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code>
  
-GRANT ALL ON example_database.* TO 'example_user'@'%'; +<code>GRANT ALL ON example_database.* TO 'example_user'@'%';</code> 
-exit+<code>exit</code> 
 +\\ 
 +\\ 
 +\\ 
 +Credit to: [[https://www.digitalocean.com/community/tutorials/how-to-install-lamp-stack-on-ubuntu|https://www.digitalocean.com/community/tutorials/how-to-install-lamp-stack-on-ubuntu]]
setuplampubuntu22.1745878826.txt.gz · Last modified: 2025/04/28 22:20 by tektinkers