Compare commits
	
		
			4 Commits 
		
	
	
		
			Bug48-Aya
			...
			Hui-Organi
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
								 | 
						246565c8e9 | |
| 
							
							
								
								 | 
						b37955daa8 | |
| 
							
							
								 | 
						43e9cfeffe | |
| 
							
							
								 | 
						b264ce4299 | 
| 
						 | 
					@ -0,0 +1,94 @@
 | 
				
			||||||
 | 
					Contributed by Aya Boussouf 2025-05-19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- System Update & LAMP Stack Installation ----------------------
 | 
				
			||||||
 | 
					sudo apt update && sudo apt upgrade -y
 | 
				
			||||||
 | 
					sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql unzip git -y
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Start and Enable Apache & MySQL Services ----------------------
 | 
				
			||||||
 | 
					sudo systemctl start apache2
 | 
				
			||||||
 | 
					sudo systemctl enable apache2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sudo systemctl start mysql
 | 
				
			||||||
 | 
					sudo systemctl enable mysql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Configure MySQL Root User ----------------------
 | 
				
			||||||
 | 
					sudo mysql
 | 
				
			||||||
 | 
					ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
 | 
				
			||||||
 | 
					FLUSH PRIVILEGES;
 | 
				
			||||||
 | 
					exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Create LRR Database ----------------------
 | 
				
			||||||
 | 
					mysql -u root -p 
 | 
				
			||||||
 | 
					CREATE DATABASE lrr;
 | 
				
			||||||
 | 
					exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Clone LRR Project Repository ----------------------
 | 
				
			||||||
 | 
					cd /var/www/html/
 | 
				
			||||||
 | 
					sudo git clone http://118.25.96.118:3000/mrlan/LRR.git
 | 
				
			||||||
 | 
					sudo chown -R $USER:$USER /var/www/html/LRR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Switch to Hui-Organize Branch ----------------------
 | 
				
			||||||
 | 
					cd /var/www/html/LRR
 | 
				
			||||||
 | 
					git branch        
 | 
				
			||||||
 | 
					git checkout -b Hui-Organize
 | 
				
			||||||
 | 
					git pull origin Hui-Organize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Import SQL Data into MySQL ----------------------
 | 
				
			||||||
 | 
					sudo mysql -u root -p lrr < /var/www/html/LRR/lrr_database.sql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Create Submission Folder for Assignments ----------------------
 | 
				
			||||||
 | 
					cd /var/www/
 | 
				
			||||||
 | 
					sudo mkdir lrr_submission
 | 
				
			||||||
 | 
					sudo chown -R www-data:www-data lrr_submission
 | 
				
			||||||
 | 
					sudo chmod -R g+rw lrr_submission
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Configure Database Credentials in KeepItSafe.txt ----------------------
 | 
				
			||||||
 | 
					sudo nano /var/www/lrr_submission/KeepItSafe.txt
 | 
				
			||||||
 | 
					# Add: root,root (username,password for MySQL connection)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Configure Apache Virtual Host for LRR ----------------------
 | 
				
			||||||
 | 
					sudo nano /etc/apache2/sites-available/LRR.conf
 | 
				
			||||||
 | 
					<VirtualHost *:80>
 | 
				
			||||||
 | 
					    ServerName localhost
 | 
				
			||||||
 | 
					    DocumentRoot /var/www/html
 | 
				
			||||||
 | 
					    ErrorLog ${APACHE_LOG_DIR}/error.log
 | 
				
			||||||
 | 
					    CustomLog ${APACHE_LOG_DIR}/access.log combined
 | 
				
			||||||
 | 
					</VirtualHost>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Enable Apache Config and Rewrite Module ----------------------
 | 
				
			||||||
 | 
					sudo a2ensite LRR
 | 
				
			||||||
 | 
					sudo a2enmod rewrite
 | 
				
			||||||
 | 
					sudo systemctl reload apache2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Install Google Chrome (for Selenium Tests) ----------------------
 | 
				
			||||||
 | 
					cd ~/Downloads
 | 
				
			||||||
 | 
					wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
 | 
				
			||||||
 | 
					sudo apt install ./google-chrome-stable_current_amd64.deb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Install ChromeDriver ----------------------
 | 
				
			||||||
 | 
					wget https://storage.googleapis.com/chrome-for-testing-public/136.0.7103.92/linux64/chromedriver-linux64.zip
 | 
				
			||||||
 | 
					unzip chromedriver-linux64.zip
 | 
				
			||||||
 | 
					sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
 | 
				
			||||||
 | 
					sudo chmod +x /usr/local/bin/chromedriver
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Install Python, pip and Virtual Environment ----------------------
 | 
				
			||||||
 | 
					sudo apt install python3 python3-pip -y
 | 
				
			||||||
 | 
					sudo apt install python3-venv -y
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Create and Activate Virtual Environment for LRR ----------------------
 | 
				
			||||||
 | 
					cd /var/www/html/LRR
 | 
				
			||||||
 | 
					python3 -m venv venv
 | 
				
			||||||
 | 
					source venv/bin/activate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Install Required Python Packages ----------------------
 | 
				
			||||||
 | 
					pip install selenium
 | 
				
			||||||
 | 
					pip install pytest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# ---------------------- Run Selenium Tests ----------------------
 | 
				
			||||||
 | 
					cd test 
 | 
				
			||||||
 | 
					# Make necessary edits in `conftest.py` and `test_lrr.py`.
 | 
				
			||||||
 | 
					pytest -v SeleniumHui/test_lrr.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue