Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install web server in centos 5.5

Leer en espanol
Install web server in centos 5.5

Table of contents

As we have already talked about before, centOS is a popular distribution based on Red Hat and it is the most used to set up servers, especially Webs, because this manual is based on that, we are going to install a web server under CentOS 5.5

To do this we require an installation, preferably without a graphical interface.

CentOS 5.5 installation manual

Configure static addressing

To do this, first we are going to configure a static addressing.

The network card configuration files are located in: /etc/sysconfig/network-scripts/

We access the folder:

Bash
[rokitoh@red.orbita.com~] # cd /etc/sysconfig/network-scripts/

we configure the file ifcfg-eth0 which is where the information is found

Bash
[rokitoh@red.orbita.com network-scripts] # nano ifcfg-eth0

and there we configure it:

text
DEVICE=eth0

BOOTPROTO=static   #configuración estatica

BROADCAST=192.168.1.255 #dirección de broadcast

HWADDR=05:02:4A:5C:EE:9F  # Dirección MAC

IPADDR= 192.168.1.150  # Ip de la interfaz de red

NETMASK= 255.255.255.0  # Máscara de red

NETWORK= 192.168.1.0 # Red en la que se encuentra

ONBOOT=yes  # Arranque automático al inicio del sistema

GATEWAY= 192.168.1.1 # Puerta de enlace

TYPE=Ethernet

We restart the network:

Bash
[rokitoh@red.orbita.com~] # /etc/init.d/network restart

We verify that the changes have been made:

Bash
[rokitoh@red.orbita.com~] # sbin/ifconfig

Install apache and php

Bash
[rokitoh@red.orbita.com~] # yum install -y httpd php php-mysql mod_perl mod_python mod_ssl

Once Apache is installed, we will configure it to start automatically:

Bash
[rokitoh@red.orbita.com~] # /sbing/chkconfig –levels 235 httpd on

we start the web server:

Bash
[rokitoh@red.orbita.com ~] # /etc/init.d/httpd start

We open a browser and access the web server, in my case: http://192.168.1.150
and a screen like this should appear:

Centos apache welcome

We check if we really have a php service, for this we are going to create a file called: test.php

Bash
[rokitoh@red.orbita.com ~] # nano /var/www/html/test.php

In the file we put the following code:

text
phpinfo(); ?>

We open a browser and access the saved file: http://192.168.1.150/test.php

If everything has gone well, it will show us a screen like this:

Pantallazo 4

Install mysql

Bash
[rokitoh@red.orbita.com ~] # yum install mysql mysql-server

Once Apache is installed, we will configure it to start automatically:

Bash
[rokitoh@red.orbita.com ~] # /sbing/chkconfig –levels 235 mysqld on

we start mysql:

Bash
[rokitoh@red.orbita.com ~] # /etc/init.d/mysqld start

If we access the file that we created "test.php" again and go down,

We will see that mysql is installed perfectly, we access the browser and go to the web server:

http:192.168.1.150/test.php

and we look for mysql

Pantallazo 5

Install phpmyadmin

We access the web directory:

Bash
[rokitoh@red.orbita.com ~] # cd /var/www/html

we download phpmyadmin

Bash
[rokitoh@red.orbita.com html] # wget http://byet.org/phpMyAdmin-3.3.5-all-languages.tar.gz

We decompress

Bash
[rokitoh@red.orbita.com html] # tar xvzf phpMyAdmin-3.3.5-all-languages.tar.gz

We access the folder:

Bash
[rokitoh@red.orbita.com html] # cd phpMyAdmin-3.3.5-all-lenguages

We make a backup copy of the configuration, so that what could happen...

Bash
[rokitoh@red.orbita.com phpMyAdmin-3.3.5-all-lenguages]  # cp config.sample.inc.php config.inc.php

We configure config.inc.php

Bash
[rokitoh@red.orbita.com phpMyAdmin-3.3.5-all-lenguages] # nano config.inc.php

Once you are inside the file, look for this string:

text
/* Authentication type */

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;

#Replaces the value of 'cookie' by 'http', so it would look like this:

text
/* Authentication type */

$cfg[‘Servers’][$i][‘auth_type’] = ‘http’;

We restart the service and if everything went well, a window like this should appear:
We identify ourselves with username and password.

Phpmyadmin

Pantallazo 6

In case you get an error like this:

text
PHP 5.2+ is required

It is due to the version of your php, you will have to update to 5.2
First we will add the repository:

Bash
[rokitoh@red.orbita.com ~] # nano -w /etc/yum.repos.d/utterramblings.repo

we add

config
[utterramblings]
name=Jason’s Utter Ramblings Repo

baseurl=http://www.jasonlitka.com/media/EL5/i386/

enabled=0

gpgcheck=1

gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
Now we are ready to do:
Bash
[rokitoh@red.orbita.com ~] # yum upgrade php –enablerepo=utterramblings

We have already finished our installation, it is a somewhat basic configuration... but hey, we will configure more directives in it.

Regards, rokitoh

Comments