Configuring Fedora & Localhost Setup


This is the first part in my series of step by step guides to turn Fedora
into the ultimate web development platform.

I am going to assume that you have Fedora installed already, or are
comfortable installing it yourself. Once you are up and running, just run
terminal application and follow along to set up your perfect development

In this guide we will discover:

  • How to set the host name, and why it’s important.
  • Which repositories to install and how to do it.
  • How to setup subpixel rendering to improve font appearance.
  • How to setup and configure your LAMP environment for localhost

If you have not already read my Linux
for Web Development Guide
please check it out.

Much of the software I will recommend is built into Fedora, but also some
important 3rd party software is not. There are many pitfalls to overcome in
configuring Fedora, and some seem to change slightly on a release by

This guide was created using Fedora 27, but most of it is applicable to
earlier versions as well. As Fedora continues to improve, occasionally a
party application is brought into the official repository, or a settings
changes. Mainly bugs are fixed and no longer need workarounds, or a new
application arrives that is better and replaces and old one.

Set the host name

It’s a good idea to give your computer a name so it can identify itself to
other computers on the network. This will also to make it easy for you to
identify your own computer if you are logged in remotely to multiple
When you are using the terminal it will show:

[username@hostname ~]$ 

before every command you type. If you have multiple windows open all
you logged in from @localhost (the default) it will soon become very

So use this command:

hostnamectl set-hostname yourhostname

Enable extra repositories

Fedora only installs 100% free and open source software from its own
built in repository. It is very strict, sometimes too strict in it’s FOSS
definition. We need more software than comes out of the box, and more than
available from the official repo.

The best way to get the software we want is add some extra 3rd party
repositories. That way we get the following advantages over just
the software from the official website:

  • Time saved looking for updates, going to the site, and downloading
  • Automatic updates whenever we update our system.
  • Enhanced security, checksums are used when downloading.

We will install the RPM Fusion and VS Code repos:

sudo su -c 'dnf -y install$(rpm -E
  -E %fedora).noarch.rpm'
  sudo rpm --import
  sudo sh -c 'echo -e "\nname=Visual Studio
  > /etc/yum.repos.d/vscode.repo'

Update everything

Before we go further, let’s update the entire system to the latest
of all packages. This is best practice.

sudo dnf -y --refresh upgrade

Allow virtual machines that use fusefs to intall properly with

This is just a weird little one I threw in, as it could save you hours of
wasted time if you use virtual machines. If you don’t enter this command,
then you will enter a over zealous security paranoia hell hole trying to
a virtual machine. Just enter this and thank me later.

sudo setsebool -P virt_use_fusefs 1

Install subpixel rendering and change desktop settings


This has
a long story to go with it, a tale of patents and Microsoft tom foolery.
can go and read that all elsewhere if you like. The short version is if
monitor is 1080p or less you will probably benefit from enabling subpixel

I have debated with people who swear they can’t see the difference, I
they must be half blind. Without subpixel rendering <=1080p text has a
slight uneven spidery appearance. With, it looks amazing. If you are lucky
enough to have a really high resolution display then you totally don’t want
this, it will probably make things look worse for you.

Ubutu has it by default, so do some other Linux distros. Fedora is 100%
FOSS, they won’t even touch a potential patent infringement with a

sudo dnf -y install freetype-freeworld
  gsettings set org.gnome.settings-daemon.plugins.xsettings hinting slight
  gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing rgba
  echo "Xft.lcdfilter: lcddefault" >>"$HOME/.Xresources"

Increase the amount of inotify watchers so live-server works with
> 8192 files in a directory

In part 2 of this guide I will suggest you use the awesome live-server
software so you can edit HTML/CSS/JS in real time, if you don't intend to
follow my advice then you can safely ignore this tweak.

I don’t know if this is a hardware thing, but on my system I run into
problems using live-server if I don’t make this little change:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
  sudo sysctl -p

Setting up the LAMP for localhost Development


This is my way of doing things. I am
going to do a bit of a ‘hack’ and run Apache as the user, this saves a lot
bother setting permissions. I think it is fine for a development machine
is not facing out to the internet, but the hyper security concious are
probably going to get triggered.

First we will make a folder in our home directory to store all our
development sites:

mkdir ~/sites

Make a symbolic link from the Apache web directory to your sites folder:

sudo ln -s ~/sites /var/www/html

Tell SELinux that these files/directories are allowed to be modified by

chcon -R unconfined_u:object_r:httpd_sys_rw_content_t:s0 ~/sites

Change the "User apache" string in the config file to "User (the username
the current user)". For a development machine, it's more convenient to run
Apache as the current user to simplify permissions problems:

sudo sed -i "s/User apache/User $USERNAME/g"

You can turn Apache and MySQL server on and off at the same time with this
little script I created:

if pgrep -x "httpd" &gt; /dev/null
  read -rp "Apache is running, would you like to stop Apache and MariaDB? (y/n)
  " -n 1 run
  if [ "$run" == n ];then
  echo "Stopping Apache and MariaDB..."
  sudo systemctl stop httpd.service
  sudo systemctl stop mariadb.service
  echo "Starting Apache and MariaDB..."
  sudo systemctl start httpd.service
  sudo systemctl start mariadb.service

If Apache is running it asks if you would like to stop Apache and MySQL
running, if it’s not it runs both. This works out great if you only ever
them both at once, like myself.

You can finish off by going through the MySQL security setup:

sudo systemctl start mariadb.service
  sudo mysql_secure_installation

Now you have everything setup and ready to go, let's install all the software
we will need in part two, Linux
Web Development Tools

I hope you have found this guide helpful. If you would like to employ me for
any upcoming projects, please do not hesitate to get
in contact
. Please leave your feedback on this guide below and I will
sure to take it into account for future updates.

Leave a Reply

Your email address will not be published. Required fields are marked *