基于CentOS 6.7搭建LAMP(httpd-2.4.18+mysql-5.5.47+php-5.6.16)环境

一、在CentOS 5.2 下安装
FreePBX 2.5.0内需安装的劳动如下:

CentOS 6.7
安装Nagios教程

参照文书档案:

第一保险系统能够联网。设置IP地址以及设想机安装linux在此略过。本文选择CentOS
6.7
陆十人minimal版、php5.6.16、httpd-2.4.18、mysql-5.5.47版搭建lamp情形。默许设置软件下载目录/usr/local/src,软件设置目录/app/local/下,安装顺序是apache→mysql→php。

目标:使Nginx帮衬Rubicontmp和煦推流,并扶助HLS分发功效及FFmpeg转码多码率成效。

DNS Server
Web Server
Mail Server
MySQL Database
Development Tools

一.安装正视包

透过博客园镜像获取apache、mysql、php

一、打算干活
模块:nginx-rtmp-module-master(支持rtmp协议)
下载地址:

开始的一段时期安装的时候没设置dns和mail这2个劳务,用

[root@Nagios ~]# yum install -y httpd php
[root@Nagios ~]# yum install -y gcc glibc glibc-common
[root@Nagios ~]# yum install -y gd gd-devel
[root@Nagios ~]# yum install -y perl ntp unzip
[root@Nagios ~]# yum install -y openssl-devel

博客园镜像:

1、安装依赖包:
#yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel
openssl-devel expat-devel gettext-devel libtool mhash.x86_64
perl-Digest-SHA1.x86_64 gcc-c++

yum install bind
yum install sendmail

[root@Nagios ~]# /etc/init.d/ntpd start
[root@Nagios ~]# chkconfig ntpd on

wget

-y install wget

2、安装git工具:
#mkdir soft-source
#cd soft-source
#wget

#tar xzvf git-latest.tar.gz
#cd git-2013-02-04
#autoconf
#./configure
#make && make install
# git –version
git version 1.8.1.GIT
#cd ..

来成功安装。假若是全新安装的话,记得在做系统的时候选一下dns和mail就行了。

[root@Nagios ~]# /usr/sbin/useradd -m nagios
[root@Nagios ~]# passwd nagios

wget

【错误管理】

二、配置网络及更新系统,禁止使用Selinux

[root@Nagios ~]# /usr/sbin/groupadd nagcmd
[root@Nagios ~]# /usr/sbin/usermod -a -G nagcmd nagios
[root@Nagios ~]# /usr/sbin/usermod -a -G nagcmd apache
[root@Nagios ~]# id nagios
uid=500(nagios) gid=500(nagios) groups=500(nagios),501(nagcmd)
[root@Nagios ~]# id apache
uid=48(apache) gid=48(apache) groups=48(apache),501(nagcmd)

wget

如果 git-latest.tar.gz大小为0,请下载git-latest-tar.xz

安排网络部分略去,一般都曾经设置好了。

二.nagios的安装

wget

然后xz -d git-latest.tar.xz解压为.tar

革新系统,用yum -y
update,小编的类别要求下载100多M,小编的互联网相当的慢,算了,在单位测量试验再创新了。

[root@Nagios ~]# cd /usr/local/src
[root@Nagios src]# wget

[root@Nagios src]# wget

[root@Nagios src]# tar zxvf nagios-4.1.1.tar.gz
[root@Nagios src]# cd nagios-4.1.1
[root@Nagios nagios-4.1.1]# ./configure –prefix=/usr/local/nagios
–with-comand-group=nagcmd
[root@Nagios nagios-4.1.1]# make all
[root@Nagios nagios-4.1.1]# make install
[root@Nagios nagios-4.1.1]# make install-init
[root@Nagios nagios-4.1.1]# make install-config
[root@Nagios nagios-4.1.1]# make install-commandmode
[root@Nagios nagios-4.1.1]# make install-webconf
[root@Nagios nagios-4.1.1]# cp -rf contrib/eventhandlers
/usr/local/nagios/libexec/
[root@Nagios nagios-4.1.1]# chown -R nagios:nagios
/usr/local/nagios/libexec/eventhandlers

wget

再tar xvf git-latest.tar

Selinux的剥夺有很种种艺术,轻松的用setup,找到Firewall
configuration,步入后把Selinux禁止使用就能够了。

三.nagios plugins的安装

wget

