My Videos

Installing LAMP and Moodle on a CentOS server part 1

Installing LAMP and Moodle on a CentOS server part 1

Installing LAMP Part 1

Installing LAMP

Step 1: Turning off Security

Before we start to Install LAMP we need to disable the security so we do not run into any problems in the installation process. These will be turned back on when we deal with the security setup.

This command will turn of the firewall

{Login} service iptables stop

This command will stop the iptables services starting on boot

{Login} chkconfig iptables off

This will show if the iptables will restart each number corresponds to a run level as shown in the screenshot below

{Login} chkconfig –list iptables


Step 2: Installing Apache

To install the Apache program use the following command.

[root@localhost ~]# yum install httpd


When prompted “is this ok” type y and press enter.

This command will start the Apache service

[root@localhost ~]# service httpd start

This will make sure that the Apache service will start on boot-up

[root@localhost ~]# chkconfig httpd on

As with the iptables this command will show you the run levels of the Apache services

[root@localhost ~]# chkconfig –list httpd


Step 3: Testing Apache

To check if Apache is working open a browser on your client and enter the following

http://localhost

Make sure the client you are using is on the same subnet and network as the server. If you are successful you should see the following page

Step 4: Installing MySQL

To install the MySQL database use the following command

[root@localhost ~]# yum install mysql-server

When prompted “is this ok” type y and press enter.


This command will start the MySQL service

[root@localhost ~]# service mysqld start

This will make sure that the MySQL service will start on boot-up

[root@localhost ~]# chkconfig mysqld on

Step 4: Installing PHP

To install the PHP use the following command

[root@localhost ~]# yum install php

When prompted “is this ok” type y and press enter.

This will give you a list of modules you can install

[root@localhost ~]# yum search php | more

Step 5: Testing PHP

It is best to test if PHP is working before carrying on by creating a simple script. First of all change the directory you are currently in by entering the following command

[root@localhost ~]# cd /var/www/html

This should now put you in the html directory, note the change in prompt or else type

{Login} pwd


We will now create a .php file by using a built in text editor named nano. This is similar to vi editor but much easier to use and navigate around in. The next step is to create a file named index.php stored in the html directory by issuing the command below

[root@localhost  html]# nano index.php

Inside the file enter the following code exactly the way it is displayed below

<?php phpinfo(); ?>


To save the file simply press [ctrl] and X which will then prompt you to save the file which you should press Yes. This will save the file in the html directory.

Restart the apache server by using the following command

[root@localhost ~]# service httpd restart


To check if PHP is working open a browser on your client and enter the following

http://youripaddress/index.php

Example: http://192.168.158.137/index.php

To find your ip address use the ifconfig command

[root@localhost ~]# ifconfig


If this is successful you should see the following page in your browser

Installing LAMP Part 2

Step 6: Updating PHP

First we need to go to the yum.repos.d directory by issuing this command

[root@localhost ~]# cd /etc/yum.repos.d

We then have to save the centos-Testing.repo to the yum.repos.d directory by installing it from the centos website

Please note: This command is case sensitive and all one line

[root@localhost yum.repos.d]# wget http://dev.centos.org/centos/5/CentOS-Testing.repo

Now we need to update all the php modules. When prompted by each command “is this ok” type y and press enter.

Please note: some may be up to date so you will get an output of “no packages marked for update”

