CentOS 7 server installation

in centos, centos 7, Linux, installation, guide

CentOS 7 is out, and it brings some much needed features for web developers! For starters, MySQL is replaced by MariaDB (much better performance for InnoDB, and a better client), and PHP is 5.4 out of the box. In addition, multitudes of tweaks have been made to the system, making it more responsive.

The following is a guide (with screenshots) for installing a basic LAMP stack with the new OS, on an empty machine (in this case, a virtual machine), using the NetInstall image (Minimal is not yet available, but being worked on).

Getting the image

First off, grab a copy of the image either via torrent or directly from a mirror:

http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7.0-1406-x86_64-NetInstall.torrent

http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7.0-1406-x86_64-NetInstall.iso
Note: Minimal image is not yet available, but the people at CentOS are said to be working on it.

Starting up

First off, boot from the CD image, and you'll be greeted by the (marginally) more colorful boot screen

Selecting "Install CentOS 7" will take you to the language selection screen:

Language selection screen

The defaults work just fine for the purposes of the tutorial, so we move forward to the summary screen.

The summary screen

Every task will bring you back here after you complete it, and after the minimum required tasks are completed you'll be allowed to begin the installation. Note that some tasks have issues and thus we are not allowed to begin the installation yet.

Network & Hostname

This is the most basic task for this kind of installation - if you mess something up here, every other task that follows will bring up errors thatDON'T point to this. Quite counter-intuitive in my opinion, but it is what it is. Click on the task, and you'll see a list of interfaces, and be able to turn them On or Off, and configure them. In our case, we only have one interface

Networking task

so I'll skip over to configuring it, starting with the general tab:

The general tab in the networking task

Warning: Make sure to tick the "Automatically connect to this network when it is available" checkbox here, otherwise your interface will not be up on boot!

Moving on, there's a whole new DCB tab with advanced networking options…. which we won't be touching, but some of you might like to see

The DCB tab in the networking task

And over to the classic IPv4 tab - I won't go into details here since it hasn't changed at all since the previous versions. Once you're done save your changes.

The IPv4 tab in the networking task

Warning: Before leaving this task, make sure to turn the interface "On". If it's already "On", turn it "Off" and then "On" again. It might sound like a pun from IT Crowd, but if you don't the changes won't be applied, only saved (took me some hair pulling because the next steps didn't work).

Click "Done" (top left!?) to return to the summary screen.

Installation Source

Click on the "Installation Source" task next. Select the "On the network" radio, and use the address

http://mirror.centos.org/centos/7/os/x86_64/

The mirror selection screen in the installation source task

Click "Done"

Note: If everything is OK at this point, the summary screen should change the description text under "Installation Source" task to "Downloading package metadata" as in the image below

After the download finished (might take some time depending on network traffic).

Software Selection

This task should be now unlocked, and you can pick packages to be installed. Choose the "Basic Web Server" role, "MariaDB client" and "PHP Support" packages

Package selection screen

Click "Done"

Installation Destination

Since we're not doing anything advanced, just click on the drive available (if you don't it is assumed you haven't selected anything) and let it automatically partition the system.

Installation destination screen

You should be now able to "Begin Installation"

Installation Progress

While the packages needed are being downloaded and installed, you will be seeing a screen similar to the image below

Progress screen

Where you can add a root password via the task on screen

Root pass screen

Other than that, you can also add users, or just wait patiently until installation is done.

Result

You first need to open the HTTP port in your firewall for the next steps to work - that's a simple afair, just by typing

# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload

This will allow HTTP traffic, and save it to your permanent rules. Finally, in the second line, reload the firewall to use the new ruleset.

Navigating to the IP of the machine you should now see the (new) welcome screen of Apache

Apache welcome screen

To test PHP, we'll just add a simple script to the default docroot by using the terminal:

# echo "<?php phpinfo();" > /var/www/html/is.php

and navigate to http://<your-ip>/si.php, where you should find the basic info about PHP

And this concludes this guide. If you find any issues, or things missing just let me know in the comments! I'll post another article soon about the (many) changes in how things work soon. Enjoy!