I needed to wipe my Fedora laptop yesterday because an in-place upgrade/downgrade went awry. No data was lost, but when it comes to doing it all again from scratch, there’s always something that I forget to do from memory. Hence this little list of step-by-step instructions on a vanilla installation of Fedora Workstation (35 in my case). We’ll do all these steps after using the sudo su command.
Let’s start by enabling the SSH service first so we can login remotely. This will get rid of that slightly annoying “connection refused” greeting. We’ll make sure it starts automatically next time.
systemctl start sshd systemctl enable sshd
Thankfully the firewall ports for SSH are already open, but since this will become a LAMP stack, let’s open the ports for the web server.
firewall-cmd --add-service http firewall-cmd --add-service https firewall-cmd --reload
Installing LAMP Packages
Next we’ll install everything that’s needed to build our stack. Apache is already installed, but we’ll need PHP and MariaDB (used to be MySQL):
dnf install php php-devel php-mysqli mariadb mariadb-server
Let’s make sure they’re started, and start automatically next time
systemctl start httpd systemctl start mariadb systemctl enable httpd systemctl enable mariadb
Setting up the stack
Secure MariaDB if necessary with the following script. It’ll prompt for a new root password and remove the test databases/users. This step is not necessary if you’re bringing in flat files from an existing installation (paste them into /var/lib/mysql then fix permissions and restart the service).
Apache will work out of the box, but if you want to run more than one domain from the default directory (/var/www/html) you’ll want to add the Virtual Host configuration at the bottom. I’ve described how to do this here.
For WordPress, we want the ModRewrite rules to work so that URLs are a little easier on the eye. Tweak the Apache config file at /etc/httpd/conf/httpd.conf and change this section:
# Relax access to content within /var/www. # <Directory "/var/www"> AllowOverride All # Allow open access: Require all granted </Directory>
Also for WordPress, the following packages are necessary. There are several others that are recommended.
dnf install php-pecl-zip php-pecl-imagick
That’s it! This should get me (and you) started next time we need to quickly build a LAMP Stack. If you’d like to know more, take a look at my book LAMP Stack for Humans, it describes this in greater detail.