[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update php

[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update mysql


[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update php-mysql


[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update php-gd


[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update php-mbstring


[root@localhost yum.repos.d]# yum –enablerepo=c5-testing update httpd

Installing a CentOS Server Part 2

Step 9: Setup time zone

This is an important step to choose the right time zone as this will put a timestamp on any of the logs and is hard to change when setup so I would suggest doing this right.

Pick your country either on the map or from the drop down list and un-tick System Clock Uses UTC which stands for Universal Time Coordinated. Then click Next.

Step 10: Setting a Root Password

Set a root password in the box below and repeat in the second box. I would suggest use a password with Higher and Lower Case letters, and also include numbers. If you want to make it stronger I would also enter symbols. A great way to create a password that you will remember is to play with the words for example:
Wireless = W1r3L3ss
This will prevent any intruders which may run a dictionary attack. A dictionary attack is when they run a simple program to try every word in the dictionary until they get access.

Once you have chosen a suitable password click Next


Step 11: Selecting Server Mode

This is an important part of the installation. This is where you decide if you want a operating system with a GUI or a server. To install the server which we are doing un-tick all the boxes in the top window.

After that we need to select on what type of tools we want to be installed. Select customize now and click Next

Step 12: Selecting Tools

On the left hand side you have a list with each list containing many tools start from the top and select the tools listed below. If the tools are not listed below please remove them.

Applications
• Editors

Development
• Development Tools

Base System
• Base

Click Next to continue

Step 13: Running the Installation
To run the installation with all your settings click Next otherwise select Back and change any settings you my have missed.

Step 14: Rebooting

You have successfully installed the CentOS server, now click on Reboot to restart the server and remove your CentOS DVD from your DVD-Drive.

Step 15: First Boot of the CentOS Server

You will be welcomed by a Setup Agent window to modify some changes. I would recommend turning off the firewall for now to eliminate any trouble you may have in the next steps.

Step 16: Prompt Screen
You will now be prompted for your username and password to log into the server.

Please note: You will not get a response on the screen while typing in password

Installing a CentOS Server Part 1

Creating a CentOS DVD

First you need to download a copy of CentOS from here CentOS 5.4 DVD.iso. This is an .iso image of the full DVD. An .iso image is an exact copy of a DVD in one file which will need to be burned to a DVD to unpack the data. To do so there are many free iso burners out there that will to the job but I have included one which is easy to use Free ISO Burner Application. Install this application and Insert a blank DVD into your DVD Drive on your computer. Select the CentOS iso image you have just downloaded and copy it to the DVD using the ISO burner application. You should now have a full working CentOS DVD.

Please note: If you do not use the link above to download the CentOS DVD and decide to get it from another source please make sure it is the full DVD and not the Live CD as this will only install the operating system and not the server which we will need for this guide.

Steps on installing CentOS Server

Now I will give you a step by step guide to installing a CentOS Server. If you don’t understand any steps or have any questions please leave a comment on my blog here My WordPress Blog and I will answer back as soon as I can.

Step 1: Booting off the DVD

When booting up your server make sure to change your boot options to boot off DVD-drive. Servers/PCs have different ways of entering this option due to bios types. Please consult the manufactures website or manual for steps on how to perform this task.

Once the server boots off the DVD you should see the same screen as below:

Click Enter to continue

Step 2: Testing the DVD

This will test the DVD to check that it is in working order, I usually run this test to make sure everything is working before I continue as I do not want to run into problems later on. It takes a few minutes but worth it in the long run. You can skip it if you feel like it or if you are confident that the disk is in working order.

Click OK to run the test or Skip to move onto the next stage.

Step 3: Loading of the installation & release notes

This will load some settings to begin the Install. You can also read the release notes which I would advise because they are full of useful information. When you are ready you can just proceed by clicking Next.

Step 4: Selecting a language

This is step is self explanatory, Choose the language you are most familiar with. I would also take into consideration if other administrators are using this server to keep them in mind. Click Next to continue to next step.

Step 5: Selecting a Keyboard Layout

Select the keyboard Layout you will be using. The most common problem people make is picking an American English keyboard when In fact they have a United Kingdom keyboard layout. They look pretty similar but have small differences like where the @ symbol is replaced by the “ symbol and could cause some confusion. Select your keyboard layout and click Next

Step 6: Partition Table Warning

You will now receive a warning as shown in the screenshot below. If you have any important information on this hard drive I would suggest strongly to back up any data to prevent any information lost. In this guide we will be using a blank hard drive so you can click Yes

Step 7: Partition Layout

In this step you have two options, the first is to let the installation use a default configuration or you can manually configure the partitions yourself. If you decide to use the default configuration click Next and proceed.

If you want to manually configure the partitions yourself tick the “review and modify partitioning layout” box and click Next.

Please note: I would recommend taking the default option if you are new to partitioning hard drives. For this guide I will be using the default layout.

Step 8: Setting up Network Connection

In this step we will look at setting up a network connection for the server. You can let your router issue you an ip address by clicking Next

I would suggest manually configuring a static ip address so the server will have the same ip address every time the server is booted up. This also comes in handy when setting up security which we will look at in greater detail later.

Hello world!

Welcome to my blog. My name is David Daly and I am currently a student at Cork Institute of Technology. Over the next few weeks I will be keeping a log of how I am going to Install Moodle on a Cent OS server as part of a project. This will be a step by step guide on the following topics:

Step 1: How to install CentOS Server

Step 3: Installing LAMP

Step 4: Installing myPhpAdmin

Step 5: Installing Moodle

Step 6: Security steps

I will be using VMWare workstation to show you how to go about each step in greater detail. These steps will also be altered and added to as the weeks go on. please feel free to leave any comments or questions you may have. video clips will also be added!