Source LAMP to build a blog project

Source LAMP set up to do blog item (b)

1, centos under several installation

yum安装:yum 仓库,网络yum源,资源比较丰富
rpm包安装:简单,快速,有依赖关系
源码包安装:

安装步骤3步
安装所需要的编译工具gcc gcc-c++  cmake libtool ncurses-devel  perl glibc libxml2-devel libcurl-devel
1../configure  --prefix=绝对路径(指定安装的目录)  环境检测,Makefile 规则文件   
2.make		编译	  读取Makfile文件
3.make install  编译安装  
源码包安装

优点:
1.没有依赖关系
2.他可以跨平台
3.方便管理  

缺点:
1.安装比较麻烦
2.安装时间比较长

2, source installation apache

3, mounted reliance

yum -y install gcc gcc-c++

4, compile and install

cd到httpd源码包所在目录,解压源码包。

#解压源码包
tar -xvf httpd-2.2.9.tar.gz

#切换到httpd目录下
cd httpd-2.2.9

#让apache核心装载DSO,并指定安装目录为/usr/local/apache2
./configure --enable-so --prefix=/usr/local/apache2

#编译
make

#编译安装
make install

#启动apache
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop

5, common parameters:

--prefix=路径指定安装路径
--enable-so开启Apache加载扩展模块的功能

6, pache working directory / usr / local / apache2 following main directories : **
bin directory where Apache is a script to start the service
conf directory is stored in the Apache configuration file
htdocs directory is the default web root directory of Apache
logs directory Apaceh is stored in the access and error logs
modules directory is stored in Apache modules related documents

Here Insert Picture Description

7, install mysql-source

#安装依赖
yum install ncurses-devel libaio-devel cmake -y

tar -zvxf mysql-5.6.15.tar.gz
cd mysql-5.6.15

#执行环境检测并指定安装路径
cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

#编译并编译安装
make && make install

#安装完毕之后生成配置文件
\cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

#新建mysql用户,不可登录操作系统
useradd -s /sbin/nologin mysql

#将所有mysql的相关文件所属组改为mysql用户
chown -R mysql.mysql  /usr/local/mysql

#初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql

#生成mysql启动脚本,这样我们就可以使用service来启动服务
\cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

#并给启动脚本755权限
chmod 755 /etc/rc.d/init.d/mysqld

#为方便工作 做软链接
ln -sv /usr/local/mysql/bin/* /usr/local/sbin/

#启动mysql
service mysqld start

#修改数据库root账户密码
mysqladmin password 123456

#登录mysql测试
mysql -uroot -hlocalhost -p'123456'

Second, install php source

1, the installation dependent on the environment and libraries

yum -y install libjpeg-devel libpng-devel freetype-devel libxml2-devel libcurl-devel gcc gcc-c++ bzip2-devel openssl-devel

2, compile and install

进入解压目录里执行
tar zxf php-5.3.10.tar.gz
cd php-5.3.10

./configure --prefix=/usr/local/php \ #(指定安装路径) 
--with-apxs2=/usr/local/apache2/bin/apxs \ #(php和apache的连接) 
--with-gd --with-ttf \ #(连接freetype) 
--with-zlib-dir \ 
--with-jpeg-dir \
--with-png-dir \
--with-mysql=/usr/local/mysql #依次链接之前安装的各种软件

make
make install

#修改主配置文件名称/usr/local/php/etc/php.ini
cp php.ini-development   /usr/local/php/etc/php.ini

Third, configure Apache supports dynamic php website

1, modify the Apache configuration file:

vim /usr/local/apache2/conf/httpd.conf
#修改如下配置
DirectoryIndex index.php index.html    #支持php
AddType application/x-httpd-php .php   #支持php应用

Here Insert Picture Description

2, restart apache

/usr/local/apache2/bin/apachectl -k restart 

3. Write php test page

rm -rf /usr/local/apache2/htdocs/*
vim /usr/local/apache2/htdocs/index.php
内容:
<?php
phpinfo();
?>

Here Insert Picture Description

Fourth, place the directory wordpress to the site

####配置wordpress####
#上传wordpress-4.9.4-zh_CN.zip并解压
unzip wordpress-4.9.4-zh_CN.zip
rm -rf /usr/local/apache2/htdocs/*
cp -a wordpress/* /usr/local/apache2/htdocs/
cd /usr/local/apache2/htdocs/
cp wp-config-sample.php wp-config.php
vim wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');			#修改这里
 
/** MySQL数据库用户名 */
define('DB_USER', 'root');				#修改这里
 
/** MySQL数据库密码 */
define('DB_PASSWORD', '123456');		#修改这里为数据库密码
 
/** MySQL主机 */
define('DB_HOST', 'localhost');

The browser then visit:

http://10.0.0.21
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Published 13 original articles · won praise 0 · Views 221

Guess you like

Origin blog.csdn.net/liuhuanboke/article/details/104895212
Recommended