lamp编译安装

author author     2022-08-30     116

关键词:


#软件下载

#开源博客Wordpress    下载地址:https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz

#PHP 7   下载地址:http://cn2.php.net/distributions/php-7.1.4.tar.gz

#apache 下载地址: http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.25.tar.gz

#数据库 Mariadb 下载地址:系统镜像(本次采取yum 安装, 编译安装 参考:Mysql 5.7.17 编译安装


#系统环境

[[email protected]_1 ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)
[[email protected]_1 ~]# ip addr show eno33554960 
3: eno33554960: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:84:b7:60 brd ff:ff:ff:ff:ff:ff
    inet 192.168.174.134/24 brd 192.168.174.255 scope global dynamic eno33554960
       valid_lft 1779sec preferred_lft 1779sec
    inet6 fe80::20c:29ff:fe84:b760/64 scope link 
       valid_lft forever preferred_lft forever


#关闭防火墙和selinux

[[email protected]_1 ~]# systemctl stop firewalld
[[email protected]_1 ~]# setenforce 0


#YUM设置

[[email protected]_1 ~]# cat /etc/yum.repos.d/local.repo 
[local]
name=local
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1


apache编译安装

#下载软件(自行操作)

[[email protected]_1 ~]# ls
httpd-2.4.25.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gz
[[email protected]_1 ~]# tar -xf  httpd-2.4.25.tar.gz
[[email protected]_1 ~]# cd httpd-2.4.25/
#安装依赖包
[[email protected]_1 httpd-2.4.25]# yum install -y net-tools  pcre-devel zlib-devel apr apr-devel apr-util-devel gcc-c++
#编译 
[[email protected]_1 httpd-2.4.25]# ./configure --prefix=/usr/local/apache  --with-mysql=/usr/share/mysql  --enable-module=so  --enable-shared=max --enable-rewrite

#出现以下结果表示编译检查成功

configure: summary of build options:
    Server Version: 2.4.25
    Install prefix: /usr/local/apache
    C compiler:     gcc -std=gnu99
    CFLAGS:           -pthread
    LDFLAGS:         
    LIBS:           
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    C preprocessor: gcc -E
    
#编译安装
[[email protected]_1 httpd-2.4.25]# make && make install


#安装数据库

#本次采用yum安装 (编译安装可参考  Mysql 5.7.17 编译安装

[[email protected]_1 ~]# yum install -y mariadb mariadb-server
[[email protected]_1 ~]# systemctl start mariadb


#初始化数据库

[[email protected]_1 ~]# mysql_secure_installation 
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we‘ll need the current
password for the root user.  If you‘ve just installed MariaDB, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y            #选择 y
New password:                         #设置密码 123456
Re-enter new password:                #设置密码 123456
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y      #选择 y
 ... Success!

Normally, root should only be allowed to connect from ‘localhost‘.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n        #选择 n
 ... skipping.

By default, MariaDB comes with a database named ‘test‘ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y     #选择 y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y      #选择 y
 ... Success!

Cleaning up...

All done!  If you‘ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!


#创建Wordpress数据库

