Possum wrote: ↑
Fri Jun 05, 2020 7:18 pm
I use my pi(s) headless. Is there a way I can run a script to do this. As I need to install all this everytime I reinstall.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install apache2 -y
sudo apt-get install php -y
sudo apt-get install mariadb-server
sudo mysql -u root -p
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'username'@'localhost';
sudo apt-get install phpmyadmin
Probably the safest way to handle this is to keep the script as a text file on whatever system you use to create your boot SDs, and copy it to the boot partition of the created card with your headless setup files. Once you have successfully booted the new card, use sh to run the script. You may have to put the commands to mysql in a separate file and redirect the mysql CLI to them. I really wouldn't recommend trying to completely automate this on first boot, since you may not know if something goes wrong along the way.