使用docker搭建LAMP环境

环境:Centos7.4
[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

Get the most up-to-date version of Docker
https://get.docker.com

(This script is meant for quick & easy install via:)
[[email protected] ~]# curl -fsSL https://get.docker.com -o get-docker.sh
[[email protected] ~]# sh get-docker.sh

[[email protected] ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[[email protected] ~]# docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:22 2018
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:19:08 2018
OS/Arch: linux/amd64
Experimental: false

[[email protected] ~]# docker search -s 10 lamp
Flag --stars has been deprecated, use --filter=stars=3 instead
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
linode/lamp LAMP on Ubuntu 14.04.1 LTS Container 157
tutum/lamp Out-of-the-box LAMP image (PHP+MySQL) 108
greyltc/lamp a super secure, up-to-date and lightweight L猞 92 [OK]
mattrayner/lamp A simple LAMP docker image running the prere猞 55 [OK]
fauria/lamp Modern, developer friendly LAMP stack. Inclu猞 46 [OK]
janes/alpine-lamp lamp base on alpine linux 36 [OK]
nickistre/ubuntu-lamp LAMP server on Ubuntu 26 [OK]
nickistre/centos-lamp LAMP on centos setup 24 [OK]
dgraziotin/lamp 11 [OK]
lioshi/lamp Docker image for LAMP + MySql under debian 10 [OK]

到docker hub的官网去搜索linode/lamp这个镜像,可以查看到他的具体使用说明(查看具体使用说明,避免走弯路)
https://hub.docker.com/r/linode/lamp

[[email protected] ~]# docker pull linode/lamp (下载镜像)
Using default tag: latest
latest: Pulling from linode/lamp
a3ed95caeb02: Pull complete
76a4cab4eb20: Pull complete
d2ff49536f4d: Pull complete
f94adccdbb9c: Pull complete
808b5278afbb: Pull complete
ab367f87d978: Pull complete
Digest: sha256:4b7af614899c795aa30cb60b62c28b978201c2dca3fb1352a60fec206edb92de
Status: Downloaded newer image for linode/lamp:latest

[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
linode/lamp latest 2359fa12fded 3 years ago 372MB

建立docker卷
[[email protected] ~]# docker volume create lamp_www
[[email protected] ~]# docker volume create lamp_apache_conf
[[email protected] ~]# docker volume create lamp_mysql_conf
[[email protected] ~]# docker volume create lamp_mysql_data

在宿主机创建 /var/lib/docker/volumes目录
[[email protected] ~]# mkdir /var/lib/docker/volumes

启动镜像
[[email protected] ~]# docker run -it -p 80:80 -p 3306:3306 -v lamp_www:/var/www -v lamp_apache_conf:/etc/apache2 -v lamp_mysql_conf:/etc/mysql -v lamp_mysql_data:/var/lib/mysql --name lamp linode/lamp /bin/bash
(docker run:运行一个container,如果后面要绑定宿主主机的0-1024端口需要使用sudo,因为是Ubuntu)
( -p port1:port2: 将宿主机的端口port1映射到容器中的port2)
(-v volume:path: 将宿主机的docker卷映射到容器中的指定的路径)
( -t -i linode/lamp /bin/bash:使用linode/lamp生成容器,并打开shell)
现在已经进入到了容器内。如果想退出容器,请不要使用exit或ctrl+d.这样会将容器直接关闭.
退出请使用ctrl + p ,然后 ctrl + q
上面的启动命令中一共映射了四个路径,分别是apache的web根目录,apache和MySQL的两个主配置文件,及MySQL的数据目录.这些都是为了方便我们后续直接在宿主机上对配置文件和web文件的修改进行的操作,利用docker卷映射了数据库的目录也能保证镜像再次运行的时候数据不会丢失.

[[email protected] ~]# ls -la /var/lib/docker/volumes
total 24
drwx------. 8 root root 255 Dec 1 13:41 .
drwx--x--x. 15 root root 200 Dec 1 10:56 ..
drwxr-xr-x. 3 root root 19 Dec 1 13:41 lamp_apache_conf
drwxr-xr-x. 3 root root 19 Dec 1 13:41 lamp_mysql_conf
drwxr-xr-x. 3 root root 19 Dec 1 13:41 lamp_mysql_data
drwxr-xr-x. 3 root root 19 Dec 1 13:41 lamp_www

进入lamp_mysql_data这个卷的目录,可以看到镜像中的数据库目录已经映射到宿主机里了. 这个卷只要不删除,其数据就一直存在其中.这样避免了镜像重启后数据丢失的情况.
[[email protected] ~]# ls -la /var/lib/docker/volumes/lamp_mysql_data
total 0
drwxr-xr-x. 3 root root 19 Dec 1 13:41 .
drwx------. 8 root root 255 Dec 1 13:41 ..
drwx------. 5 102 106 164 Dec 1 13:43 _data

[[email protected] ~]# ls -la /var/lib/docker/volumes/lamp_mysql_data/_data
total 28684
drwx------. 5 102 106 164 Dec 1 13:43 .
drwxr-xr-x. 3 root root 19 Dec 1 13:41 ..
-rw-r--r--. 1 root root 0 Feb 20 2015 debian-5.5.flag
drwx------. 2 102 106 20 Dec 1 13:43 exampleDB
-rw-rw----. 1 102 106 18874368 Feb 20 2015 ibdata1
-rw-rw----. 1 102 106 5242880 Feb 20 2015 ib_logfile0
-rw-rw----. 1 102 106 5242880 Feb 20 2015 ib_logfile1
drwx------. 2 102 root 4096 Dec 1 13:43 mysql
-rw-------. 1 root root 6 Feb 20 2015 mysql_upgrade_info
drwx------. 2 102 106 4096 Dec 1 13:43 performance_schema

在终端中对lamp环境作个性化配置
[[email protected] ~]# docker exec -i -t lamp bash

启动apache2和mysql
[email protected]:/#service apache2 start
[email protected]:/#service mysql start
( 可以通过netstat -naltp 命令查看80和3306端口有没有开启成功)
[email protected]:/# netstat -naltp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0: LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:
LISTEN 100/apache2

设置mysql允许root远程登录,及设置root的密码
[email protected]:/#smysql -u root -p
#初始密码:Admin2015

#修改root可远程登录:
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘ and host=‘127.0.0.1‘;

#修改密码:
mysql>update user set password=password("123456") where user=‘root‘;

#刷新权限
FLUSH PRIVILEGES;

mysql> quit
Bye

安装php扩展
[email protected]:/# apt-get update
[email protected]:/# apt-get install -y php5-mysql
[email protected]:/# apt-get install -y php5-gd

#然后重启apache2:
[email protected]:/# service apache2 restart

#再次确认mysql和apache2有没有安装成功:
[email protected]:/# netstat -naltp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0: LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:
LISTEN 2899/apache2

可以通过下面的命令查看服务器上有哪些php的扩展:
[email protected]:/# apt-cache search php5-*

测试结果:
[[email protected] ~]# ip add
ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:6b:22:a9 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.203/24 brd 192.168.1.255 scope global noprefixroute dynamic ens33
valid_lft 2619sec preferred_lft 2619sec
inet6 fe80::9375:cddb:5162:50f/64 scope link noprefixroute
valid_lft forever preferred_lft forever

[[email protected] ~]# curl http://192.168.1.203
<!DOCTYPE html>
<html>
<body>

<br>
<br>

<center>
<p>
The Docker LAMP stack is working.
</p>
</center>

<center>
<p>
The configuration information can be found <a href="https://registry.hub.docker.com/u/linode/lamp/">here</a&gt; or <a href="https://www.linode.com/docs/websites/hosting-a-website">here</a&gt;
</p>
</center>

<center>
<p>
This index.html file is located in the "/var/www/example.com/public_html" directory.
</p>
</center>

</body>
</html>

访问http://192.168.1.203/

测试实例
[[email protected] ~]# docker exec -i -t lamp bash

创建数据库数据
[email protected]:/# mysql -uroot -p
mysql> show databases;
mysql> create database example default charset=utf8;
mysql> show create database example \G
mysql> use example;
mysql> create table tbl (idx integer(3), UserName varchar(30), LastName varchar(50), FreeText varchar(100)) ENGINE=InnoDB AUTO_INCREMENT=1 default charset=utf8;
mysql> show create table tbl \G
mysql> show columns from tbl;
mysql> select from tbl;
mysql> insert into tbl values (1,‘Rafi‘,‘Ton‘,‘Just a test‘);
mysql> update tbl set UserName=‘Berber‘ where UserName=‘Rafi‘;
mysql> select
from tbl;
mysql> delete from tbl where idx=1 limit 1;
mysql> insert into tbl values (1,‘Rafi‘,‘Ton‘,‘Just a test‘);
mysql> select * from tbl;

数据库创建完成后在宿主机上查看,能看到上面容器中创建的数据库example
[[email protected] _data]# cd /var/lib/docker/volumes/lamp_mysql_data/_data
[[email protected] _data]# ls
debian-5.5.flag example exampleDB ibdata1 ib_logfile0 ib_logfile1 mysql mysql_upgrade_info performance_schema

创建PHP文件
[email protected]:/# cd /var/www/example.com/public_html

[email protected]:/var/www/example.com/public_html# vi links.x
<p></p>
<ul>
<li><a href="index.php">Home</a>
<li><a href="add.php">Add a new entry to the DataBase</a>
<li><a href="edit.php">Edit an entry</a>
<li><a href="del.php">Delete an entry from the DataBase</a>
</ul>

[email protected]:/var/www/example.com/public_html# vi index.php
<html>
<head><title>Web Database Sample Index</title>
</head>
<body bgcolor=#ffffff>
<h2>Data from tbl</h2>
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$select = mysql_select_db(‘example‘, $connect);
$sql="select * from tbl";
$result = mysql_query($sql, $connect);
if ($result) {
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Domain Name</td>
<td align=center bgcolor=#00FFFF>Request Date</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td>$idx</td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>
</body>
</html>

打开http://192.168.1.203/index.php,已经能看到数据

[email protected]:/var/www/example.com/public_html# vi add.php
<html>
<head><title>Add an entry to the database</title>
</head>
<body bgcolor=#ffffff>
<h1>Add an entry</h1>
<form method="post" action="add2tbl.php">
<table width=90% align=center>
<tr><td>Index:</td><td><input type=text name="idx" size=3 maxlength=3></td></tr>   
<tr><td>UserName:</td><td><input type=text name="UserName" size=40
maxlength=100></td></tr>
<tr><td>LastName:</td><td><input type=text name="LastName" size=40
maxlength=100></td></tr>   
<tr><td>FreeText:</td><td><input type=text name="FreeText" s=40 maxlength=100></td></tr>
<tr><td></td><td><input type=submit value=add></td></tr>
</form>
</table>
<?php include (‘links.x‘);?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# vi add2tbl.php
<html>
<body>
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$query = "insert into tbl values (‘{$_POST[‘idx‘]}‘,‘{$_POST[‘UserName‘]}‘,‘{$_POST[‘LastName‘]}‘,‘{$_POST[‘FreeText‘]}‘)";
$select = mysql_select_db(‘example‘, $connect);
$result = mysql_query($query, $connect);
$query = "SELECT * FROM tbl";
$result = mysql_query($query, $connect);
if ($result)
{
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>idx</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Free Text</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td>$idx</td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# vi edit.php
<html>
<head><title>Editing an entry from the database</title>
</head>
<body bgcolor=#ffffff>
<h1>Edit an entry</h1
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$select = mysql_select_db(‘example‘, $connect);
$sql="select * from tbl";
$result = mysql_query($sql, $connect);
if ($result)
{
echo "Found these entries in the database:<br>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00ffff>idx</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Free Text</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td align=center>
<a href=\"editing.php?idx=$idx&user=$user&last=$last&text=$text\">$idx</a></td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# vi editing.php
<html>
<head><title>Editing an entry</title>
</head>
<body bgcolor=#ffffff>
<h1>Editing an entry</h1>
<form method="post" action="editdb.php">
<table width=90% align=center>
<tr><td>idx:</td><td><?php echo $_GET[‘idx‘];?></td></tr>
<tr><td>UserName:</td><td><input type=text name=UserName size=40 maxlength=100
value="<?php echo $_GET[‘user‘];?>"></td></tr>
<tr><td>LastName:</td><td><input type=text name=LastName size=40 maxlength=100
value="<?php echo $_GET[‘last‘];?>"></td></tr>
<tr><td>Free Text:</td><td><input type=text name=FreeText size=40 maxlength=100
value="<?php echo $_GET[‘text‘];?>"></td></tr>
<tr><td></td><td><input type=submit value="Edit it!"></td></tr></table>
<input type=hidden name=idx value="<?php echo $_GET[‘idx‘];?>">
</form>
<?php include (‘links.x‘);?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# vi editdb.php
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$query = "update tbl set
idx=‘{$_POST[‘idx‘]}‘,UserName=‘{$_POST[‘UserName‘]}‘,LastName=‘{$_POST[‘LastName‘]}‘,FreeText=‘{$_POST[‘FreeText‘]}‘ where
idx=‘{$_POST[‘idx‘]}‘";
$select = mysql_select_db(‘example‘, $connect);
$result = mysql_query($query, $connect);
$query = "SELECT * FROM tbl";
$result = mysql_query($query, $connect);
if ($result)
{
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>idx</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Free Text</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td>$idx</td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>

[email protected]:/var/www/example.com/public_html# vi del.php
<html>
<head><title>Deleting an entry from the database</title>
</head>
<body bgcolor=#ffffff>
<h1>Del an entry</h1>
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$select = mysql_select_db(‘example‘, $connect);
$sql="select * from tbl";
$result = mysql_query($sql, $connect);
if ($result)
{
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00ffff>idx</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Free Text</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td align=center>
<a href=\"dele.php?
idx=$idx&UserName=$user&LastName=$last&FreeText=$text\">$idx</a></td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# vi dele.php
<html>
<body>
<?php
$connect = mysql_connect("localhost","root","123456") or die ("Problem connecting to DataBase");
$query = "delete from tbl where idx=‘{$_GET[‘idx‘]}‘";
$select = mysql_select_db(‘example‘, $connect);
$result = mysql_query($query, $connect);
$query = "SELECT * FROM tbl";
$result = mysql_query($query, $connect);
if ($result)
{
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>idx</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Free Text</td>
</tr>";
while ($r = mysql_fetch_array($result))
{
$idx = $r["idx"];
$user = $r["UserName"];
$last = $r["LastName"];
$text = $r["FreeText"];
echo "<tr>
<td>$idx</td>
<td>$user</td>
<td>$last</td>
<td>$text</td>
</tr>";
}
echo "</table>";
}
else
{
echo "No data.";
}
mysql_free_result($result);
include (‘links.x‘);
?>
</body>
</html>

[email protected]:/var/www/example.com/public_html# ls -la
total 40
drwxr-xr-x. 2 root root 174 Dec 1 10:09 .
drwxr-xr-x. 5 root root 51 Dec 1 05:43 ..
-rw-r--r--. 1 root root 666 Dec 1 10:04 add.php
-rw-r--r--. 1 root root 1046 Dec 1 10:05 add2tbl.php
-rw-r--r--. 1 root root 1081 Dec 1 10:07 del.php
-rw-r--r--. 1 root root 977 Dec 1 10:07 dele.php
-rw-r--r--. 1 root root 1102 Dec 1 10:05 edit.php
-rw-r--r--. 1 root root 1064 Dec 1 10:06 editdb.php
-rw-r--r--. 1 root root 800 Dec 1 10:06 editing.php
-rw-r--r--. 1 root root 492 Feb 19 2015 index.html
-rw-r--r--. 1 root root 989 Dec 1 09:49 index.php
-rw-r--r--. 1 root root 211 Dec 1 10:01 links.x

以上数据存在于宿主主机上
[[email protected] _data]# ls -la /var/lib/docker/volumes/lamp_www/_data/example.com/public_html
total 40
drwxr-xr-x. 2 root root 174 Dec 1 18:09 .
drwxr-xr-x. 5 root root 51 Dec 1 13:43 ..
-rw-r--r--. 1 root root 1046 Dec 1 18:05 add2tbl.php
-rw-r--r--. 1 root root 666 Dec 1 18:04 add.php
-rw-r--r--. 1 root root 977 Dec 1 18:07 dele.php
-rw-r--r--. 1 root root 1081 Dec 1 18:07 del.php
-rw-r--r--. 1 root root 1064 Dec 1 18:06 editdb.php
-rw-r--r--. 1 root root 800 Dec 1 18:06 editing.php
-rw-r--r--. 1 root root 1102 Dec 1 18:05 edit.php
-rw-r--r--. 1 root root 492 Feb 20 2015 index.html
-rw-r--r--. 1 root root 989 Dec 1 17:49 index.php
-rw-r--r--. 1 root root 211 Dec 1 18:01 links.x

因此:
宿主机上mysql数据目录
/var/lib/docker/volumes/lamp_mysql_data/_data
宿主机上mysql配置文件目录
/var/lib/docker/volumes/lamp_mysql_conf/_data
宿主机上网页数据目录
/var/lib/docker/volumes/lamp_www/_data/example.com/public_html
宿主机上apache配置文件目录
/var/lib/docker/volumes/lamp_apache_conf/_data

原文地址:http://blog.51cto.com/2290153/2324693

时间: 2024-10-04 13:18:42

使用docker搭建LAMP环境的相关文章

Docker下lamp环境部署!!!

项目背景: 在我们的web项目开发过程.软件测试环境.项目上线环境中我们经常需要搭建lamp环境,你可能不想每个应用场景都去搭建一个lamp环境,这个时候我们可以利用docker(容器)去把我们从繁琐的环境中解放出来,让我们更倾向于业务本身. 实验环境: vmware workstation 11 centos7.0的系统下 服务器:ip:192.168.0.33 SecureCRT (ssh远程连接软件) docker-1.8.2-10.el7.centos.x86_64 软件介绍: 下面是两

?搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机

本节所讲内容: 实战:搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机 LAMP架构:??? Linux+Apache+Mysql+PHP Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,共同组成了一个强大的Web应用程序平台. 一.安装需要的软件包 [[email protected] ~]# yum install httpd mysql-server mysql php php-mysql  -y ht

ubuntu server 14.04 LTS下搭建LAMP环境之最详细笔记之一U盘安装双系统

前言: 一直在WIN上使用PHP,不喜欢用WAMP,每次都是手动在windows配置环境,偶尔有一次装了小红帽玩了两天,感觉不是很习惯就换了回来,过了没几天见讨论LAMP环境,于是安装了ubuntu的desktop版本.安装好了环境使用了一下感觉也没有多大的意思,因为那一段时间没有怎么使用PHP,就这样又忽略掉了这一次学习的机会,直到上周日朋友最近在学习这方面的知识,说是要将一个老式电脑安装一个linux来玩玩.本文原创博客地址:http://www.cnblogs.com/unofficial

Linux手动搭建LAMP环境

当你看到标题里的“手动搭建”,你是不是会想,难不成还有“自动搭建”?当然......不是,这里的“手动搭建”是指按部就班的搭建Apache.MySQL.PHP环境,是相对于集成软件包而言的.所以你是不是能够猜到,我后续还会整理一篇通过集成软件包搭建LAMP环境的文章呢? 其实关于LAMP环境,我到现在都没有用过,好多东西也都不懂为什么要这么做,当初只是心血来潮,想自己搭建一个wiki,所以才着手研究的.我不是搞PHP的,也不是搞后端的,额......是不是暴露的太多了,仅仅是为了搭建环境而搭建环

源码搭建LAMP环境

源码搭建LAMP环境 一,LAMP环境概述: LAMP指的Linux(操作系统).ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件)和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web 服务器.是一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台.随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件形成三足鼎立之势

源码编译搭建LAMP环境&#160;

源码编译搭建LAMP环境  一.将 LAMP 相关软件包上传刡 linux 上 [[email protected] ~]# ls anaconda-ks.cfg      install.log         mysql-5.5.30.tar.gz  公共的  视频  文档  音乐 httpd-2.2.25.tar.gz  install.log.syslog  php-5.4.14.tar.bz2   模板    图片  下载  桌面 1. 安装apache [[email protect

在ubuntu搭建lamp环境

这两我一直在我的ubuntu虚拟机上 搭建lamp环境,第一天学习一些基本的指令 本人的系统是window,在vm虚拟机搭建lamp环境的 1.下载vm,安装 2.下载ubuntu服务器版  http://releases.ubuntu.com/ ,随便选择一个,我选择Ubuntu 15.04 (Vivid Vervet)下载 如图,有服务器版的和桌面版的,我搭建的是服务器,所以下载的服务版 3.在vm上安装ubuntu,在vm上选择刚才下的iso文件.略 ubuntu安装完成就这样子了. 4.

CentOS6.5下搭建LAMP环境(源码编译方式)

CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL) 学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP ,WAMP,MAMP等.这里我介绍一下LAMP环境的搭建,即Linux. Apache. MySQL .PHP环境. 一.首先安装操作系统 操作系统:centos6.5 操作系统安装步骤,此处不再详述. 备注:服务器系统采用最小化安装,安装一下GCC编译工具和一个桌面即可.如下图所示: 由于安装系统的时候我是最小化安装,只安装了一

mac下通过docker搭建LEMP环境

在mac下通过docker搭建LEMP环境境 1.安装virtualbox.由于docker是在lxc环境的容器 2.安装boot2docker,用于与docker客户端通讯 > brew update > brew install docker > brew install boot2docker 3.初始化boot2docker,也就是在virtualbox上安装一个docker的host环境 boot2docker init 此时会下载一个镜像 4.启动虚拟机host :~$ bo