Upgrading Fedora and Installing AMP

At the beginning of May 2018, Fedora 28 was released.  I have run through the upgrading process, and can happily report that the information from Fedora Magazine works like expected.  So rather than replicating their information, I’ll just link directly to them.

As with any significant system change, be sure to back up your information before you go through the process.

AMP Installation

AMP stands for Apache MySQL and PHP.  Usually it is referred to as LAMP (with Linux making up the L), but as Fedora is already installed, that part is kind of redundant.

There are three steps to the set-up: installation of the programs, configuring the programs and configuration of the system  By the end of the process, you will have a web development environment, fully enclosed within your laptop.  Let’s get going with the installation.

AMP Component Installation

While researching the information in this article, I noticed a couple of sites had a “one-line installation”, but would only install a single component of the software.  So here is a true, installs-everything-you-need command that you need to run as root:

dnf install httpd mariadb mariadb-server php php-common php-mysqlnd php-gd php-cli php-mbstring

This command installs (in order):

  • Apache
  • MySQL and associated server component
  • PHP and associated components

With the installation out of the way, let’s get to the configuration of the applications.

Configure MySQL

The configuration of MySQL is relatively easy, given the script they provide.  Simply run (as root):

mysql_secure_installation

It will ask for a root password – this is the root password for MySQL, which doesn’t exist yet.  So just hit [Enter] and you will be prompted to create a new MySQL root password.  The rest of the process is to answer questions which make the MySQL installation more secure – you can safely answer Y to all the questions.

Configure PHP

Configuring PHP is more to run a script to test it works, and we will confirm the test later on.  The single-line script to run (as root) is:

echo -e "<?php\nphpinfo();\n?>" > /var/www/html/phpinfo.php

We will use the results of this script further down this post.

Configure Fedora

Now we get to configure Fedora itself, so the firewall allows the various pieces of software to share information, and to ensure the processes fire up at start-up.  To configure the firewall, enter these lines as root:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload

By default, root owns the folder that Apache uses to present web pages.  We are going to set the user known as apache and a group known as apache as the new owners of the folder.  We will also give the group write access to the folder.  Finally, add yourself to the apache group, so your native account has write permissions to the folder.  Run the following commands as root:

chown -R apache:apache /var/www/html
chmod +775 -R /var/www/html
usermod -a -G apache yourfedorausername

Then run the following lines as root to restart the applications and configure the application start-up behaviours:

systemctl restart httpd
systemctl restart mariadb
systemctl enable httpd
systemctl enable mariadb

That’s it for the installation and configuration!  Now we just need to test what we have done.

Testing the AMP

There are two tests we can do which check if Apache and PHP are working properly.

The first is to open a a web browser in Fedora and head to http://localhost. You should get an Apache test screen.

Apache test screen in Fedora 28
Apache test screen in Fedora 28

The next test is to go to http://localhost/phpinfo.php.  This is the script we ran earlier, and should provide information about the installed PHP environment.

PHP info on Fedora 28
PHP info on Fedora 28

If you scroll down, you should see information about MySQLi as well:

MySQLi information within PHP info on Fedora 28
MySQLi information within PHP info on Fedora 28

Next Steps

We have Apache, PHP and MySQL installed and running.  If you want a nice front-end for the MySQL environment, you will have to hold on until MySQL release a version of MySQL Workbench for Fedora 28.  If you want, you can install the official MySQL YUM repository for Fedora 28 by running the following command as root:

rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm

You can then check to see if MySQL Workbench is available by running the following command as root:

dnf install mysql-workbench-community

To generate HTML / PHP files, simply save your files in /var/www/html.  I like to use BlueFish as my HTML / PHP editor, which you can install by following the instructions on the Bluefish wiki.

Enjoy your very own, personal, self-contained LAMP stack and web development environment!

Epilogue

I know it has been a while since I last posted.  Fortunately (or unfortunately for the blog) it is hockey season here in Australia, and I’m pretty heavily involved in that (check out aihlstatsnews.com for more info).

CARG Laptop – Upgrade Fedora 26 to Fedora 27

In the middle of November 2017, Fedora released Fedora 27, the latest upgrade to the Fedora line.  When I built the CARG Laptop, I went with Fedora 26 as it had Intel graphics card support.  But some time has passed, and I feel it’s about time I upgraded.  Here is what I did.

Thanks Where Its Due

The process I followed is from Ryan Lerch’s article in Fedora Magazine, with the creative title “Upgrading Fedora 26 to Fedora 27”.  You can read Ryan’s article here.  I also got some instructions from Fedora’s bug reports.

Preparing the Preparation

As with any operating system upgrade, it is strongly recommended you backup your data before you start this process.  While this process ran well for me, that doesn’t mean it will be flawless for you.  The people at Fedora work hard to make processes like this as easy and as foolproof as possible, but there is still a risk, so back up.

Once your data is safe, make sure your machine is as up to date as it can be so the process has the latest and greatest to leverage off.  Do this by running the following command as the root user:

dnf upgrade --refresh

The last step of the preparation is to install the DNF system upgrade plugin.  This is simply a matter of running the following command as the root user:

dnf install dnf-plugin-system-upgrade

Once that is done, we can start running the upgrading process.

Get It Done

Now the system is ready to go, download all the updates needed to upgrade your system.  To do that, run the following command as the root user:

dnf system-upgrade download --releasever=27

Be aware that this may take a while, as it has a lot to download (maybe a couple of gig worth, depending on what programs you have installed and the speed of your internet connection).  This simply downloads the updates and runs a test installation – it does not run the actual update.  That is because there is a potential show-stopping bug in the process, but it is easy fo fix.

The bug involves existing software repositories being flagged as “expired”, so they are not used once the installation begins.  The problem is that completely legitimate repos end up being accidentally flagged, so you need to check if anything has been flagged.  The flagging process happens between the downloading of the packages and the installation process, which is why these two commands are run separately.  Run the following command as the root user:

vi /var/lib/dnf/system-upgrade/expired_repos.json

This file should appear as follows:

[]

Basically, it’s just an opening and a closing square bracket – that’s it.  If it does not look like that, edit the file to make it that.  Save and close the file.

Once that is sorted, it’s time to run the upgrade.  Run the following command as the root user:

dnf system-upgrade reboot

Your computer will now install all of the upgrades it downloaded earlier, verify the installation, and reboot.  This process takes a long time – just to do the installations took over an hour, and the verifications another 15 minutes or so.

The Reveal

Once you have mowed the lawn, done the laundry, watched a movie or woken up from your nap, the installation process completes with a reboot, returning you to a login screen.  Once you have logged in, you should be able to confirm the upgrade by going to Menu > Preferences > System Info:

Updated Fedora 27 System Information
Updated Fedora 27 System Information

So far in my testing, all my programs are working fine, and my files were exactly as I left them.  Hopefully it is just as painless for you.

CARG Laptop – Fusion Box

After the installation of Fedora and associated updates, it’s time to start installing DOSBox, our first application that will run the retro games we want to play.  In order to do that, we need to configure some additional software repositories (or “repo’s”) to allow access to additional software.  So let’s get into it!

Continue reading “CARG Laptop – Fusion Box”

CARG Laptop – Retro Gaming Comes Cheap

After watching LGR’s video about building a retro gaming machine with other YouTubers, I saw in the background many games I fondly remembered from my youth. And seeing how other retro gamers do their thing inspired me to give it a shot as well. Because who doesn’t need another YouTuber aimlessly babbling on about days of computer past … And it’s not as if I had nothing better to do …

Continue reading “CARG Laptop – Retro Gaming Comes Cheap”