3、安装ffmpeg及其注重包:
++++++++Yasm+++++++++++
#wget
#tar xzvf yasm-1.2.0.tar.gz
#cd yasm-1.2.0
#./configure
#make
#make install
#cd ..
++++++++x264+++++++++++
#git clone git://git.videolan.org/x264
#cd x264
#./configure –enable-shared
#make
#make install
#cd ..

三、安装必要的恢宏包

[root@Nagios src]# tar xzf nagios-plugins-2.1.1.tar.gz
[root@Nagios src]# cd nagios-plugins-2.1.1
[root@Nagios nagios-plugins-2.1.1]# ./configure
–prefix=/usr/local/nagios –with-nagios-user=nagios
–with-nagios-group=nagios
[root@Nagios nagios-plugins-2.1.1]# make && make install

wget

++++++++LAME+++++++++++
#wget

#tar xzvf lame-3.99.5.tar.gz
#cd lame-3.99.5
#./configure –enable-nasm
#make
#make install
#cd ..
++++++++libogg+++++++++++
#wget
#tar xzvf libogg-1.3.0.tar.gz
#cd libogg-1.3.0
#./configure
#make
#make install
#cd ..
++++++++libvorbis+++++++++++
#wget

#tar xzvf libvorbis-1.3.3.tar.gz
#cd libvorbis-1.3.3
#./configure
#make
#make install
#cd ..
++++++++libvpx+++++++++++
#git clone
#cd libvpx
#./configure  –enable-shared
#make
#make install
#cd ..
++++++++FAAD2+++++++++++
#wget

#tar zxvf faad2-2.7.tar.gz
#cd faad2-2.7
#./configure
#make
#make install
#cd ..
++++++++FAAC+++++++++++
#wget

#tar zxvf faac-1.28.tar.gz
#cd faac-1.28
#./configure
#make
#make install
#cd ..

先是用yum安装以下扩充包

四.nrpe插件安装

wget
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

【错误管理】

yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg
libselinux-devel libsepol-devel libxml2-devel libtiff-devel gmp php-pear
php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel
audiofile-devel libogg-devel openssl-devel mysql-devel zlib-devel
perl-DateManip sendmail-cf

[root@Nagios src]# wget

[root@Nagios src]# tar zxf nrpe-2.15.tar.gz
[root@Nagios src]# cd nrpe-2.15
[root@Nagios nrpe-2.15]# ./configure –prefix=/usr/local/nagios
[root@Nagios nrpe-2.15]# make all
[root@Nagios nrpe-2.15]# make install-plugin
[root@Nagios nrpe-2.15]# make install-daemon
[root@Nagios nrpe-2.15]# make install-daemon-config

wget ftp://ftp.cn.debian.org/gentoo/distfiles/zlib-1.2.5.1.tar.gz

编写翻译FAAC-1.28时蒙受错误:

然后安装Lame 3.97

# 测验运营
# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

wget

mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*,
const char*)’

cd /usr/src

# 自带了运转脚本
[root@Nagios nrpe-2.15]# cp -rf init-script.in /etc/init.d/nrpe
[root@Nagios nrpe-2.15]# chmod a+x /etc/init.d/nrpe
[root@Nagios ~]# /etc/init.d/nrpe start

wget

缓和格局:

wget

注:其实nagios获取音讯都以靠/usr/local/nagios/libexec/check_nrpe
那个本子主动赢得nrpe服务端新闻

wget

