installing lamp on centos

Upload: red-dvs

Post on 04-Jun-2018

241 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Installing LAMP on CentOS

    1/17

  • 8/14/2019 Installing LAMP on CentOS

    2/17

    Change hostname on CentOS

    1. Sysconfig / Network Open the /etc/sysconfig/network file with your favorite text

    editor. Modify the HOSTNAME= value to match your FQDN

    host name.

    cat /etc/sysconfig/network

    vi /etc/sysconfig/network

  • 8/14/2019 Installing LAMP on CentOS

    3/17

    Change hostname on CentOS

    2. Hosts File Change the host that is associated to your main IPaddress fo

    your server, this is for internal networking

    cat /etc/hosts

    3. Run Hostname

    The 'hostname' command will let you change the hostname othe server that the commandline remembers, but it will not

    actively update all programs that are running under the old

    hostname.

  • 8/14/2019 Installing LAMP on CentOS

    4/17

    Change hostname on CentOS

    4. Restart Networking At this point all the necessary changes that needed t

    be made have been made, you will want to restart

    networking on your server to make sure that change

    will be persistent on reboot:

    service network restart

    or

    /etc/init.d/network restart

  • 8/14/2019 Installing LAMP on CentOS

    5/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Step 1: Installing MySQL 5 Installing command:

    Create the system startup links for MySQL and start the

    MySQL server:

    Set passwords for the MySQL root account:

  • 8/14/2019 Installing LAMP on CentOS

    6/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Step 2: Installing Apache2Apache2 is available as a CentOS package, therefore

    can install it:

    Configure the system:

    Start Apache:

  • 8/14/2019 Installing LAMP on CentOS

    7/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

  • 8/14/2019 Installing LAMP on CentOS

    8/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Step 3: Installing PHP5 Install PHP5 and the Apache PHP5:

    Must restart Apache afterward:

  • 8/14/2019 Installing LAMP on CentOS

    9/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Step 4: Testing PHP5The document root of the default web site is/var/www/ht

    Create a php file that displays lots of useful details abo

    PHP installation:

  • 8/14/2019 Installing LAMP on CentOS

    10/17

  • 8/14/2019 Installing LAMP on CentOS

    11/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Step 5: Getting MySQL Support in PHP5To get MySQL support in PHP, we can install thephp-

    mysqlpackage.

    Search for available PHP5 modules :

    Pick the ones you need and install them like this:

  • 8/14/2019 Installing LAMP on CentOS

    12/17

    Installing Apache with PHP and MySQ

    Support on CentOS (LAMP)

    Restart Apache:

    Reload http://192.168.0.100/info.php

  • 8/14/2019 Installing LAMP on CentOS

    13/17

    Create an Apache HTTP Virtual Ho

    Step 1: Open up the apache configuration

    Step 2: Make sure that this line is uncommented

  • 8/14/2019 Installing LAMP on CentOS

    14/17

    Create an Apache HTTP Virtual Host

    Step 3: Set up the virtual host in this file

  • 8/14/2019 Installing LAMP on CentOS

    15/17

  • 8/14/2019 Installing LAMP on CentOS

    16/17

    Create an Apache HTTP Virtual Host

    Step 4: Put the domain name in the hosts file

    Step 5: Restart Apache

  • 8/14/2019 Installing LAMP on CentOS

    17/17