User Tools

Site Tools


setuplampubuntu22

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
setuplampubuntu22 [2025/04/28 22:34] tektinkerssetuplampubuntu22 [2025/05/15 00:35] (current) tektinkers
Line 1: Line 1:
 +[[https://docs.tektinkers.com|TinkersDocs Home]]
 +[[https://www.tektinkers.com|Back to tektinkers.com]]
 +
 ====== Commands to Setup a LAMP server in Ubuntu 22. ====== ====== Commands to Setup a LAMP server in Ubuntu 22. ======
  
Line 14: Line 17:
 <code>sudo apt install mysql-server</code> <code>sudo apt install mysql-server</code>
 <code>sudo mysql</code> <code>sudo mysql</code>
 +//change "root" and "password" to whatever you want//
 <code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code> <code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code>
 <code>exit</code> <code>exit</code>
 <code>sudo mysql_secure_installation</code> <code>sudo mysql_secure_installation</code>
 +
 +**MySQL: Creating Users and Databases**
 +
 +<code>sudo mysql -u root -p</code>
 +
 +//Change "example_database", "example_user" and "password" to whatever you want://
 +<code>CREATE DATABASE example_database;</code>
 +<code>CREATE USER 'example_user'@'%' IDENTIFIED BY 'password';</code>
 +
 +//OPTIONAL - Change password of users://
 +<code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code>
 +
 +<code>GRANT ALL ON example_database.* TO 'example_user'@'%';</code>
 +<code>exit</code>
  
 **Installing PHP** **Installing PHP**
Line 25: Line 43:
  
 //Change:// //Change://
-<code>DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm</code>+<code> 
 +<IfModule mod_dir.c> 
 +DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm 
 +</IfModule> 
 +</code>
  
 __To:__ __To:__
-<code>DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm</code>+<code> 
 +<IfModule mod_dir.c> 
 +DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm 
 +</IfModule> 
 +</code>
  
 <code>sudo systemctl restart apache2</code> <code>sudo systemctl restart apache2</code>
Line 38: Line 64:
 **Creating a Virtual Host for Apache** **Creating a Virtual Host for Apache**
  
 +//Change "your_domain" to the name you want//
 <code>sudo mkdir /var/www/your_domain</code> <code>sudo mkdir /var/www/your_domain</code>
 <code>sudo chown -R $USER:$USER /var/www/your_domain</code> <code>sudo chown -R $USER:$USER /var/www/your_domain</code>
Line 58: Line 85:
 <code>sudo apache2ctl configtest</code> <code>sudo apache2ctl configtest</code>
 <code>sudo systemctl reload apache2</code> <code>sudo systemctl reload apache2</code>
- +\\ 
-**MySQL: Creating Users and Databases** +\\ 
- +\\ 
-<code>CREATE DATABASE example_database;</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]]
-<code>CREATE USER 'example_user'@'%' IDENTIFIED BY 'password';</code> +
- +
-//Change password of users:// +
-<code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';</code> +
- +
-<code>GRANT ALL ON example_database.* TO 'example_user'@'%';<code> +
-<code>exit</code>+
setuplampubuntu22.1745879661.txt.gz · Last modified: 2025/04/28 22:34 by tektinkers