ubuntu搭建Lamp环境
1.下载安装包
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.19-linux-glibc2.5-i686.tar.gz
wget http://apache.dataguru.cn//httpd/httpd-2.2.27.tar.gz
wget http://cn2.php.net/distributions/php-5.5.13.tar.gz
2.安装Mysql
cd /usr/local
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql.*.tar.gz
mv mysql.* mysql
cd mysql
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
./bin/mysql_safe --user=mysql & 启动进程并放到后台执行
./bin/mysqladmin -uroot -p password 123456 (修改密码)
./mysql -u root -h 127.0.0.1 -p 回车输入密码 (命令行登录)
3.安装apache
sudo apt-get install build-essential 安装gcc
gcc--version 查看gcc版本号
sudo tar -zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
sudo ./configure --prefix=/usr/local/apache --enable-so
sudo make
sudo make install
cd /usr/local/apache/bin
sudo ./apachectl start
4.安装PHP
sudo tar -zxvf php-5.5.13.tar.gz
编译:指定安装目录、关联apache2、关联mysql
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
问题:configure: error: xml2-config not found. Please check your libxml2 installation
sudo apt-get install libxml2-dev
sudo make
sudo make install
sudo cp php.ini-development /usr/local/php/lib/php.ini 将php.ini拷贝到bin目录
sudo /usr/local/apache/bin/apachectl restart