Skip to content

Jesses Software Engineering Blog

Apr 05

Jesse

Fedora 20 LAMP Setup

I’ve been on the market for a new laptop for awhile now and after working with a Mac extensively at my job I knew I wanted a Windows/Linux dual boot development environment. Aside from the annoyances of Mac’s OS being really close to Linux but different enough have to learn new tools, Macs are way over priced. I ended up finding a Toshiba Satellite S55-A5188 i7-4700MQ 12GB DDR3 with 1TB drive (only hardware downfall was no SSD) for around $700. I decided to go with a Fedora setup as all my servers run CentOS and I am more familiar with RedHat. This is a brief overview of how to get a dual boot LAMP development environment set up for Fedora 20.

BIOS and partitioning

The new laptop came with Windows 8.1. There was also a new default BIOS mode, UEFI, opposed to the “legacy” mode of CMOS. Supposedly newer Linux distros install GRUB2 which allows Linux to dual boot in UEFI mode but I was running into issues getting Fedora to boot using UEFI. Overall I wasn’t impressed with Windows 8 anyway so I ended up keeping my BIOS on CMOS and proceeded to wipe the hard drive in favor of Windows 7 Pro. After setting up Windows on a small partition (100 GB) I proceeded to install Fedora (if you see a message similar to “Invalid signature…” you will have to disable secure boot in the BIOS). When installing Fedora, I just let the partition manager create partitions except that I added a bios boot partition to allow for OS selection on system boot without having to enter the BIOS.

WARNING: If you wipe all existing partitions make sure you have access to the device drivers for your machine. You cannot rely on a new OS being able to recognize all your devices. Surprisingly Fedora 20 recognized all my devices but I had to manually install drivers on Windows 7.

Setting up Fedora

There are just a couple basic things to do with Fedora before installing the LAMP stack. I had a default administrative user added during the install but to add a new one and set password:

sudo useradd jesse
sudo passwd jesse

If you want to add the new user as an administrator you can add the user to the wheel group OR directly add the user to the sudoers file. Adding a user to the wheel group is a more organized approach (your group id # may be different):

vi /etc/group

wheel:x:10:jesse

OR

vi /etc/sudoers

jesse ALL=(ALL)       NOPASSWD: ALL

To use the new user:

su -u jesse

I like to set auto login for my user:

vi /etc/gdm/custom.conf

[daemon]
AutomaticLoginEnable=True
AutomaticLogin=jesse

Next you will want to update Fedora for all the newest software:

sudo yum -y update

Fedora 20 comes with GNOME desktop by default but there are plenty others to choose from. I used KDE along with the switchdesk utility to set a default:

sudo yum install @kde-desktop switchdesk switchdesk-gui

To change default:

switchdesk

If you have issues with switchdesk actually setting the default desktop, you can manually set a desktop for a user:

vi /var/lib/AccountsService/users/jesse

Xsession=kde-plasma

As for non development related software I have a pretty short list of mandatory programs:

# Gimp for basic image editing:
sudo yum install gimp

# Google Chrome
sudo yum install wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum install google-chrome-stable_current_x86_64.rpm

# Adobe FLash:
sudo yum install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm -y
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
sudo yum install flash-plugin

Outside of that it’s just any appearance customizations you may want. I like to change the terminal prompt:

vi ~/.bashrc

export PS1="[\u: \W]\$ "

A lot of the KDE appearance customizations can be found in the system settings:

systemsettings

Installing (L)AMP

There are a couple packages that while not required for installing a LAMP stack are common and provide useful tools. Any of the packages can be installed using yum install:

  • gcc – Various compilers, needed for compiling C code
  • httpd-devel – allows for compiling and developing of Apache modules
  • php-devel – used for compiling PHP extensions

To find out what a Yum package is used for: http://www.rpmfind.net/

To install and start Apache:

sudo yum -y install httpd
service httpd start

At this point you can verify the status of Apache as well as test it in a browser using the address 127.0.0.1:

service httpd status

To make Apache auto start on system startup:

systemctl enable httpd
systemctl is-enabled httpd

To install PHP:

yum install -y php php-common php-mysql php-pdo

The packages that start with php- are additional PHP modules. Some common modules include:

  • PostgreSQL (php-pgsql) – A extension for PostgreSQL database for PHP
  • MongoDB (php-pecl-mongo) – A driver for MongoDB database
  • SQLite (php-sqlite) – Extension for SQLite Database Engine
  • Memcache (php-pecl-memcache) – Memcached caching daemon
  • Memcached (php-pecl-memcached) – Memcached caching daemon
  • GD (php-gd) – GD extension for PHP application to serve graphics
  • XML (php-xml) – XML Parser for PHP applications
  • MBString (php-mbstring) – Used to handle multi-byte strings
  • MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts
  • APC (php-pecl-apc) – APC module used to optimize and cache PHP code
  • CLI (php-cli) – Command-line interface for PHP
  • PEAR (php-pear) – Application repository framework for PHP

Fedora 20 comes with MariaDB by default. Although I have no experience with MariaDB from what I read it is essentially a drop in replacement to MySQL (at least from a developer’s standpoint). If you want to use MySQL instead of MariaDB:

sudo yum remove mariadb mariadb-server
sudo yum install community-mysql community-mysql-server

After the yum install perform a secure MySQL installation (I included recommended settings):

/usr/bin/mysql_secure_installation

Set root password?   Y
Remove anonymous users?   Y
Disallow root login remotely?   Y
Remove test database and access to it?   Y
Reload privilege tables now? Y

Turn on MySQL and configure the server to start on system boot:

systemctl enable mysqld
systemctl is-enabled mysqld

Verify you can access MySQL:

mysql –u root –p

NOTE: If the above instructions did not give you the versions you wanted you can use the remi repos to get newer software versions.

And there it is. You now have a Windows/Fedora LAMP development environment set up and ready to be used.

Blog Powered By Wordpress