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 – Hardball!

The computer game environment in 1985 was changing. Society had moved through the various clones of Pong, Space Invaders and Pac-Man. Text adventures were slowly advancing to include graphics (leading to the high-water mark of Sierra games such as Kings Quest). No-one knew where it was leading, so everything was on the table.

Continue reading “CARG Laptop – Hardball!”

CARG Laptop – Networked DOOM

One of the groundbreaking things about DOOM was its ability to ruin networks.  It became so commonplace that companies such as Intel and Carnegie Mellon University explicitly banned the playing of DOOM on its networks.  According to the DOOM FAQ put out by id Software, “In 1994, we fully expect to be the number one cause of decreased productivity in businesses around the world.”  And it pretty much did, or at least made companies think about setting up a policy regarding networked games.

So with DOOM good to go on our CARG laptop, the next logical step is to get our friends playing.  Because as that same DOOM FAQ says, “Who doesn’t enjoy shooting a rocket into a friend?”

Ad-Hoc DOOM Network Structure

DOOM allows up to four computers on a local network to play in the one game.  One of the four is considered the “server”, the others are “clients”.  The server needs to have the DOOM multiplayer program (DM.exe) running, then the others can connect to it.  In the example in the video, I am setting up the CARG Laptop as the server, and my Apple MacBook Pro as a client.  Both are on my local wireless network, and both have DOSBox and DOOM working.

DOSBox adds an extra complication to the architecture, as it does not connect to a network right away.  In order to enable networking, the DOSBox configuration file on each machine needs to be modified.  On the CARG Laptop, that file is ~/.dosbox/dosbox-0.74.conf and on the MacBook Pro it is ~/Library/Preferences/dosbox-0.74.conf.  Near the end of the file, change the following line:

ipx=false

to

ipx=true

That’s the only thing that needs to change.  This tells DOSBox to enable a network connection.  Save and close the file.

Configure the server

On the server (the CARG Laptop), we need to know what the IP address is, so other computers can connect to it.  Enter the following command:

ifconfig | grep netmask

and look through the information that is returned.  The first series of numbers is your IP address, in the format of AAA.BBB.CCC.DDD.  Remember this – we will need it later.

We also need to allow the other computers to connect through the firewall on the server.  Head to Menu > Administration > Firewall and enter your administrator password.  Then head to the Ports tab and enter in the following information:

Port / Port Range: 19900

Protocol: udp

You can choose any port number between 1024 and 65535, but you will need to use that consistently.  I will be using 19900, so adjust your settings if you use a different port.

Once that is done, we can start the ipx server.  On the CARG Laptop, enter the following command into DOSBox:

ipxnet startserver 19900

It will return that the IPX Tunneling Server started:

ipxnet startserver command on DOSBox as the IPX server
ipxnet startserver command on DOSBox as the IPX server

Now enter the command to start the DOOM Deathmatch server:

DM

The following screen will appear:

Running DM.exe on the IPX server
Running DM.exe on the IPX server

You can see it has already selected the IPX Network.  The setting we are most concerned with is the top right corner, where it has selected “Wait for call”.  This is what we want – we are waiting for the other computers to connect in.  Hit F10 and it will wait for others to join:

IPX server waiting for others to join the DOOM DeathMatch
IPX server waiting for others to join the DOOM DeathMatch

We can leave the server at this stage as it waits for others to connect.

Configure the client

Head over to a client machine (in my example, the MacBook Pro), and enter the following command into DOSBox:

ipxnet connect AAA.BBB.CCC.DDD 19900

Change AAA.BBB.CCC.DDD for the IP address we found out earlier, and replace 19900 with whatever port you chose before.  This will tell us it has connected to the server:

Client connecting to IPX network
Client connecting to IPX network

Now type in the command to start the DeathMatch on the client:

DM

The same window appears as on the server.  Make sure all settings are the same as on the server except the top right corner – it should now have Already Connected selected.

Running DM.exe on the IPX client
Running DM.exe on the IPX client

Once everything is confirmed, hit F10 to proceed.

Run Amok

Things happen pretty fast after that.  The two machines will connect, and DOOM will start pretty much right away.  You are dropped straight into the DeathMatch – there is no menu or introduction screen.

DOOM DeathMatch start screen. The insert window in the top right is for demonstration only.
DOOM DeathMatch start screen. The insert window in the top right is for demonstration only.

Note that the insert box in the top right of the image above is only for demonstration of the network connection.  You will not see that box, nor will you have any idea where the other player is.  From there, it’s pretty simple – find the other player and shoot them!

Happy fragging.

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”