[[email protected]_1 ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 9
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘h‘ for help. Type ‘c‘ to clear the current input statement.

MariaDB [(none)]> create database wordpressdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user ‘wordpressuser‘@‘localhost‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on wordpressdb.* to ‘wordpressuser‘@‘localhost‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on wordpressdb.* to ‘wordpressuser‘@‘%‘ ;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye


#PHP7编译安装

#安装PHP依赖 libmcrypt 下载地址ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz

#下载libmcrypt
[[email protected]_1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz
[[email protected]_1  ~]# tar -xf libmcrypt-2.5.6.tar.gz 
[[email protected]_1 ~]# cd libmcrypt-2.5.6/
[[email protected]_1 libmcrypt-2.5.6]# ./configure 
[[email protected]_1 libmcrypt-2.5.6]# make && make install


#软件下载(自行操作)

[[email protected]_1 ~]# ls
 httpd-2.4.25.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gz   httpd-2.4.25           
[[email protected]_1 ~]# tar -xf php-7.1.4.tar.gz 
[[email protected]_1 ~]# cd php-7.1.4/
[[email protected]_1  php-7.1.4]# yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
[[email protected]_1  php-7.1.4]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-exif --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --disable-fileinfo


#出现以下情况表示编译检查成功
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

#编译安装
[[email protected]_1  php-7.1.4]# make && make install


#修改http配置文件以支持php

[[email protected]_1 ~]# vim /usr/local/apache/conf/httpd.conf
#将第254行修改为如下值
<IfModule dir_module>
     DirectoryIndex index.php index.html 
</IfModule>
#第392行增加如下值
  AddType application/x-httpd-php .php


#开启服务

[[email protected]_1 ~]# /usr/local/apache/bin/apachectl -k start
AH00557: httpd: apr_sockaddr_info_get() failed for KVM_1
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1. Set the ‘ServerName‘ directive globally to suppress this message
[[email protected]_1 ~]# 

此处的两个警告产生的原因是 没有设置 ServerName 和 没有在 /etc/hosts 设置主机名与ip的对应关系 

[[email protected]_1 ~]# vim /usr/local/apache/conf/httpd.conf
#修改第196行 改为如下值
ServerName localhost:80


[[email protected]_1 ~]# vim /etc/hosts
[[email protected]_1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.174.134 KVM_1
[[email protected]_1 ~]# /usr/local/apache/bin/apachectl -k restart


#添加php文件

[[email protected]_1 ~]# vim /usr/local/apache/htdocs/index.php
[[email protected]_1  ~]#  rm -f /usr/local/apache/htdocs/index.html  
[[email protected]_1 ~]# cat /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
[[email protected]_1 ~]# chown -R daemon:daemon /usr/local/apache


#测试

技术分享



#设置虚拟主机

[[email protected]_1 ~]# vim /usr/local/apache/conf/httpd.conf
#取消第479行的注释(或者在最后一行增加如下配置)
Include conf/extra/httpd-vhosts.conf
[[email protected]_1 ~]# vim /usr/local/apache/conf/extra/httpd-vhosts.conf 
#添加如下配置(删除原有配置)
<VirtualHost 192.168.174.134>
DocumentRoot "/usr/local/apache/htdocs/blog"
ServerName "blog.chauncey.com"
<Directory "usr/local/apache/htdocs/blog">
AllowOverride None
Require all granted
</directory>
</VirtualHost>

[[email protected]_1 ~]# mkdir /usr/local/apache/htdocs/blog


#安装开源博客 Wordpress

#软件下载(自行操作)

[[email protected]_1 ~]# ls
anaconda-ks.cfg  httpd-2.4.25.tar.gz  libmcrypt-2.5.6.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gz
httpd-2.4.25     libmcrypt-2.5.6      php-7.1.4     
[[email protected]_1 ~]# tar -xf wordpress-4.7.4-zh_CN.tar.gz 
[[email protected]_1 ~]# cp -rf wordpress/* /usr/local/apache/htdocs/blog/
[[email protected]_1 ~]# chown -R daemon:daemon /usr/local/apache/htdocs/blog

#语法检查
[[email protected]_1 ~]# /usr/local/apache/bin/apachectl -t
Syntax OK

#开启服务
[[email protected]_1 ~]# /usr/local/apache/bin/apachectl -k start
[[email protected]_1 ~]# netstat -lntup | grep 80
tcp        0      0 192.168.174.134:80      0.0.0.0:*               LISTEN      3068/httpd          
[[email protected]_1 ~]#

#设置DNS解析

#window设置hosts文件(C:WindowsSystem32driversetchosts)增加一行解析  #Linux设置hosts  (/etc/hosts) 


技术分享


#输入blog.chauncey.com

技术分享


#填写相关数据

技术分享



#填写相关数据

技术分享


技术分享

#安装完成,wordpress十分强大,插件丰富,可以去腾讯云或者阿里云买一台云主机,来搭建自己的个人博客。


技术分享





本文出自 “Chauncey” 博客,请务必保留此出处http://cqwujiang.blog.51cto.com/10808946/1923521

lamp源码编译安装

查看详情

编译安装lamp环境

LAMP环境配置:httpd-2.4.23+mysql-5.5.51+php-5.5.38编译安装过程编译前先准备系统的开发环境:# yum groupinstall "Development tools" "Server Platform Development"一、编译安装apache1、解决依赖关系httpd-2.4.23 查看详情

源码编译安装lamp

一、概述1、源码编译安装LAMP为什么要源码编译      一般来说,我们软件的安装方式有yum(rpm),和源码编译两种方式,那么为什么我们需要源码编译安装一部分软件?选择源码编译安装软件有以下几个原... 查看详情

编译安装lamp

题目:在LAMP架构中,请分别以php编译成httpd模块形式和php以fpm工作为独立守护进程的方式来支持httpd,列出详细的过程。本次实验以CentOS7为搭建环境,并且已经使用源码编译安装了httpd-2.4(默认使用prefork模块)和使用通用二进... 查看详情

lamp编译安装(代码片段)

lamp编译安装CentOS6:PHP-5.3.2之前:默认不支持fpm机制;需要自行打补丁并编译安装httpd-2.2:默认不支持fcgi协议,需要自行编译此模块解决方案:编译安装httpd-2.4,php-5.3.3+CentOS7:httpd-2.4:rpm包默认编译支持fcgi模块php-fpm包:专用于... 查看详情

lamp之自动化编译安装

...php-fpm的安装,安装高版本的数据库在centos6上也需要通过编译安装完成,本文介绍了Modules模式和FastCGI模式快速部署LAMP的包和相关操作,同时附上了一键安装的编译脚本。2 快速部署LAMP在CentOS6和7中,在Modules模式和FastCGI模式... 查看详情

lamp编译安装1

650)this.width=650;"src="https://s4.51cto.com/wyfs02/M00/8C/CC/wKioL1h4o0aQgM_GAAP_QuXLPWc712.jpg"title="LAMP编译安装1.jpg"alt="wKiom1h4oGbwtqpHAAQHoqOfbzE513.jpg"/> 查看详情

lamp之编译安装

...易用,但在某些特定情况下,由于有特殊需求,需要基于编译这种方式来定制化安装所需要的软件,以能特供自己所需的功能,此处我们来基于编译实现LAMP环境,来揭开编译安装这种听起来高大上的安装方式。首先来交代一下... 查看详情

lamp编译安装系列

主要还是centos6.9和centos7上相应软件包的安装及编译安装。所用版本均为当前最新版。生产环境中不建议这么干,毕竟生成以稳定为主。LAMP里php是最后安装,php依赖于服务器和数据库,所以这里单独编译系列就只有httpd和mariadb了... 查看详情

lamp安装脚本(编译方式)

#!/bin/bash##**********************************************************#*filename:   lamp_install.sh  *#*discription:  lampinstall  *#*version:   centos6.7a 查看详情

lamp环境编译安装

MySQL编译安装#安装编译代码需要的包yum-yinstallmakegcc-c++cmakebison-devel  ncurses-devel#mysql安装wgethttp://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.32.tar.gztar-zxvfmysql-5.6.32.tar.gzcdmysql-5.6.3 查看详情

lamp编译安装(未完待续)

顺序安装:linuxapachemysqlphpLinux这个就不多说明了...CentOS6.5镜像虚拟机安装一次性安装开发工具:#yumgroupinstall"Developmenttools"or:#yum-ygroupinstall"Developmenttools"查看已安装的:#yumgrouplist|more#yumgrouplist|grepDevelpment#yumgrou 查看详情

编译安装lamp

yuminstallgccgcc-c++ncurses-develperl 安装cmakewgethttp://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz  tar-xzvfcmake-2.8.10.2.tar.gz  cdcmake-2.8.10.2  ./bootstrap& 查看详情

超详细lamp环境手动编译安装实例

LAMP编译安装实例:    HTTPD编译安装:    下载软件包:    # wget http://mirrors.hust.edu.cn/apache//apr/apr-1.6.3.tar.gz http://mirrors.hust.edu 查看详情

源码编译安装lamp

环境:centos6.6;httpd-2.2.34;mysql-5.5.55;php5.6.31#!/bin/bash#2017-08-12#author by Tan Wen Xin#Auto install LAMP#create DNS servercat>>/etc/resolv.conf<& 查看详情

编译安装lamp

软件包链接:http://pan.baidu.com/s/1mijn44g  密码:abja 系统环境:centos7开发环境:Developmenttools、ServerPlatformDevelopmenthttp+php的方式:PHP模块化个程序版本:mariadbmariadb-5.5.46-linux-x86_64.tar.gzhttphttpd-2.4. 查看详情

lamp编译实现

一、简述LAMP:二、HTTP2.4编译安装三、源码安装MySQL5.6四、源码安装php-5.6五、配置http访问PHP六、配置php访问mysql实验环境为:   php-fpm和msyql编译为同一台主机(CentOS6.9)   httpd单独一台主机(CentOS6.9)一、... 查看详情

编译安装lamp

文章说明本文中Linux命令使用的大部分是绝对路径(若没有前面有相应的目录切换命令)安装时可以不考虑路径问题服务器相关信息腾讯云Centos72G内存20G硬盘软件源码位置及软件安装的目录源码存放目录:usrsrc软件安装目录:usrl... 查看详情