Anda di halaman 1dari 17

CentOS Linux Session 11: Installing LAMP on CentOS

IT Lecturer: Ng nh Cng

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

Change hostname on CentOS


2. Hosts File

Change the host that is associated to your main IPaddress for your server, this is for internal networking cat /etc/hosts

3. Run Hostname

The 'hostname' command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.

Change hostname on CentOS

4. Restart Networking At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot: service network restart or /etc/init.d/network restart

Installing Apache with PHP and MySQL 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:

Installing Apache with PHP and MySQL Support on CentOS (LAMP)

Step 2: Installing Apache2 Apache2 is available as a CentOS package, therefore w can install it: Configure the system:

Start Apache:

Installing Apache with PHP and MySQL Support on CentOS (LAMP)

Installing Apache with PHP and MySQL Support on CentOS (LAMP)


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

Must restart Apache afterward:

Installing Apache with PHP and MySQL Support on CentOS (LAMP)

Step 4: Testing PHP5 The document root of the default web site is /var/www/htm Create a php file that displays lots of useful details abou PHP installation:

Installing Apache with PHP and MySQL Support on CentOS (LAMP)


=> http://localhost/info.php

Installing Apache with PHP and MySQL Support on CentOS (LAMP)


Step 5: Getting MySQL Support in PHP5 To get MySQL support in PHP, we can install the phpmysql package. Search for available PHP5 modules :

Pick the ones you need and install them like this:

Installing Apache with PHP and MySQL Support on CentOS (LAMP)


Restart Apache: Reload http://192.168.0.100/info.php

Create an Apache HTTP Virtual Hos


Step 1: Open up the apache configuration

Step 2: Make sure that this line is uncommented

Create an Apache HTTP Virtual Host


Step 3: Set up the virtual host in this file

Create an Apache HTTP Virtual Ho

Create an Apache HTTP Virtual Host


Step 4: Put the domain name in the hosts file

Step 5: Restart Apache

Create an Apache HTTP Virtual Host

Anda mungkin juga menyukai