Establish the LAMP (linux+apache+mysql+php) development environment on Ubuntu 14.04 Operating System

Source: Internet
Author: User
Tags php development environment

########################################################

Step one:update the software package in your operation system.

The COMMAND you CAN TYPE into YOUR CONSOLE

#apt-get Update

#apt-get dist-upgrade-y--force-yes

########################################################

Step two:install Apache2 Web Server environment.

The COMMAND you CAN TYPE into YOUR CONSOLE

#apt-get Install apache2 apache2-bin apache2-data apache2-doc apache2-mpm-prefork apache2-utils

Need to modify its default Home page. (/etc/apache2/mods-enabled/dir.conf)

<ifmodule mod_dir.c>    directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm</ Ifmodule>

Modify it, like this as following show.

<ifmodule mod_dir.c>    directoryindex index.php index.html index.cgi index.pl index.xhtml index.htm</ Ifmodule>

After this, you still need to restart your Apache server. So I think the following command with to execute.

The COMMAND you CAN TYPE into YOUR CONSOLE

#service apache2 Restart

At last, you want-verify this step whether it works well. You are only having to open your browser and type your machine's IP or localhost into the URL input-box.

I believe you'll see the Apache2 Ubuntu Default Page.

If you can see this page, you are enough reason to believe so you have succeed to install the Apache Web server on your System. It ' s great.

########################################################

Step Three:start up the Pseudo-static componnet (which named Mod_rewrite component).

The COMMAND you CAN TYPE into YOUR CONSOLE

#a2enmod rewrite
#service apache2 Restart

########################################################

Step four:create a user for management and setting up multi-site.

First thing need to do, creating its home directory '/home/username '

The COMMAND you CAN TYPE into YOUR CONSOLE

#mkdir/home/username

#adduser username-d/home/username (#comment: What username, it's up to you)

#passwd username

Enter New UNIX Password:

Retype new UNIX Password:

Enter new Unix Password:retype new Unix Password:passwd:password updated successfullychanging the user information for LA  Ozuoenter the new value, or press ENTER for the defaultfull Name []:room number []:work phone []:home phone] []:other []:is The information correct? [y/n]

And then we need to create a directory to the store our site files and log files.

The COMMAND you CAN TYPE into YOUR CONSOLE

#cd/home/username

#mkdir public_html Logs

You need to set it permission for this user after you create the This directory. Or we can not upload our site file to this folder or edit these file had existted on the website.

The COMMAND you CAN TYPE into YOUR CONSOLE

#chown Username:www-data-r/home/username/public_html/home/username/logs

#chmod 755-r/home/username

The important thing you need to note this going to configure your website.

At the begining, you just need to disable 000-default.conf configuration.

The COMMAND you CAN TYPE into YOUR CONSOLE

#a2dissite 000-default.conf
#service Apache2 Reload

The other important thing is so you need to write your own site ' s configuration.

The COMMAND you CAN TYPE into YOUR CONSOLE

#mv 000-default.conf XXXX. Xxx.conf

Modify this configuration file.

<virtualhost *:80>    ServerName laozuo.org    serveralias laozuo.org    ServerAdmin [email protected]    documentroot/var/www/html    Errorlog ${apache_log_dir}/error.log    customlog ${apache_log_dir}/access.log combined        <directory/var/ www/html>    Options Indexes execcgi includes followsymlinks multiviews    allowoverride all    Order Deny, Allow #Here, and you must note this deny,allow without any blank-space. If you leave the Blank-space, you'll encounter a error when you want to restart your Apache server.    Allow from all    </Directory></VirtualHost>

Saved It later, you need to start and our website.

The COMMAND you CAN TYPE into YOUR CONSOLE

#a2ensite XXXX. Xxx.conf

If you fail to launch it, I only suggest you go to check its log out. The log would restore on The/var/log/apache2/error.log file.


########################################################

Step Five:install and Configuration MySQL Database

The COMMAND you CAN TYPE into YOUR CONSOLE

#apt-get Install Mysql-server mysql-client

During the installation epriod, you has to type the same password The Times. And then you don ' t had to do anything except for waitting until it had been completedly installed.

########################################################

Step Six:install and Configure the PHP development environment.

The COMMAND you CAN TYPE into YOUR CONSOLE

#apt-get install php5 php-pear php5-mysql php5-dev libapache2-mod-php5 php5-dev php5-curl php5-gd Php5-imagick Php5-mcrypt

After finishing-to-install these software package, you can go to the "/var/www/html/" directory.

One Important thing you need to the finish here's that the create a PHP file to verify if it works normally.

The COMMAND you CAN TYPE into YOUR CONSOLE

#cd/var/www/html

#vim info.php

<? php    phpinfo();? > 

Saved it after your finish to write some code like this.

Please open your browser to verify the execitting moment and type your machine ' s ip/info.php or localhost/info.php.

You'll see some amazing thing. Showing as following screenshot:

########################################################

Step Seven:install PHPMyAdmin

Why does we need to the install this software? Maybe want to know the answer.

I'll tell you it's useful to manage our SQL Database. So we need to install this guy to help us do something.

The COMMAND you CAN TYPE into YOUR CONSOLE

#apt-get Install Phpmysqladmin

It requires us to select its supportive version.

I suggest you can choose the apache2.

Under this process, It also requires your to type your MySQL ' s root password. Maybe need to type it.

That's all.

So we LAMP development environment has been established. It ' s an amazing thing.

Thank watching here. It ' s my pleasure to share something I know. Hope that It Can help you.

I have to go asleep. Have a good time. Good luck!

Establish the LAMP (linux+apache+mysql+php) development environment on Ubuntu 14.04 Operating System

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.