Ubuntu Server 12.04 LTS Installation lamp environment

Source: Internet
Author: User
Tags curl phpmyadmin

Ubuntu's lamp environment Apt-get one-click setup:

sudo apt-get install apache2 php5 mysql-server php5-mysql

Ubuntu lamp Environment Tasksel with one click: (Tasksel offers some common Ubuntu software packages)

sudo tasksel install Lamp-server

Apache Default Web site root directory:/var/www


is the environment working properly tested:

sudo vim info.php

<?php echo "This is the test lamp environment is working properly";    echo ' <br/> '; echo mysql_connect (' localhost ', ' root ', ' 123456 ')?    ' Database working properly ': ' Database connection error '; Phpinfo ();? >

Add common extensions to PHP:

sudo apt-get install php5-gd curl libcurl3 Libcurl3-dev Php5-curl


Lamp each component configuration file location:

Apache:/etc/apache2

Mysql:/etc/mysql

Php:/etc/php5


Lamp Environment Configuration-apache:

Core configuration (mods-*** Apache module; site-*** Virtual Host)

Keyword available can be used; enable enabled

Available→ln-s establishing a soft connection →enable

Lamp environment Configuration-mysql and PHP:

MySQL Core configuration file: my.cnf

PHP Core configuration file: PHP.ini


To configure a virtual host in Apache:

Cd/etc/apache2/sites-available/sudo cp default video #复制虚拟主机默认配置文件, video host configuration has its template sudo cp default BBS #复制虚拟主机默认配置文件, BBS The host configuration has its template sudo vim video #编辑video主机配置文件 ServerName video.liuxiao.com #添加这一行 documentroot/wwwroot/video #修改video网站 Root directory Directory/wwwroot/video #使用户有访问权限sudo vim bbs #方法同上cd. /sites-enable/sudo ln-s. /sites-available/video 001-video #启用video主机sudo ln-s. /sites-available/bbs 002-bbs #启用bbs主机sudo Service apache2 Restart #重启Apache


MySQL Data store Directory Migration: (original default directory:/var/lib/mysql)

sudo service MySQL stopsudo mkdir/mysqldata #迁移目录sudo chown-vr mysql:mysql/mysqldata/sudo chmod-vr 700/MYSQLDATA/CP -av/var/lib/mysql/*/mysqldata/#切换为root执行sudo vim/etc/mysql/my.cnf #修改MySQL配置文件 datadir =/mysqldata #修改数据存储目录sud o vim/etc/apparmor.d/usr.sbin.mysqld #修改apparmor对MySQL的配置文件 #/var/lib/mysql/r, #/var/lib/mysql/** RWK, #注释这两 Line/MYSQLDATA/R,/mysqldata/** rwk, #添加这两行sudo service apparmor reload #重启apparmorsudo service MySQL start #启动 Mysql

MySQL Data migration verification:

Mysql-u root-p #登录MySQLcreate database testdb;   #创建testdb数据库show databases; #查看exit #退出数据库ll/mysqldata/#root查看, whether there is a testdb directory, there is a success


Install phpMyAdmin:

Apt-get Way:

sudo apt-get install phpmyadmin sudo ln-s/usr/share/phpmyadmin//var/www/phpmyadmin

Manual Upload Method:

Upload the phpMyAdmin file to the site Directory

Open MySQL Remote access: (default MySQL can only be accessed locally, to remotely need to open remote access)

sudo vim/etc/mysql/my.cnf #bind-address = 127.0.0.1 #注释这一行, this behavior is a whitelist of MySQL access

Add a MySQL user with remote access to MySQL (can be added with the phpMyAdmin tool)

sudo service MySQL restart


This article is from the "we_need_to_try" blog, make sure to keep this source http://liuxiao255.blog.51cto.com/10551403/1837776

Ubuntu Server 12.04 LTS Installation lamp environment

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.