从123行开头修改此文件mpeg4ip.h,到129行终止。
修改前:
#ifdef __cplusplus
extern “C” {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

tar zxvf lame-3.97.tar.gz

五.安顿并运行服务

wget

修改后:
#ifdef __cplusplus
extern “C++” {
#endif
const char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

cd lame-3.97

[root@Nagios ~]# vi /usr/local/nagios/etc/objects/contacts.cfg
define contact{
        contact_name                    nagiosadmin           
        use                            generic-contact       
        alias                          Nagios Admin           
        email                          ca0gu0@126.com
        }

wget

++++++++Xvid+++++++++++
#wget
#tar zxvf xvidcore-1.3.2.tar.gz
#cd xvidcore/build/generic
#./configure
#make
#make install
cd ../../../

./configure

[root@Nagios ~]# vi /usr/local/nagios/etc/objects/commands.cfg     
 
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H “$HOSTADDRESS$” -c
“$ARG1$”
}
       
[root@Nagios ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users
nagiosadmin

wget

++++++++ffmpeg+++++++++++
#git clone git://source.ffmpeg.org/ffmpeg
#cd ffmpeg
#./configure  –prefix=/opt/ffmpeg/ –enable-version3  –enable-libvpx
–enable-libfaac –enable-libmp3lame  –enable-libvorbis
–enable-libx264 –enable-libxvid –enable-shared –enable-gpl
–enable-postproc –enable-nonfree  –enable-avfilter
–enable-pthreads
#make && make install
#cd ..
【错误管理】

make

# 检查铺排文件是还是不是正确
[root@Nagios ~]# /usr/local/nagios/bin/nagios -v
/usr/local/nagios/etc/nagios.cfg

wget

设若提示libvpx decoder version must be
>=0.91,请从Baidu搜索一下libvpx-v1.1.0.tar.bz下载。

make install

[root@Nagios ~]# chkconfig nagios on
[root@Nagios ~]# service nagios start

wget

bzip2 -d  libvpx-v1.1.0.tar.bz2

六、安装asterisk和FreePBX

[root@Nagios ~]# chkconfig nrpe on
[root@Nagios ~]# /etc/init.d/nrpe start

先是安装相应的库文件:
yum -y install xz  libXpm-devel lua-devel libxslt-devel gcc
gcc-c++libjpeg libjpeg-devel glibc glibc-devel glib2 glib2-devel bzip2
bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs
e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl
openssl-devel openldap openldap-devel nss_ldap openldap-clients
openldap-servers

tar xvf  libvpx-v1.1.0.tar.bz2

Asterisk的设置请参见http://www.linuxidc.com/Linux/2008-10/16772.htm和http://www.linuxidc.com/Linux/2008-10/16773.htm

[root@Nagios ~]# chkconfig httpd on
[root@Nagios ~]# service httpd start
[root@Nagios ~]# touch /var/www/html/index.html

新建相应的目录和用户和用户组:

cd libvpx-v1.1.0

安装FreePBX

六.配备邮件发送

mkdir -p /app/local/{php,apache,mysql,data}
groupadd -g 500 www
useradd -u 500 -g 500 -G 500 -s /sbin/nologin www

./configure –enable-shared –enable-vp8

cd /opt

[root@Nagios ~]# yum -y install mailx
[root@Nagios ~]# echo “mail test” | mail -s test ca0gu0@126.com

groupadd mysql

make

wget

#若果不布置mail.rc默许会用本地postfix发送邮件
#email send tools
#nano /etc/mail.rc
#set from=s0lence@126.com smtp=smtp.126.com
#set smtp-auth-user=xx@oo smtp-auth-password=xxoo
#set smtp-auth=login

useradd -g mysql mysql -s /bin/false

make install

tar zxvf freepbx-2.5.0.tar.gz

图片 1

#cd /usr/local/src/

修改/etc/ld.so.conf如下:
include ld.so.conf.d/*.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/ffmpeg/lib
#ldconfig

cd /opt/freepbx-2.5.0

图片 2

#tar zxvf  apr-1.5.2.tar.gz

【说明】

./start_asterisk start

————————————–分割线

在Ubuntu下安顿Mrtg监控Nginx和服务器系统财富
http://www.linuxidc.com/Linux/2013-08/88417.htm

使用 snmp+Mrtg 监控 Linux 系统
http://www.linuxidc.com/Linux/2012-11/73561.htm

Mrtg服务器搭建(监察和控制网络流量)
http://www.linuxidc.com/Linux/2012-07/64315.htm

网络监察和控制器Nagios全计谋
http://www.linuxidc.com/Linux/2013-07/87067.htm

Nagios搭建与布局详解
http://www.linuxidc.com/Linux/2013-05/84848.htm

Nginx遭遇下营造Nagios监察和控制平台
http://www.linuxidc.com/Linux/2011-07/38112.htm

在SportageHEL5.3上安顿中央的Nagios系统(使用Nagios-3.1.2)
http://www.linuxidc.com/Linux/2011-07/38129.htm

CentOS 5.5+Nginx+Nagios监控端和被控端安装配备指南
http://www.linuxidc.com/Linux/2011-09/44018.htm

Ubuntu 13.10 Server 安装 Nagios Core 互连网监督运用
http://www.linuxidc.com/Linux/2013-11/93047.htm

#cd apr-1.5.2

动态装入器找到分享库要凭仗七个公文 — /etc/ld.so.conf 和
/etc/ld.so.cache。

./install_amp –username=asteriskuser –password=SOMEPASSWORD

————————————–分割线

Nagios
的详尽介绍
:请点这里
Nagios
的下载地址
:请点这里

本文永恒更新链接地址:http://www.linuxidc.com/Linux/2015-11/125427.htm

图片 3

#./configure –prefix=/usr/local/apr

安装完结后,ffmpeg位于/opt/ffmpeg/bin目录下。

echo “/usr/local/sbin/amportal start” >> /etc/rc.local

报错提醒:cannot remove `libtoolT’: No such file or directory ,

Linux下编译FFmpeg之下载源文件并编写翻译
http://www.linuxidc.com/Linux/2012-02/54565.htm

chkconfig httpd on

化解办法:编辑 configure文件,查找 $RM “$cfgfile”
那些地点,用#讲授掉,然后就可以了

Linux 编写翻译进级 FFmpeg 步骤
http://www.linuxidc.com/Linux/2013-08/88190.htm

chkconfig mysqld on

#./configure –prefix=/usr/local/apr

CentOS 5.6 上安装
FFMPEG
http://www.linuxidc.com/Linux/2011-09/42793.htm

在浏览器中开垦

#make && make install

在Ubuntu下安装FFmpeg
http://www.linuxidc.com/Linux/2012-12/75408.htm

Click red bar in FreePBX

#cd ../

Ubuntu 12.04下编译ffmpeg 
http://www.linuxidc.com/Linux/2013-02/78857.htm

图片 4

#tar zxvf apr-util-1.5.4.tar.gz

Ubuntu 14.04下PPA安装FFmpeg 2.2.2 
http://www.linuxidc.com/Linux/2014-05/101322.htm

#cd apr-util-1.5.4

越多详细情况见请继续读书下一页的美丽内容
http://www.linuxidc.com/Linux/2015-01/111182p2.htm

#./configure –prefix=/usr/local/apr-util
–with-apr=/usr/local/apr/bin/apr-1-config

图片 5

#make && make install

#cd../

#tar zxvf pcre-8.10.tar.gz

#cd pcre-8.10

#./configure –prefix=/usr/local/pcre

#make && make install

#cd ../

安装Apache

#tar zxvf httpd-2.4.18.tar.gz

#cd httpd-2.4.18

#./configure –prefix=/app/local/apache –enable-mods-shared=all
–enable-so –enable-proxy-ajp –enable-rewrite
–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util
–with-pcre=/usr/local/pcre

#make && make install

#cd ../

#chown -R www:www /app/local/apache/htdocs/

#chmod 755 /app/local/apache/htdocs/

先安顿一下httpd.conf
找到;ServerName www.example.com:80
改为ServerName localhost:80
#/app/local/apache/bin/apachectl -k start

在浏览器下输入ip地址查看apache是或不是成功运行

假设未有的话 恐怕是selinux和防火墙未有做相应设置

vi /etc/sysconfig/iptables

在端口22下一行出席80 3306端口配置(分别是apache和mysql的端口)

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

:wq保存退出

service iptables restart #重启防火墙使配置生效

接下来在关门selinux

vi /etc/sysconfig/selinux

改为SELINUX=disabled

:wq#封存退出

setenforce 0 #使配置马上生效

然后安装mysql,首先安装cmake

#tar zxvf cmake-3.1.3.tar.gz

#cd cmake-3.1.3

#./configure

#make && make install

#cd ../

#tar zxvf mysql-5.5.47.tar.gz

#cd mysql-5.5.47

#cmake -DCMAKE_INSTALL_PREFIX=/app/local/mysql
-DMYSQL_DATADIR=/app/local/data -DSYSCONFDIR=/etc

#make && make install

#cd ../

#chown -R mysql:mysql /app/local/data

# cp /app/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf

#ln -s /app/local/mysql/my.cnf /etc/my.cnf

#cd /app/local/mysql/

#./scripts/mysql_install_db –user=mysql –basedir=/app/local/mysql
–datadir=/app/local/data

#cp support-files/mysql.server /etc/init.d/mysql

#chkconfig mysql on

#service mysql start

#cd /usr/local/src

最后安装php

#tar zxvf libxml2-2.7.4.tar.gz

#cd libxml2-2.7.4

#./configure –prefix=/usr/local/libxml2

报错提醒:cannot remove `libtoolT’: No such file or directory ,

解决办法:编辑 configure文件,查找 $RM “$cfgfile”
那些地点,用#讲授掉,然后就足以了

#./configure –prefix=/usr/local/libxml2

#make && make install

#cd ../

#tar zxvf libmcrypt-2.5.7.tar.gz

#cd libmcrypt-2.5.7

#./configure –prefix=/usr/local/libmcrypt

#make && make install

#cd ../

#tar zxvf zlib-1.2.8.tar.gz

#cd zlib-1.2.8

#./configure

#make && make install

#cd ../

#xz -d libpng-1.2.56.tar.xz

#tar -xvf libpng-1.2.56.tar

#cd libpng-1.2.56

#./configure –prefix=/usr/local/libpng

#make && make install

#cd ../

#mkdir -p /usr/local/jpeg6/{bin,lib,include,man}

#mkdir /usr/local/jpeg6/man/man1

#tar zxvf jpegsrc.v9b.tar.gz

#cd jpeg-9b/

#./configure –prefix=/usr/local/jpeg6/ –enable-shared –enable-static

#make && make install

#cd ../

#tar jxvf freetype-2.4.12.tar.bz2

#cd freetype-2.4.12

#./configure -prefix=/usr/local/freetype

#make && make install

#cd ../

#tar zxvf autoconf-2.53.tar.gz

#cd autoconf-2.53

#./configure

#make && make install

#cd ../

#tar jxvf libgd-2.1.1.tar.bz2

#cd libgd-2.1.1

#./configure –prefix=/usr/local/gd2  –with-zlib=/usr/local/zlib
–with-jpeg=/usr/local/jpeg6 –with-png=/usr/local/libpng
–with-freetype=/usr/local/freetype/

#make && make install

#cd ../

#tar jxvf php-5.6.12.tar.bz2

#cd php-5.6.12

#./configure –prefix=/app/local/php
–with-config-file-path=/app/local/php/etc
–with-apxs2=/app/local/apache/bin/apxs –with-mysql
–with-libxml-dir=/usr/local/libxml2 –with-png-dir=/usr/local/libpng
–with-jpeg-dir=/usr/local/jpeg6 –with-freetype-dir=/usr/local/freetype
–with-gd=/usr/local/gd2 –with-zlib-dir=/usr/local/zlib
–with-mcrypt=/usr/local/libmcrypt –with-mysqli
–with-xpm-dir=/usr/lib64 –enable-soap –enable-mbstring=all
–enable-sockets

#make && make install

#cd ../

#cp /usr/local/src/php-5.6.12/php.ini-production
/app/local/php/etc/php.ini
#vi /app/local/php/etc/php.ini
找到;date.timezone
改为date.timezone=PRC
封存退出
配置apache解析php:
#vi /app/local/apache/conf/httpd.conf

找到;ServerName www.example.com:80
改为ServerName localhost:80
找到:AddType application/x-gzip .gz .tgz
在该行下边增添:AddType application/x-httpd-php .php
找到DirectoryIndex index.html
改为:DirectoryIndex index.html index.htm index.php
找到User daemon Group daemon
讲解后增多:User www
                    Group www

找到: Options  Indexes FollowSymLinks
修改为:Options  FollowSymLinks
找到:AllowOverride None
修改为:AllowOverride All

equire all granted

末了保存退出#/app/local/apache/bin/apachectl -t#测量试验httpd.conf
假如有不当,会有提示, 假若是科学的则显示为 “Syntax OK”

#/app/local/apache/bin/apachectl  start

#ps -ef|grep httpd

root    12130  1259  0 15:49 pts/0    00:00:00 grep httpd
root    23172    1  0 14:13 ?        00:00:00
/app/local/apache/bin/httpd -k start
www      23173 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start
www      23174 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start
www      23175 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start

证实已经运维
#vi /app/local/apache/htdocs/info.php

<?php

phpinfo();

?>

封存退出后在浏览器输入ip地址/info.php后检查实验是不是成功

如图所示

图片 6

图片 7

上边关于LAMP相关的内容你也许也喜欢

LAMP平台安装Bcache和Memcached加快网址运行 
http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7下搭建LAMP平台情形 
http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5系统设置配备LAMP(Apache+PHP5+MySQL)服务器意况
http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置
LAMP+phpMyAdmin PHP(5.5.9)开荒境况 
http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图像和文字详解 
http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP结合NFS构建Mini博客站点 
http://www.linuxidc.com/Linux/2015-08/121029.htm

正文永远更新链接地址:http://www.linuxidc.com/Linux/2016-04/130356.htm

图片 8

发表评论

电子邮件地址不会被公开。 必填项已用*标注