Build lamp under Ubuntu server

Source: Internet
Author: User
Tags php mysql

1993 Debian was born in Linux, October 2004, Ubuntu was derived from Debian, Ubuntu version number according to the year + month way name, The latest is 14.10 (updated every six months), I use Ubuntu14.10, but it is recommended to use the 14.04.1 lts version.

Software Environment: Windows7 + vmware4.3.20 + Ubuntu14.10 + xshell5 + Filezila

Lamp:linux + Apache + MySQL + PHP (netease ubuntu Source)

Lamp Explanation: Can be like a person's outfit, from hats, tops, trousers, shoes set:

The principle of lamp: User accesses Apache via browser, Apache through libphp5.so can call PHP parser to work, execute the relevant PHP part of the code, PHP mysql.so can connect to MySQL curd operation, the data back to PHP, back to Apache, and finally to the user interface.

1: General use of Virtual box installed VM using the NAT network connection mode, the default host ping different virtual machine, you can add a host-only network card to Win7 and Ubuntu communication, After configuration (ifconfig) may not show eth1, you can add configuration and restart Network service:

2: Attempt to connect, failed, sshd service turned on? Install Openss-server, use Ps–e | grep "sshd" View service is running, connect again, success ...

Under 3:ubuntu, set the root password.

4: Installation Apache2, sudo apt-get install apache2;

5: Install PHP5;

6: Install mysql-server;

7: Install Php5-mysql, view/etc/php5/conf.d/under Look for mysql.so, can not find, to install php5-mysql; restart MySQL and Apache

8: Create phpinfo () view lamp installation;

Echo ' Root ' ' Password ' " Do not worry db " " db Dump " ;p hpinfo ();

9: Add common Library to PHP: Install GD library, curl;

sudo Install php5-gd Curl libcurl3 Libcurl3-dev Php5-curl

Restart Apache to view the installation results.

10: Transfer files via Filezila, it is best to use root user login to transfer files:

Using Filezila login ubuntuserver may fail to log in, because the root password has been set previously, here is only the second: Modify/etc/ssh/sshd_config, will Promitrootlogin Without-password set to Promitrootlogin Yes, restart the SSH service. You can then upload or download the file.

Directory structure of the 11:apache:

The Apache default directory/etc/apache installed by Apt-get mode:

. ├──apache2.conf├──conf-available├──conf-enabled├──envvars├──magic├──mods-  Available├──mods-enabled├──ports.conf├──sites-available└──sites-enabled

Apache loads the apache.conf, loads the specified file from the include, where mods-* refers to the loaded module, sites-* specifies the site to load, where available refers to the load, and the enabled refers to the loaded:

configuration file for MySQL configuration file my.conf,php php.ini

12: Virtual Host principle:

Set up three level two websites via Apache: video.ggmarks.com,bbs.ggmarks.com,oa.ggmarks.com.

First set up the Hosts file:

diff 192.168. 56.101         video.ggmarks.com192.168. 56.101         bbs.ggmarks.com192.168. 56.101        Oa.ggmarks.com

To create a directory:

wwwgg/├──bbs├──oa└──video

Under/etc/apache2/sites-avaiable/copy 000-default.conf to video, modify file Video:

/wwwgg/video

In sites-enabled soft connect video.conf---> video, note that this must be *.conf, because in apache.conf the. sites-enabled file is loaded in conf:

/etc/apache2/#       |-- apache2.conf#       |       '--  ports.conf#       |--mods-enabled#       |       | --*.       load#|       '---*.       conf#|--conf-       enabled#|       '--*. conf#       '--sites-enabled#               '--*.conf

Restart Apache, Access video.ggmarks.com, 403 errors may occur, modify the Video,bbs,oa in Sites-available again, add permissions:

<Directory/path>                Options Indexes followsymlinks multiviews                allowoverride all                Require all Granted        </Directory>

It can be accessed normally.

Migration of 13MYSQL data directories:

Stop the MySQL service, MySQL storage directory/var/lib/mysql, create mysqldata under '/', modify Mysql:mysql, assign permissions 700, and then copy files to the specified folder Modify the DataDir in the my.conf, set up a new storage directory, modify the/etc/apparmor.d/usr.sbin.mysqld, modify the permissions:

#  /var/lib/mysql/ r,#  /var/lib/mysql** rwk,  /mysqldata/r,  /mysqldata/** RWK,

Create the Ggmarks database in MySQL:

[Email protected]:/mysqldata# lltotal28696drwx------5MySQL MySQL4096Jan -  A: -./drwxr-xr-x -Root root4096Jan -  A: -.. /-rw-r--r--1Root root0Jan -  +: -debian-5.5. flagdrwx------2MySQL MySQL4096Jan -  A: -GGMARKS/-RW-RW----1MySQL MySQL18874368Jan -  A: -ibdata1-RW-RW----1MySQL MySQL5242880Jan -  A: theIb_logfile0-RW-RW----1MySQL MySQL5242880Jan -  +: -ib_logfile1drwx------2MySQL Root4096Jan -  +: +MYSQL/-RW-RW----1Root root6Jan -  +: +mysql_upgrade_infodrwx------2MySQL MySQL4096Jan -  +: +performance_schema/

Build lamp under Ubuntu server

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.